Jump to content

Unable to set object and retrive it when needed.


Recommended Posts

I have extended my_test_config from uvm_ojbect.

I then use

my_test_config = my_test_config::type_id::create("my_test_config);

set_config_object("*.my_env", "cfg", my_test_config);

But when I print_topology() I get the following

Name Type Size Value

my_env top_env - @505

cfg object - <null>

Could someone help me sort this out. The problem my_test_config is supposed to override my default configuration in my_env

So when I use

uvm_config_db#(my_test_config)::get(this, "", "cfg", cfg);

It fails and hits uvm_fatal

Thanks in advance.

Link to comment
Share on other sites

Hello Bala,

If you use set_config_object in your testbench, the type associated with my_test_config is uvm_object. So when you do the get() with my_test_config type it can't find it. I suggest that you use the following instead.

Use uvm_config_object::set() in your test or testbench. I believe this syntax is new in UVM1.1a and replaces set_config_object.

Then in your component, if you have used the UVM automation macros, the cfg will automatically get applied during the build_phase() method when apply_config_settings() is executed.

The advantage here is that you get() the config automatically if you use uvm_config_object::set()

Optionally you can to use uvm_config_object::get() directly in the env.

The disadvantage of using uvm_config_object::set() is that it is not checked during compile/elaboration time. The failure would occur during run-time instead.

I hope this helps!


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.

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