Virtual Sequence and Virtual Sequencer - How to use it inside your UVM Environment ?

The concept of virtual sequence and virtual sequencer is so helpful when there are multiple sequences and sequencers to deal with. To remove any confusion in declaring more than one sequence to start on more than one sequencer respectively, Virtual sequence is declared in the Test class which is extended from uvm_test, Virtual sequencer is declared in the Environment class which is extended from uvm_env.

In the class of Virtual Sequence declare the Virtual Sequencer using the macro "`uvm_declare_p_sequencer" the concept of p_sequencer enters here. To understand p_sequencer one must know what is m_sequencer.

m_sequencer and p_sequencer

m_sequencer is the default sequencer and is available by default in a uvm_sequence, where as p_sequencer is something which is not present in UVM we have to declare it manually. When we have a m_sequener what is the use of p_sequencer to be declared?

The type of m_sequencer is uvm_sequencer_base. It means when you have defined new properties declared in your own sequencer, they cannot be accessed using the m_sequencer because it does not know them. So when the macro `uvm_declare_p_sequencer is declared, the macro defines the function called m_set_p_sequencer which casts the m_sequencer to the p_sequencer. Now the new properties defined in the sequencer can be accessed as p_sequencer.my_property.

The final step to be included in your environment is inside the environment class assign the sequencers declared in the agents to virtual sequencer handles.






要查看或添加评论,请登录

社区洞察

其他会员也浏览了