to write like this how should i write inteface and instantiation of interface
i wrote interfac like
interface phy_if (input bit clk);
is it ok or any dynamic array for interface name needed
interface phy_if[1:0] (input bit clk);
and for instantiation of interface i have to use gen var or not
genvar i;
for(i=0; i< num_dut_instances; i++) begin : dut_inst
Dut_if dut_if();
initial uvm_config_db#(virtual Dut_if)::set(uvm_root::get(),"*",$sformatf("dut_if_%0d",i),dut_if);
end
It looks like you have 2 functional interfaces in your design,one is named (instance names) in0 and the other one in1. Correct?
You have 2 different reset signals?
You have 2 intr signals?
Would be great if you could provide yor definition of the SV interface.
I do not see why you shoule need a dynamic array for the interfaces.
am having intr and reset signals two sets with intr_0,intr_1 reset_0,reset_1 these variables are in one interface
these are 2 set of signals thats why i took as a no of agents 2
mdio, mdc these two signals are in one interfaces these are one set of variables but to intract with above 2 agents i took 2 no of agents
by depending on mdio and mdc that intr,and reset will work i have to process between these two pair of agents
if i want to assign a value two signals are taking same vale thats why i took dynamic array
to differentiate
The question is not how many signals for interrupt or reset you have to define the number of interfaces and agents. The question is how many different functional interfaces you have. From your signal naming I guess you are using the mdio-interface (Cypress). Correct? If your design has only one mdio interface you need only one agent.
thanks for reply
am having two interfaces mdio_if,if for if am getting error like
Illegal assignment to type ‘virtual if #(0)’ from type ‘virtual if’: Vir. ‘if’ interface must be assigned a matching interface or virtual interface.
interface :
interface if #(int pm = 1) (input bit clk);
bit [pm:0] intr;
bit [pm:0] rst_n;
bit [1:0] link [0:pm];
clocking wdr_cb @ (posedge clk);
default input #3 output #1;
input rst_n;
output phy_intr;
input link;
endclocking
endinterface
in my top:
virtual interface instantiation:
phy_if #(1) INTF_1(clk);
phy_if #(0) INTF_0(clk);
in test:
get config:
if (!uvm_config_db #(virtual if#(0))::get(this, “”, “INTF_S_SLAVE”, wr_cfg_h[0].phy_vif))
if (!uvm_config_db #(virtual if#(1))::get(this, “”, “INTF_M_MASTER”,wr_cfg_h[1].phy_vif))
What is wrong in this code?? Does anyone know why it isnt working?
Not sure if it’s a typo but you have declared interface name as “interface if” and in top you are using “phy_if”. Try changing phy_if to if and it should work.
thanks for rply
that is typing mistake i used it properly even though it is showing same error.
right now am using model sim tool.
is this tool will work properly for this or am i did anything wrong?
in test:
get config:
if (!uvm_config_db #(virtual phy_if#(0))::get(this, “”, “INTF_S_SLAVE”, wr_cfg_h[0].phy_vif))
if (!uvm_config_db #(virtual phy_if#(1))::get(this, “”, “INTF_M_MASTER”,wr_cfg_h[1].phy_vif))
in driver also i have to use parameterized virtual interface?
class phy_if_wr_driver extends uvm_driver #(phy_if_write_xtn);
`uvm_component_utils (phy_if_wr_driver)
virtual phy_if #(int pm = 1).phy_wdr_cb phy_vif
endclass
The parameters used in the virtual interface variable declaration have to match the parameters used in the interface instance that will be assigned to the variable.
is it possible to get two interface signals in to a single agent.
if (has_wagent)
begin
begin
wr_cfg_h = new[no_of_mdio_wr_agents];
begin
wr_cfg_h[0] = wr_agent_config::type_id::create( "wr_cfg_h[0]");
if (!uvm_config_db #(virtual phy_if #(0))::get(this, "", "INTF_M_MASTER", wr_cfg_h[0].phy_vif_0))
`uvm_fatal("VIF CONFIG","cannot get()interface vif from uvm_config_db. Have you set() it?")
wr_cfg_h[0].is_active = UVM_ACTIVE;
env_cfg.wr_cfg_h[0] = wr_cfg_h[0];
$display(" env_cfg.wr_cfg_h[0] %d", env_cfg.wr_cfg_h[0]);
end
begin
wr_cfg_h[0] = wr_agent_config::type_id::create( "mdio_cfg_h[0]");
if (!uvm_config_db #(virtual mdio_if )::get(this, "", "mdio_str", wr_cfg_h[0].mdio_vif))
`uvm_fatal("VIF CONFIG","cannot get()interface vif from uvm_config_db. Have you set() it?")
wr_cfg_h[0].is_active = UVM_ACTIVE;
env_cfg.wr_cfg_h[0] = wr_cfg_h[0];
$display(" env_cfg.wr_cfg_h[0] %d", env_cfg.wr_cfg_h[0]);
end
end
end
i need to get two interfaces variables in to a single agent
getting two interface in a single component is possible given that they were set using unique identifier and same identifier is used to get them. The code you have posted above doesn’t make sense, you are instantiating wr_cfg_h[0] twice with different name. I think it may be a typo, can you confirm and post correct code of get and set.
if (has_wagent)
begin
begin
wr_cfg_h = new[no_of_mdio_wr_agents];
begin
wr_cfg_h[0] = wr_agent_config::type_id::create( "wr_cfg_h[0]");
if (!uvm_config_db #(virtual phy_if #(0))::get(this, "", "string", wr_cfg_h[0].phy_vif_0))
`uvm_fatal("VIF CONFIG","cannot get()interface vif from uvm_config_db. Have you set() it?")
wr_cfg_h[0].is_active = UVM_ACTIVE;
env_cfg.wr_cfg_h[0] = wr_cfg_h[0];
$display(" env_cfg.wr_cfg_h[0] %d", env_cfg.wr_cfg_h[0]);
end
begin
wr_cfg_h[0] = wr_agent_config::type_id::create( "mdio_cfg_h[0]");
if (!uvm_config_db #(virtual mdio_if )::get(this, "", "string", wr_cfg_h[0].mdio_vif))
`uvm_fatal("VIF CONFIG","cannot get()interface vif from uvm_config_db. Have you set() it?")
wr_cfg_h[0].is_active = UVM_ACTIVE;
env_cfg.wr_cfg_h[0] = wr_cfg_h[0];
$display(" env_cfg.wr_cfg_h[0] %d", env_cfg.wr_cfg_h[0]);
end
end
end
is it work?
that second get of env_cfg value will override or not?