Difference Between m_sequencer and p_sequencer
Hello guys,
So this is the very little but very important difference between the m_sequencer and p_sequencer in uvm.
Today we will see what is the difference between m_sequencer and p_sequencer, may be this is the most frequently asked question in interview from uvm section and may be this is the most confusing topic too. Let's today solve this puzzle forever.
Here I am assuming that you are aware about uvm components and uvm object. Basically sequencer is used to route the random transactions to driver which is generated by sequence class. If you are not specifying any thing by default uvm is using m_sequencer.
WHY WE NEED P_SEQUENCER ??????
Say you want to design your sequence class such that based on RTL response it should generate further transactions. In this scenario sequence needs to access the user defined properties or methods of the sequencer as per requirement of the project which are unavailable in m_sequencer. So in this scenario you need to use p_sequencer. Basically it overrides the actual sequencer and now you can use p_sequencer in your sequence class and can access methods and properties of sequencer class in sequence class using p_sequencer.method or p_sequencer.property .
HOW TO USE P_SEQUENCER ???????
If you want to use p_sequencer in your environment you just have to use `uvm_declare_p_sequencer(sequencer_name) macro in your base sequence classs. By using this macro now uvm will override sequencer with p_sequencer. In uvm_seqence_base_class handle of p_sequencer is already taken so now using that handle we can use properties and methods of sequencer class into our sequence class. i.e. p_sequencer.method or p_sequencer.property
Use below eda link for further reference :
So this is the very little but very important difference between the m_sequencer and p_sequencer in uvm.
Hope you guys enjoyed the article.
Thank you......
Great explanation
ReplyDeleteShould I have to choice the VCS ? I've got some error message when I choose the INCISIVE with https://www.edaplayground.com/x/3mPH
ReplyDeleteWhy i can not use m_sequencer? if i can access p_sequencer in sequence and p_sequencer is casted version of m_sequencer then i think we can use m_sequencer in sequence as well. please provide your inputs on the same.
ReplyDeleteThanks and Regards,
Mitesh Patel
Hi Mitesh
DeleteSorry for my delayed response.
m_sequencer is a generic uvm sequencer pointer of type uvm_sequencer_base. It will always exist for an uvm_sequence and is initialized when the sequence is started.
p_sequencer is a reference to uvm_sequencer#(REQ,RSP), the user derived parameterized sequencer class.
Other way you can say that p_sequencer is a type specific sequencer pointer.
thank you very much
ReplyDeletethis doubt was eating my head from last 1 year , finally got clarity.