Jump to content
Sign in to follow this  
hugemx830202

How to use uvm_config_db method to get object/int values from TB?

Recommended Posts

Hi,

I defined an integer in TB env(tb_env) called 'test', and in my sequence, I call assert(uvm_config_db#(int)::exists(uvm_top, "tb_env", "test", 1)); to check whether the sequence can obtain 'test' value, but assert failed. I just used `uvm_field_int(test, UVM_ALL_ON) to register to the factory. Could you help? Thanks a lot!

BR

Mike

Share this post


Link to post
Share on other sites

Your environment should not look upward in to the configuration DB, only downward. Otherwise you are breaking the encpasulation principle.

Instead you should use the uvm_resource_db#(int) and store an int under a known name.

Share this post


Link to post
Share on other sites

hi,

adding to janick's comments. its not that this style breaks encapsulation its also prevents a proper configuration override. so you should make a local field "test" and make an appropriate set_config or ::set from test/env/agent or similar. (keep in mind that there could be more than a single set-config)

Share this post


Link to post
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.

Sign in to follow this  

×
×
  • Create New...