m_sequencer is default sequencer and p_sequncer is typecast to m_sequencer in other words
m_sequencer is a handle of type uvm_sequencer_base which is available by default in a sequence.
p_sequencer :The real sequencer on which a sequence is running would normally be derived from the uvm_sequencer_base class.Hence to access the real sequencer on which sequence is running , you would need to typecast the m_sequencer to the physical sequencer which is generally called p_sequencer
Lets see by example : A sequence wants to access a component (clock monitor)which is available with its sequencer.
class test_sequencer_c extends uvm_sequencer;
clock_monitor_c clk_monitor;
endclass
class test_sequence_c extends uvm_sequence
test_sequencer_c p_sequencer
clock_monitor_c my_clock_monitor
task pre_body();
//Typecast the m_sequencer base type to p_sequencer
if(!$cast(p_sequencer, m_sequencer)) begin
`uvm_fatal(“Sequencer Type Mismatch:”, ” Wrong Sequencer”)
en
//get access to clock monitor
my_clock_monitor = p_sequencer.clk_monitor;
endtas
endclass
use of m_sequencer
accessing cfg file
class seq_plb_base extends uvm_sequence #(plb_transaction);
`uvm_object_utils(seq_plb_base);
const string report_id=”SEQ”;
plb_agent_configuration cfg;
function new(string name=””);
super.new(name);
endfunction
virtual task body();
if( !uvm_config_db #( plb_agent_configuration )::get( m_sequencer, “”, “AGENT_CONFIG”, cfg ))
`uvm_fatal(report_id, “cannot find resource AGENT_CONFIG” )
// .. do stuff
endtask
endclass