Sei sulla pagina 1di 35

UVM Virtual Sequence

By
Siva Nagendra Reddy
•my_virtual_seq is derived from uvm_sequence just like any other
sequence
•A handle called p_sequencer is created within the sequence via
macro `uvm_declare_p_sequencer and assigned to be run
with my_virtual_sequencer
•Each sequence is started on its corresponding sequencer using
the start() method
•Each sequencer is referenced by p_sequencer handle which points to the
virtual sequencer
UVM Virtual Sequencer
Virtual Sequence Implementation:

• In UVM, Virtual Sequence can be implemented using 2 approaches.


• In the 1st approach, Virtual Sequence will contain itself the handles
of the Agent’s Sequencers on which the Sub-Sequences are to be
executed.
• In the 2nd approach, Virtual Sequence will run on a Virtual
Sequencer which is of type uvm_sequencer. In this approach, Virtual
Sequencer will contain the target Agent Sequencer’s handle.
Virtual Sequence Implementation

• Fundamental thing to understand in 1st approach is that the Agent’s


target Sequencer handle are contained by the Virtual Sequence itself.
• Apart from this, there are following points to focus upon in terms of
Virtual Sequence implementation:
• Virtual Sequence declaration which includes target Sequencers
handles
• The way a Virtual Sequence starts the Sub-Seqs on target Sequencers
• The way a Virtual Sequence is started from a Test class
• As shown in the diagram above, Virtual Sequence contains two
Sequencer handles i.e. SQR_AHB & SQR_AXI.
• There are 2 Agents i.e. AHB Agent & AXI Agent which physically
contains 2 Sequencers.
• These 2 Sequencers are assigned to the Sequencer handles inside
Virtual Sequence in a Test.
• As per the shown diagram above, Virtual Sequence also creates two
Sequences which are to be run on the Sequencers of the respective
Agents
• In the UVM code above, we got two classes i.e.
& my_vseq class. base_vseq is the base virtual sequence class and
my_vseq is the intended Virtual Sequence. Base virtual sequence
contains the handle of the two taret Sequencers
i.e. SQR_AHB & SQR_AXI.
• Virtual Sequence class is extended from the Base Virtual
Sequence class. It creates the two Sub-Sequences
i.e. ahb_seq & axi_seq using the Factory mechanism. Later inside the
body() task the Sub-Sequences are started on the target Agent’s
Sequencer by the Virtual Sequence.
• In the test base class i.e. base_test, shown UVM code above,
a method i.e. init_vseq() is created which is used to assign
the sequencer handles to the handles in classes derived from
the virtual sequence base class
• Inside the main test which is derived from the base test, Virtual
Sequence is created using Factory. Later, the initialization method
i.e. init_vseq() is being called to connect the Sequencers handle.
Finally Virtual Sequence is started using “Null” since this Virtual
Sequence is NOT started on any particular Sequencer.
Virtual Sequence Implementation (2nd approach):

• Virtual Sequencer is a Sequencer that is not connected to the UVM


Driver itself, but contains the handles of the target Sequencer in the
Testbench hierarchy.
• As shown in the above diagram, Virtual Sequencer is the part of the
Environment i.e. “Env”. Virtual Sequencer contains the handles of the
target Sequencers i.e. & which are physically located inside the Agents
i.e. AHB Agent & AXI Agent respectively. These target Sequencers
handles assignment will be done during connect phase of the
Environment class.
• Virtual Sequence is located outside the Environment class & it is
created in the run_phase() method of the Test. The Virtual Sequence
is designed to run on the Virtual Sequencer & Virtual Sequence also
gets the handles of the target Sequencers from the Virtual Sequencer.
• Virtual Sequencer i.e. “virtual_seqr” class is declared by extended
the UVM base class uvm_sequencer. Target Sequencer handles are
also declared inside it.
• Now lets see the implementation of the Virtual Sequence. First a Base
Virtual Sequence will be declared & later Virtual Sequence will be
derived from the base virtual sequence.
• In the above Environment class i.e. “Environ”, Virtual Sequencer is
instantiated & built along with two Agents
i.e. “AHB_AGNT” & “AXI_AGNT”.
• Target Sequencer handles are also assigned in the connect_phase().
Usage of a flexible & handy feature of UVM i.e. “m_sequencer” is
being shown which by default points to the UVM Sequencer derived
from the uvm_sequencer.
• In the Test class i.e. “Test”, both Environment & Virtual Sequence
i.e. “Environ” & “my_vseq” are instantiated and created.
Finally Virtual Sequence is started on the Virtual Sequencer which
exists inside the Environment.

Potrebbero piacerti anche