Jump to content

using uvm_config_db::get inside a module


Recommended Posts

Hi,

 

can i use uvm_config_db::get function from inside a module?

i want to create a configuration object in the test, set it at the config_db and get it in a VIP written as a module.

something like this:

 

module vip();

initial begin
    // Wait for first clock - this means we are in the main phase
    @(posedge if.clk);
 
    if (!uvm_config_db#(vip_config)::get(null, "uvm_test_top","cfg", cfg)) begin
        `uvm_fatal("CFGERR", "%m vip cfg not set")
    end
    ...
end
endmodule
 
i tried this and got the fatal error, meaning the cfg wasn't found.
 
i tried instead to create a typedef struct and pass it from the test to the module using set and get but the simulation crashed - "--- Stack trace follows".
 
Any help would be much appreciated.
 
Thx,
Assaf
Link to comment
Share on other sites

hi,

 

of course you can use the config_db from within a module. if the element cannot be found it means

 

- it has never been put into the config_db (code not executed, module missing, set-after-get or similar)

- the combination of scope,path,field,type during ::get doesn't match the one used during ::set

 

switch on +UVM_CONFIG_DB_TRACE and see what is being stored and retrieved 

 

/uwe

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...