Virtual sequence and sequencer
Virtual sequence and sequencer
&
Virtual Sequencer
(SOC or Subsystem level)
-Naveen kumar
Email : [email protected]
What is virtual sequence & sequencer ?
• Virtual sequence is nothing but a container that start multiple sequence on
diffrent sequencer.
• Virtual sequencer control the other sequencer and not attached to any driver.
• A virtual sequence gives control to start of different sequences.
• A virtual sequence usually execute on virtual sequencer.
• Use virtual sequencer if have multiple agent and stimulus coordination is
required.
• Need for virtual sequence arises when you require different sequences to run
on different environment.
SOC design might have multiple different interfaces that might need to
different set of sequence on indivitual sequencer.
Tb
Test
multi_seq virtual_sequence
Env
Scoreboard virtual sequencer
DUT
-Naveen kumar
Different between M_sequencer & P_sequencer
M_sequencer P_sequencer
• M_sequencer is a handle avaliable by • All sequence have a m_sequencer handle
default in a sequence and m_sequencer but they do not have p_sequencer
type of uvm_sequencer_base. handle.
• Reference handle to the sequencer on • P_sequencer is not defined
which the sequence is running. automatically. It’s defined using macro
`uvm_declare_p_sequencer(v_seqr).
• To run sequence on the sequencer, the • P_sequencer handle of sequencer type &
start() method is called. cast m_seqr handle to p_seqr.
• Start method need to provide sequencer • Virtual sequencer generally refered to as
handle. p_seqr.
-Naveen kumar
Example code :
//APB sequence code
class apb_seq extends uvm_sequence#(apb_seq_item);
`uvm_object_utils(apb_seq)
apb_seq_item seq_item1;
function new(string name =”apb_seq”);
super.new(name);
endfucntion
task body();
//create sequence item
seq_item1=apb_seq_item::type_id::create(“seq_item1”);
`uvm_do(seq_item1);
endtask
endclass -Naveen kumar
//AHB sequence
class ahb_seq extends uvm_sequence#(ahb_seq_item);
`uvm_object_utils(ahb_seq)
ahb_seq_item seq_item2;
function new(string name =”apb_seq”);
super.new(name);
endfucntion
task body();
//create sequence item
seq_item2=ahb_seq_item::type_id::create(“seq_item2”);
`uvm_do(seq_item2);
endtask
endclass
-Naveen kumar
//AXI sequence code
class apb_seq extends uvm_sequence#(apb_seq_item); //APB
`uvm_object_utils(apb_seq)
apb_seq_item seq_item1;
function new(string name =”apb_seq”);
super.new(name);
endfucntion
task body();
//create sequence item
seq_item1=apb_seq_item::type_id::create(“seq_item1”);
`uvm_do(seq_item1);
endtask
endclass
-Naveen kumar
//APB sequencer
class apb_seqr extends uvm_sequence#(apb_seq_item);
`uvm_component_utils(apb_seqr)
function new(string name =”apb_seqr”, uvm_component parent = null);
super.new(name,parent);
endfucntion
endclass
-------------------------------------------------------
//AHB sequencer
class ahb_seqr extends uvm_sequence#(ahb_seq_item);
`uvm_component_utils(ahb_seqr)
function new(string name =”ahb_seqr”, uvm_component parent = null);
super.new(name,parent);
endfucntion
endclass
-Naveen kumar
//AXI sequencer
class axi_seqr extends uvm_sequence#(axi_seq_item);
`uvm_component_utils(axi_seqr)
function new(string name =”axi_seqr”, uvm_component parent =
null);
super.new(name,parent);
endfucntion
endclass
-Naveen kumar
//Virtual sequencer
class virtual_sequencer extends uvm_sequence;
`uvm_component_utils(virtual_sequencer)
function new(string name =”axi_seqr”, uvm_component parent = null);
super.new(name,parent);
endfucntion
apb_seqr m_apb_seqr;
ahb_seqr m_ahb_seqr;
axi_seqr m_axi_seqr;
endclass
//Virtual sequence
class virtual_sequence extends uvm_sequence;
//virtual sequence
apb_seq seq1;
ahb_seq seq2;
axi_seq seq2;
//Virtual sequencer handle
m_apb_seqr seqr1;
m_ahb_seqr seqr2;
m_axi_seqr seqr3;
`uvm_component_utils(virtual_sequence)
`uvm_declare_p_sequencer(virtual_sequencer) // communication with virtual Sequence to virtual sequencer.(p seqr only supported in to inside the vseq module)
function new(string name =”virtual_sequence”, uvm_component parent = null);
super.new(name,parent);
endfucntion
-Naveen kumar
task body();
seq1=apb_seq::type_id::create(“seq1”);
seq2=ahb_seq::type_id::create(“seq2”);
seq3=axi_seq::type_id::create(“seq3”);
seq1.start(p_sequencer.seqr1);
seq2.start(p_sequencer.seqr2);
seq3.start(p_sequencer.seqr3);
endtask
endclass
-Naveen kumar