The main difference between m_seqeuncer and p_sequencer in one line is the parent and child class handle types. m_sequencer is of parent type and p_sequencer is of child type.
More detailed idea on these sequencers as given below.
m_seqeuncer is the handle of a base class type “uvm_sequencer_base” , which is parent class of "uvm_sequencer".
m_sequencer handle is declared inside “uvm_seqeunce_item” class from which we extend user defined sequence item class.
whenever we create sequence items for UVM TB (TestBench), m_sequencer gets declared even before creating any user specific sequences.
Whereas p_sequencer handle not even present in out TB until we declare it manually.
When we call sequence.start(sequencer) method, internally set_sequencer method called, which basically points m_sequencer to the user specific “sequencer” handle passed in start method. This is done by static casting as child class can be assigned to parent.
For p_sequencer handle to declare we call macro inside sequence like this, `uvm_declare_p_sequencer(sequencer).
This macro declares p_sequncer handle of type sequencer which is passed and dynamically casts p_sequencer to m_sequencer. If we don’t call this macro p_sequencer does not exist. We use p_sequencers inside our sequences to access the methods or properties of user defined sequencer if needed.
No comments:
Post a Comment