cliffc Posted October 3, 2012 Report Share Posted October 3, 2012 Cliff's Pre-Read(!) Summary: Use: get_sequencer() method or the less-descriptive m_sequencer handle. Avoid: p_sequencer and `uvm_declare_p_sequencer macro. Feedback: Curious about what other engineers think of these guidelines. Also reference the thread: http://www.uvmworld.org/forums/showthread.php?427-m_sequencer-vs-p_sequencer class uvm_sequence_item extends uvm_transaction Has a protected m_sequencer handle (uses public set_sequencer and get_sequencer methods to access - see below) methods: set_sequencer: sets m_sequencer handle. (also calls m_set_p_sequencer(empty), which should set p_sequencer if `uvm_declare_p_sequencer was called). `uvm_declare_p_sequencer macro is defined in (uvm/src/macros directory) get_sequencer: returns m_sequencer handle. m_set_p_sequencer: An empty method in this class. It is fully defined by the `uvm_declare_p_sequencer macro (details below), if used, else the p_sequencer variable does not get set. class uvm_sequence_base extends uvm_sequence_item Note: inherits m_sequencer handle and set_sequencer() and get_sequencer() methods. methods: start (<on this> sequencer-hierarchical-path): calls set_sequencer() to set m_sequencer to the sequencer handle that was passed as an argument to the start method calls m_set_p_sequencer() that casts m_sequencer to p_sequencer (if the `uvm_declare_p_sequencer macro was called in the sequence) class uvm_sequence extends uvm_sequence_base methods: Important methods were inherited from uvm_sequence_base class. Includes the start(<on specified> sequencer-hierarchical-path) method. From the uvm_sequence_defines.svh macros file (uvm/src/macros directory) `uvm_declare_p_sequencer seems to be a macro that is useful if the user has added some special variables to the tb_sequencer (which I have never seen done). Setting the sequencer in a sequence using the `uvm_declare_p_sequencer macro seems like a bad idea. It ties the sequence to a particular sequencer. Better to let the sequence inherit the sequencer when the sequence is invoked with the start() method (sets the m_sequencer handle and enables use of the get_sequencer() method). p_sequencer seems to have very limited unique utility. Macro definition: `define uvm_declare_p_sequencer(SEQUENCER) \ SEQUENCER p_sequencer;\ virtual function void m_set_p_sequencer();\ super.m_set_p_sequencer(); \ if( !$cast(p_sequencer, m_sequencer)) \ `uvm_fatal("DCLPSQ", <error message>) \ endfunction The only reasonable example of using the p_sequencer handle from the documentation (?? - I have never needed to do this - hence, no need for p_sequencer). In the example, there is a need to access a local variable declared in a particular sequencer (who sets local variables in the sequencer??) class mysequence extends uvm_sequence#(mydata); `uvm_object_utils(mysequence) `uvm_declare_p_sequencer(some_seqr_type) task body; //Access some variable in the user's custom sequencer if(p_sequencer.some_variable) begin ... end endtask endclass Regards - Cliff Cummings Verilog & SystemVerilog Guru Quote Link to comment Share on other sites More sharing options...
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.