uvm_sequencer_base

class uvm.seq.uvm_sequencer_base.uvm_sequence_process_wrapper[source]

Bases: object

Utility class for tracking default_sequences

class uvm.seq.uvm_sequencer_base.UVMSequencerBase(name, parent)[source]

Bases: UVMComponent

Controls the flow of sequences, which generate the stimulus (sequence item transactions) that is passed on to drivers for execution.

g_request_id = 0
g_sequence_id = 1
g_sequencer_id = 1
is_child(parent: UVMSequenceBase, child: UVMSequenceBase)[source]

Returns 1 if the child sequence is a child of the parent sequence, 0 otherwise.

Parameters
Returns

True if sequences are parent and child.

Return type

bool

user_priority_arbitration(avail_sequences)[source]

When the sequencer arbitration mode is set to UVM_SEQ_ARB_USER (via the set_arbitration method), the sequencer will call this function each time that it needs to arbitrate among sequences.

Derived sequencers may override this method to perform a custom arbitration policy. The override must return one of the entries from the avail_sequences queue, which are indexes into an internal queue, self.arb_sequence_q.

The default implementation behaves like UVM_SEQ_ARB_FIFO, which returns the entry at avail_sequences[0].

Parameters

avail_sequences

Returns

Sequence that wins the arbitration.

Return type

UVMSequence

async execute_item(item)[source]

Executes the given transaction item directly on this sequencer. A temporary parent sequence is automatically created for the item. There is no capability to retrieve responses. If the driver returns responses, they will accumulate in the sequencer, eventually causing response overflow unless <uvm_sequence_base::set_response_queue_error_report_disabled> is called.

Parameters

item (UVMSequenceItem) – Item to be executed.

async start_phase_sequence(phase)[source]

Start the default sequence for this phase, if any. The default sequence is configured via resources using either a sequence instance or sequence type (object wrapper). If both are used, the sequence instance takes precedence. When attempting to override a previous default sequence setting, you must override both the instance and type (wrapper) resources, else your override may not take effect.

When setting the resource using set, the 1st argument specifies the context pointer, usually this for components or None when executed from outside the component hierarchy (i.e. in module). The 2nd argument is the instance string, which is a path name to the target sequencer, relative to the context pointer. The path must include the name of the phase with a “_phase” suffix. The 3rd argument is the resource name, which is “default_sequence”. The 4th argument is either an object wrapper for the sequence type, or an instance of a sequence.

Configuration by instances allows pre-initialization, setting rand_mode, use of inline constraints, etc.

myseq = myseq_t("myseq")
myseq.randomize_with(...)
UVMConfigDb.set(None, "top.agent.myseqr.main_phase",
                                        "default_sequence",
                                        myseq)

Configuration by type is shorter and can be substituted via
the factory.
UVMConfigDb.set(None, "top.agent.myseqr.main_phase",
                                         "default_sequence",
                                         myseq_type.type_id.get())

The uvm_resource_db can similarly be used.
myseq_t myseq = new("myseq")
myseq.randomize() with { ... }
UVMResourceDb.set(self.get_full_name() + ".myseqr.main_phase",
                                          "default_sequence",
                                          myseq, self)
UVMResourceDb.set(self.get_full_name() + ".myseqr.main_phase",
                                           "default_sequence",
                                           myseq_t.type_id.get(),
                                           self)
Parameters

phase (UVMPhase) – Phase in which the sequence is started.

stop_phase_sequence(phase)[source]

Stop the default sequence for this phase, if any exists, and it is still executing.

Parameters

phase (UVMPhase) – Phase which has the default sequence running.

async wait_for_grant(sequence_ptr, item_priority=-1, lock_request=0)[source]

This task issues a request for the specified sequence. If item_priority is not specified, then the current sequence priority will be used by the arbiter. If a lock_request is made, then the sequencer will issue a lock immediately before granting the sequence. (Note that the lock may be granted without the sequence being granted if is_relevant is not asserted).

When this method returns, the sequencer has granted the sequence, and the sequence must call send_request without inserting any simulation delay other than delta cycles. The driver is currently waiting for the next item to be sent via the send_request call.

Parameters
  • sequence_ptr (UVMSequence) –

  • item_priority

  • lock_request

async wait_for_item_done(sequence_ptr, transaction_id)[source]

A sequence may optionally call wait_for_item_done. This task will block until the driver calls item_done() or put() on a transaction issued by the specified sequence. If no transaction_id parameter is specified, then the call will return the next time that the driver calls item_done() or put(). If a specific transaction_id is specified, then the call will only return when the driver indicates that it has completed that specific item.

Note that if a specific transaction_id has been specified, and the driver has already issued an item_done or put for that transaction, then the call will hang waiting for that specific transaction_id.

Parameters
  • sequence_ptr

  • transaction_id

is_blocked(sequence_ptr)[source]

Function: is_blocked

Returns 1 if the sequence referred to by sequence_ptr is currently locked out of the sequencer. It will return 0 if the sequence is currently allowed to issue operations.

Note that even when a sequence is not blocked, it is possible for another sequence to issue a lock before this sequence is able to issue a request or lock.

Parameters

sequence_ptr

Returns:

stop_sequences()[source]
is_grabbed()[source]

Function: is_grabbed

Returns 1 if any sequence currently has a lock or grab on this sequencer, 0 otherwise.

extern virtual function bit is_grabbed()

Returns:

set_arbitration(val)[source]

Function: current_grabber

Returns a reference to the sequence that currently has a lock or grab on the sequence. If multiple hierarchical sequences have a lock, it returns the child that is currently allowed to perform operations on the sequencer.

extern virtual function uvm_sequence_base current_grabber()

Function: has_do_available

Returns 1 if any sequence running on this sequencer is ready to supply a transaction, 0 otherwise. A sequence is ready if it is not blocked (via grab or lock and is_relevant returns 1.

extern virtual function bit has_do_available()

Function: set_arbitration

Specifies the arbitration mode for the sequencer. It is one of

UVM_SEQ_ARB_FIFO - Requests are granted in FIFO order (default) UVM_SEQ_ARB_WEIGHTED - Requests are granted randomly by weight UVM_SEQ_ARB_RANDOM - Requests are granted randomly UVM_SEQ_ARB_STRICT_FIFO - Requests at highest priority granted in FIFO order UVM_SEQ_ARB_STRICT_RANDOM - Requests at highest priority granted in randomly UVM_SEQ_ARB_USER - Arbitration is delegated to the user-defined

function, user_priority_arbitration. That function will specify the next sequence to grant.

The default user function specifies FIFO order.

Parameters

val

get_arbitration()[source]

Function: get_arbitration

Return the current arbitration mode set for this sequencer. See set_arbitration for a list of possible modes.

extern function UVM_SEQ_ARB_TYPE get_arbitration()

Returns:

async wait_for_sequences()[source]

Waits for a sequence to have a new item available. Uses uvm_wait_for_nba_region to give a sequence as much time as possible to deliver an item before advancing time.

send_request(sequence_ptr, t, rerandomize=0)[source]

Derived classes implement this function to send a request item to the sequencer, which will forward it to the driver. If the rerandomize bit is set, the item will be randomized before being sent to the driver.

This function may only be called after a wait_for_grant call.

Parameters
set_max_zero_time_wait_relevant_count(new_val)[source]

Can be called at any time to change the maximum number of times wait_for_relevant() can be called by the sequencer in zero time before an error is declared. The default maximum is 10.

Parameters

new_val (int) –

grant_queued_locks()[source]

Any lock or grab requests that are at the front of the queue will be granted at the earliest possible time. This function grants any queues at the front that are not locked out

Returns:

async m_select_sequence()[source]

extern protected task m_select_sequence()

m_choose_next_request() int[source]

When a driver requests an operation, this function must find the next available, unlocked, relevant sequence.

This function returns -1 if no sequences are available or the entry into self.arb_sequence_q for the chosen sequence

Returns:

async m_wait_for_arbitration_completed(request_id)[source]

extern task m_wait_for_arbitration_completed(int request_id)

Parameters

request_id

m_set_arbitration_completed(request_id)[source]

extern function void m_set_arbitration_completed(int request_id)

Parameters

request_id

remove_sequence_from_queues(sequence_ptr)[source]

extern local function void remove_sequence_from_queues(uvm_sequence_base sequence_ptr)

Parameters

sequence_ptr

m_sequence_exiting(sequence_ptr)[source]

extern function void m_sequence_exiting(uvm_sequence_base sequence_ptr)

Parameters

sequence_ptr

kill_sequence(sequence_ptr: UVMSequenceBase)[source]
analysis_write(t)[source]

extern virtual function void analysis_write(uvm_sequence_item t)

Parameters

t

build_phase(phase)[source]

extern virtual function void build_phase(uvm_phase phase)

Parameters

phase

build()[source]

extern virtual function void build()

m_register_sequence(sequence_ptr)[source]
Parameters

sequence_ptr (UVMSequencerBase) –

Returns

Sequence ID

Return type

int

m_unregister_sequence(sequence_id)[source]

virtual function void m_unregister_sequence(int sequence_id)

Parameters

sequence_id (int) – Unregister sequence with the given ID.

m_find_sequence(sequence_id)[source]

function uvm_sequence_base m_find_sequence(int sequence_id)

Parameters

sequence_id (int) – Sought sequence ID.

Returns

A sequence matching the given ID.

Return type

UVMSequencerBase

m_update_lists()[source]

extern protected function void self.m_update_lists()

set_value(key, value)[source]
async m_wait_arb_not_equal()[source]
async m_wait_for_available_sequence()[source]
is_auto_item_recording_enabled()[source]
m_children: Dict[str, 'UVMComponent']
m_children_by_handle: Dict['UVMComponent', 'UVMComponent']
m_children_ordered: List['UVMComponent']
event_pool: UVMEventPool
class uvm.seq.uvm_sequencer_base.uvm_sequence_request[source]

Bases: object