Jump to content

uvm_config_db set and UVM ERROR virtual if not configured


Recommended Posts

When the UVC is instantiated only once and connected to Interface.

In top.sv

st_if st_if_0(clock, reset);

In tb_env.sv

st_pkg::st_env st0;

in build phase

st0 = st_pkg::st_env::type_id::create("st0", this);

uvm_config_db#(virtual st_if)::set(this,"*","vif",top.st_if_0);

the above code works.

Now I need to instantiate more than once, Created wrapper like this:

class if_wrapper extends uvm_component;

virtual st_if if1;

function new(string name,virtual csco_st_if if_,uvm_component parent = null);

super.new(name,parent);

if1 = if_;

endfunction : new

endclass : if_wrapper

in top.sv: used Gen as follows

genvar i;

generate

for(i=0; i < `NUM; i++)

begin: c_gen

st_if st_if(clock, reset);

if_wrapper if_wr = new($psprintf("if_wrapper_%03d",i),st_if);

end

endgenerate

in tb_env.sv

st_pkg::st_env st[`NUM];

if_wrapper if_wr;

in build phase

for (int i=0; i < `NUM; i++) begin

$cast(if_wr, lookup($psprintf(".if_wrapper_%03d",i)));

uvm_config_db#(virtual st_if)::set(this,$psprintf("st%03d",i),"vif",if_wr.if1);

st = st_pkg::st_env::type_id::create($psprintf("st%03d",i),this);

end

Now it compiles, but I get following Error

UVM_ERROR ./sim/st/sv/st_rx_driver.sv(55) @ 0: top.tb_env.st000.st_rx_agent.driver [st_rx_driver] virtual if not configured

No Error in checking virtual interface in st_env.sv

if(!uvm_config_db#(virtual st_if)::get(this,"","vif",vif))

`uvm_error("NOVIF","virtual if not configured");

endfunction

but the error appears only .st_rx_agent.driver

if(!uvm_config_db#(virtual st_if)::get(this,"","vif",vif))

`uvm_error(get_type_name(),"virtual if not configured");

How to fix this error.

Thanks in Advance

Jay

Link to comment
Share on other sites

hi,

there are a few common causes for this error

1. the if has not been set - the property "top.tb_env.st000.st_rx_agent.driver.vif" is unset (simply unset, wrong hierarchy, mistyped or similar)

2. the if has been set but the uvm_config_db parameter type is not equivalent between set() and get().

Link to comment
Share on other sites

Hi uwes,

Thanks for the reply.

Env changed only the config_db set, the get was working when uvc is instantiated only once. so mostly this will be set issue, Please let me know how I can debug this config_db in IUS or VCS simulator.

thanking you once again

Jay

Link to comment
Share on other sites

why not

1. split the full path into context plus path down from the current object

uvm_config_db#(virtual st_if)::set(this, $sformatf("*.st%03d*",i), "vif",if_wr.if1); // you have to remove "*." if st000 is a child of the current object

2. remove the postfix wildcard match

uvm_config_db#(virtual st_if)::set(this, $sformatf("*.st%03d",i), "vif",if_wr.if1);

(3.) if you are really funny you can replace the whole set with a posix regexp

uvm_config_db#(virtual st_if)::set(this, "/st[0-9]{3}/"), "vif",if_wr.if1); // would apply to direct subcomponents of "this" named "st000".. "st999" with a field "vif"

Link to comment
Share on other sites

hi,

for debugging configuration issues you can:

1. dump the database uvm_config_db#(int)::dump()

2. trace sets and gets using the +UVM_CONFIG_DB_TRACE or +UVM_RESOURCE_DB_TRACE switches in the upcoming UVM release

3. you could switch auditing on to find readers and writers of an resource uvm_resource_options::turn_on_auditing() followed by a <resource>.print_accessors()

4. you could enable the "verbose" mode of uvm_component.apply_config_settings

5. you can check using uvm_component.check_config_usage() to detect config settings write-no-read

6. you can use uvm_component.(print_config|print_config_with_audit|print_config_settings)

Link to comment
Share on other sites

Hi Owes

thanks for Debugging tricks..Point 2 (remove the postfix wildcard match) was not working, because the monitor/driver where the vif need to be set is 2 level below the uvv_env, as mentioned first email the uvc_env vif setting works .. Pluse point 3(posix regexp) gave me a syntax error.

thanks

Jay

Link to comment
Share on other sites

Hi Owes

Removed the prefix wildcard worked and Now set command is as follows

uvm_config_db#(virtual st_if)::set(this, $sformatf("st%03d*",i), "vif",if_wr.if1);

May be the vif get instant names are as follows

1. st_env (st000, or st001 ...)

2. st000.st_rx_agent.monitor , st001.st_rx_agent.monitor, ..

3. st000.st_tx_agent.monitor , st001.st_tx_agent.monitor, ..

4. st000.st_rx_agent.driver, st001.st_rx_agent.driver, ..

5. st000.st_tx_agent.driver, st000.st_tx_agent.driver, ..

Jay

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...