Sequence and Do Action

Title: Sequence-Related Functions

Group: Sequence Action Functions

NOTE: Each macro defines seq_obj argument, which is self argument within the sequence member functions. seq_obj is not present in SystemVerilog UVM since the context comes from where the macro is used.

These functions are used to start sequences and sequence items on the default sequencer, m_sequencer. This is determined a number of ways. - the sequencer handle provided in the UVMSequenceBase.start method - the sequencer used by the parent sequence - the sequencer that was set using the UVMSequenceItem::set_sequencer method

uvm.macros.uvm_sequence_defines.uvm_create(seq_obj, SEQ_OR_ITEM, m_sequencer)[source]

This action creates the item or sequence using the factory. It intentionally does zero processing. After this action completes, the user can manually set values, manipulate rand_mode and constraint_mode, etc.

Parameters

seq_obj (UVMSequence) – Sequence from which the function is called

async uvm.macros.uvm_sequence_defines.uvm_do(seq_obj, SEQ_OR_ITEM)[source]

This macro takes as an argument a uvm_sequence_item variable or object. The argument is created using uvm_create if necessary, then randomized. In the case of an item, it is randomized after the call to UVMSequenceBase.start_item() returns. This is called late-randomization. In the case of a sequence, the sub-sequence is started using UVMSequenceBase.start_item() with call_pre_post set to 0. In the case of an item, the item is sent to the driver through the associated sequencer.

For a sequence item, the following are called, in order:

uvm_create(item)
sequencer.wait_for_grant(prior) (task)
this.pre_do(1)                  (task)
item.randomize()
this.mid_do(item)               (func)
sequencer.send_request(item)    (func)
sequencer.wait_for_item_done()  (task)
this.post_do(item)              (func)

For a sequence, the following are called, in order:

uvm_create(sub_seq)
sub_seq.randomize()
sub_seq.pre_start()         (task)
this.pre_do(0)              (task)
this.mid_do(sub_seq)        (func)
await sub_seq.body()              (task)
this.post_do(sub_seq)       (func)
sub_seq.post_start()        (task)
async uvm.macros.uvm_sequence_defines.uvm_do_with(seq_obj, SEQ_OR_ITEM, *CONSTRAINTS)[source]

This is the same as `uvm_do except that the constraint block in the 2nd argument is applied to the item or sequence in a randomize with statement before execution.

async uvm.macros.uvm_sequence_defines.uvm_do_pri_with(seq_obj, SEQ_OR_ITEM, PRIORITY, *CONSTRAINTS)[source]

This is the same as `uvm_do_pri except that the given constraint block is applied to the item or sequence in a randomize with statement before execution.

uvm.macros.uvm_sequence_defines.uvm_create_on(seq_obj, SEQ_OR_ITEM, SEQR)[source]

This is the same as <`uvm_create> except that it also sets the parent sequence to the sequence in which the macro is invoked, and it sets the sequencer to the specified ~SEQR~ argument.

async uvm.macros.uvm_sequence_defines.uvm_do_on(seq_obj, SEQ_OR_ITEM, SEQR)[source]

This is the same as <`uvm_do> except that it also sets the parent sequence to the sequence in which the macro is invoked, and it sets the sequencer to the specified ~SEQR~ argument.

async uvm.macros.uvm_sequence_defines.uvm_do_on_with(seq_obj, SEQ_OR_ITEM, SEQR, *CONSTRAINTS)[source]

This is the same as uvm_do_with except that it also sets the parent sequence to the sequence in which the macro is invoked, and it sets the sequencer to the specified ~SEQR~ argument. The user must supply the constraints using lambdas.

An example call:

await uvm_do_on_with(self, sys0_seq, None,
    lambda num_blk_seq: num_blk_seq == 10,
    lambda blk_level_delay_ns: blk_level_delay_ns in [10, 20],
)

Note that variables used in lambdas must exist, or an exception is thrown due to randomization error.

async uvm.macros.uvm_sequence_defines.uvm_do_on_pri_with(seq_obj, SEQ_OR_ITEM, SEQR, PRIORITY, *CONSTRAINTS)[source]

This is the same as uvm_do_pri_with except that it also sets the parent sequence to the sequence in which the function is invoked, and it sets the sequencer to the specified ~SEQR~ argument.

Parameters
async uvm.macros.uvm_sequence_defines.uvm_send(seq_obj, SEQ_OR_ITEM)[source]

This function processes the item or sequence that has been created using uvm_create. The processing is done without randomization. Essentially, an uvm_do without the create or randomization.

Parameters
async uvm.macros.uvm_sequence_defines.uvm_send_pri(seq_obj, SEQ_OR_ITEM, PRIORITY)[source]

This is the same as uvm_send except that the sequence item or sequence is executed with the priority specified in the argument.

Parameters