Jump to content

reference to component hierarchy from inside sequence class


Recommended Posts

Hello,

I am working a simple test bench that has one master agent, and multiple slave agents. Each slave agent has some properties that are randomized. I want to generate constrained random stimulus from the master agent to any of the slaves. I am stuck trying to get a reference to the test environment (derived from uvm_env) from within the sequence class.

I have derived a class from uvm_sequence, and want to reference the slave agents in order to constrain the generated stimulus.

What is the best way for sequences body() to read constraints from other test environment components.

Manoj

Link to comment
Share on other sites

hi,

you might use your sequencer from within the sequence via get_sequencer() or when using the uvm_declare_p_sequencer() macro plus the p_sequencer field. once you know your sequencer you can traverse the way you want. as alternativ you can use jade's suggested path or you could use the uvm_config_db to share your config under a known key and access the db from any place such as within a sequence.

Link to comment
Share on other sites

Thanks for the tips. I was able to get a pointer to the component using the find_all method.

class my_squence extends uvm_sequence #(myTransactionType1)

uvm_root top;

uvm_component compList[$];

virtual task body();

top = uvm_root::get()

top.find_all("*",compList,);

.....

I have not tried the get_sequencer() method yet, but I think it would lead to more portable code, so I may try going back to that later on.

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