cliffc Posted October 26, 2011 Report Share Posted October 26, 2011 I have read in some of the threads that m_sequencer is for internal use and should not be placed in user code while p_sequencer should be used, yet I have had better luck with m_sequencer in a virtual sequence base. In fact, the UVM 1.1 Class Reference Manaual lists 10 different m_variables in the index (m_sequencer is not one of them) while there are no p_variables listed. Consider this example: class vseq_base extends ovm_sequence; `ovm_object_utils(vseq_base) function new(string name="vseq_base"); super.new(name); endfunction // Declare a virtual sequencer handle and // Declare handles of the AHB and ethernet sequencer types vsequencer v_sqr; tb_ahb_sequencer ahb_sqr; tb_eth_sequencer eth_sqr; virtual task body(); // if(!$cast( v_sqr, p_sequencer)) // ERROR - Failed to find 'p_sequencer' in hierarchical name p_sequencer. if(!$cast( v_sqr, m_sequencer)) `ovm_fatal("vseq_base","BAD v_sqr type");; ahb_sqr = v_sqr.ahb_sqr; eth_sqr = v_sqr.eth_sqr; endtask endclass My notes on this example - vseq_base.sv Technically not required, but a virtual sequence base significantly simplifies the task of creating multiple virtual sequences - in the absence of a vseq_base, all of the virtual sequences would have to perform the following steps: (1) Uses the UVM built-in m_sequencer handle. m_sequencer is a pre-defined handle inside of every sequence and is a handle to the sequencer that is running this sequence. The sequence references this handle to call the sequencer that is running this sequence. "this" is a handle to this sequence while "m_sequencer" is a handle to the sequencer that is running this sequence. (2) Declares a handle to the virtual sequencer, v_sqr, but does not have the actual handle to the virtual sequencer. (3) Uses casting to cast the m_sequencer handle (described in step (1)) to the v_sqr handle - now vseq_base has a copy of the actual handle to the virtual sequencer. (4) Also declares sequencer handles (tb_ahb_sequencer & tb_eth_sequencer) that will be controlled by the virtual sequencer. (5) Passes copies of the real sequencer handles from the virtual sequencer to the handles declared in step (4). When I tried doing the same thing with p_sequencer, I saw the error: ERROR - Failed to find 'p_sequencer' in hierarchical name p_sequencer. m_sequencer seems to be a very convenient way to reference "the sequencer that is running this sequence." Am I missing something? Regards - Cliff Cummings Verilog & SystemVerilog Guru Sunburst Design 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.