uvm_sequencer_base

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

Summary
uvm_sequencer_base
Controls the flow of sequences, which generate the stimulus (sequence item transactions) that is passed on to drivers for execution.
Class Hierarchy
Class Declaration
class uvm_sequencer_base extends uvm_component
Methods
newCreates and initializes an instance of this class using the normal constructor arguments for uvm_component: name is the name of the instance, and parent is the handle to the hierarchical parent.
is_childReturns 1 if the child sequence is a child of the parent sequence, 0 otherwise.
user_priority_arbitrationWhen the sequencer arbitration mode is set to SEQ_ARB_USER (via the set_arbitration method), the sequencer will call this function each time that it needs to arbitrate among sequences.
execute_itemThis task allows the user to supply an item or sequence to the sequencer and have it be executed procedurally.
start_phase_sequenceStart the default sequence for this phase, if any.
wait_for_grantThis task issues a request for the specified sequence.
wait_for_item_doneA sequence may optionally call wait_for_item_done.
is_blockedReturns 1 if the sequence referred to by sequence_ptr is currently locked out of the sequencer.
has_lockReturns 1 if the sequence refered to in the parameter currently has a lock on this sequencer, 0 otherwise.
lockRequests a lock for the sequence specified by sequence_ptr.
grabRequests a lock for the sequence specified by sequence_ptr.
unlockRemoves any locks and grabs obtained by the specified sequence_ptr.
ungrabRemoves any locks and grabs obtained by the specified sequence_ptr.
stop_sequencesTells the sequencer to kill all sequences and child sequences currently operating on the sequencer, and remove all requests, locks and responses that are currently queued.
is_grabbedReturns 1 if any sequence currently has a lock or grab on this sequencer, 0 otherwise.
current_grabberReturns a reference to the sequence that currently has a lock or grab on the sequence.
has_do_availableReturns 1 if any sequence running on this sequencer is ready to supply a transaction, 0 otherwise.
set_arbitrationSpecifies the arbitration mode for the sequencer.
get_arbitrationReturn the current arbitration mode set for this sequencer.
wait_for_sequencesWaits for a sequence to have a new item available.
send_requestDerived classes implement this function to send a request item to the sequencer, which will forward it to the driver.

new

function new ( string  name,
uvm_component  parent )

Creates and initializes an instance of this class using the normal constructor arguments for uvm_component: name is the name of the instance, and parent is the handle to the hierarchical parent.

is_child

function bit is_child ( uvm_sequence_base  parent,
uvm_sequence_base  child )

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

user_priority_arbitration

virtual function integer user_priority_arbitration( integer  avail_sequences[$] )

When the sequencer arbitration mode is set to 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, arb_sequence_q.  The

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

execute_item

virtual task execute_item( uvm_sequence_item  item )

This task allows the user to supply an item or sequence to the sequencer and have it be executed procedurally.  The parent sequence for the item or sequence is a temporary sequence that is automatically created.  There is no capability to retrieve responses.  The sequencer will drop responses to items done using this interface.

start_phase_sequence

virtual function void start_phase_sequence( uvm_phase  phase )

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) reources, 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 “null” 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_t myseq = new("myseq");
myseq.randomize() with { ... };
uvm_config_db #(uvm_sequence_base)::set(null, "top.agent.myseqr.main_phase",
                                        "default_sequence",
                                        myseq);

Configuration by type is shorter and can be substituted via the the factory.

uvm_config_db #(uvm_object_wrapper)::set(null, "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 { ... };
uvm_resource_db #(uvm_sequence_base)::set({get_full_name(), ".myseqr.main_phase",
                                          "default_sequence",
                                          myseq, this);
uvm_resource_db #(uvm_object_wrapper)::set({get_full_name(), ".myseqr.main_phase",
                                           "default_sequence",
                                           myseq_t::type_id::get(),
                                           this );

wait_for_grant

virtual task wait_for_grant( uvm_sequence_base  sequence_ptr,   
int  item_priority  =  -1,
bit  lock_request  =  0 )

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.

wait_for_item_done

virtual task wait_for_item_done( uvm_sequence_base  sequence_ptr,
int  transaction_id )

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.

is_blocked

function bit is_blocked( uvm_sequence_base  sequence_ptr )

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.

has_lock

function bit has_lock( uvm_sequence_base  sequence_ptr )

Returns 1 if the sequence refered to in the parameter currently has a lock on this sequencer, 0 otherwise.

Note that even if this sequence has a lock, a child sequence may also have a lock, in which case the sequence is still blocked from issueing operations on the sequencer

lock

virtual task lock( uvm_sequence_base  sequence_ptr )

Requests a lock for the sequence specified by sequence_ptr.

A lock request will be arbitrated the same as any other request.  A lock is granted after all earlier requests are completed and no other locks or grabs are blocking this sequence.

The lock call will return when the lock has been granted.

grab

virtual task grab( uvm_sequence_base  sequence_ptr )

Requests a lock for the sequence specified by sequence_ptr.

A grab request is put in front of the arbitration queue.  It will be arbitrated before any other requests.  A grab is granted when no other grabs or locks are blocking this sequence.

The grab call will return when the grab has been granted.

unlock

virtual function void unlock( uvm_sequence_base  sequence_ptr )

Removes any locks and grabs obtained by the specified sequence_ptr.

ungrab

virtual function void ungrab( uvm_sequence_base  sequence_ptr )

Removes any locks and grabs obtained by the specified sequence_ptr.

stop_sequences

virtual function void stop_sequences()

Tells the sequencer to kill all sequences and child sequences currently operating on the sequencer, and remove all requests, locks and responses that are currently queued.  This essentially resets the sequencer to an idle state.

is_grabbed

virtual function bit is_grabbed()

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

current_grabber

virtual function uvm_sequence_base 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.

has_do_available

virtual function bit 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.

set_arbitration

function void set_arbitration( SEQ_ARB_TYPE  val )

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

SEQ_ARB_FIFORequests are granted in FIFO order (default)
SEQ_ARB_WEIGHTEDRequests are granted randomly by weight
SEQ_ARB_RANDOMRequests are granted randomly
SEQ_ARB_STRICT_FIFORequests at highest priority granted in fifo order
SEQ_ARB_STRICT_RANDOMRequests at highest priority granted in randomly
SEQ_ARB_USERArbitration 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.

get_arbitration

function SEQ_ARB_TYPE get_arbitration()

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

wait_for_sequences

virtual task wait_for_sequences()

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

virtual function void send_request( uvm_sequence_base  sequence_ptr,   
uvm_sequence_item  t,   
bit  rerandomize  =  0 )

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.

The uvm_void class is the base class for all UVM classes.
virtual class uvm_object extends uvm_void
The uvm_object class is the base class for all UVM data and hierarchical classes.
class uvm_report_object extends uvm_object
The uvm_report_object provides an interface to the UVM reporting facility.
virtual class uvm_component extends uvm_report_object
The uvm_component class is the root base class for UVM components.
class uvm_sequencer_base extends uvm_component
Controls the flow of sequences, which generate the stimulus (sequence item transactions) that is passed on to drivers for execution.
function new ( string  name,
uvm_component  parent )
Creates and initializes an instance of this class using the normal constructor arguments for uvm_component: name is the name of the instance, and parent is the handle to the hierarchical parent.
function bit is_child ( uvm_sequence_base  parent,
uvm_sequence_base  child )
Returns 1 if the child sequence is a child of the parent sequence, 0 otherwise.
virtual function integer user_priority_arbitration( integer  avail_sequences[$] )
When the sequencer arbitration mode is set to SEQ_ARB_USER (via the set_arbitration method), the sequencer will call this function each time that it needs to arbitrate among sequences.
function void set_arbitration( SEQ_ARB_TYPE  val )
Specifies the arbitration mode for the sequencer.
virtual task execute_item( uvm_sequence_item  item )
This task allows the user to supply an item or sequence to the sequencer and have it be executed procedurally.
virtual function void start_phase_sequence( uvm_phase  phase )
Start the default sequence for this phase, if any.
virtual task wait_for_grant( uvm_sequence_base  sequence_ptr,   
int  item_priority  =  -1,
bit  lock_request  =  0 )
This task issues a request for the specified sequence.
virtual task wait_for_item_done( uvm_sequence_base  sequence_ptr,
int  transaction_id )
A sequence may optionally call wait_for_item_done.
function bit is_blocked( uvm_sequence_base  sequence_ptr )
Returns 1 if the sequence referred to by sequence_ptr is currently locked out of the sequencer.
function bit has_lock( uvm_sequence_base  sequence_ptr )
Returns 1 if the sequence refered to in the parameter currently has a lock on this sequencer, 0 otherwise.
virtual task lock( uvm_sequence_base  sequence_ptr )
Requests a lock for the sequence specified by sequence_ptr.
virtual task grab( uvm_sequence_base  sequence_ptr )
Requests a lock for the sequence specified by sequence_ptr.
virtual function void unlock( uvm_sequence_base  sequence_ptr )
Removes any locks and grabs obtained by the specified sequence_ptr.
virtual function void ungrab( uvm_sequence_base  sequence_ptr )
Removes any locks and grabs obtained by the specified sequence_ptr.
virtual function void stop_sequences()
Tells the sequencer to kill all sequences and child sequences currently operating on the sequencer, and remove all requests, locks and responses that are currently queued.
virtual function bit is_grabbed()
Returns 1 if any sequence currently has a lock or grab on this sequencer, 0 otherwise.
virtual function uvm_sequence_base current_grabber()
Returns a reference to the sequence that currently has a lock or grab on the sequence.
virtual function bit has_do_available()
Returns 1 if any sequence running on this sequencer is ready to supply a transaction, 0 otherwise.
function SEQ_ARB_TYPE get_arbitration()
Return the current arbitration mode set for this sequencer.
virtual task wait_for_sequences()
Waits for a sequence to have a new item available.
virtual function void send_request( uvm_sequence_base  sequence_ptr,   
uvm_sequence_item  t,   
bit  rerandomize  =  0 )
Derived classes implement this function to send a request item to the sequencer, which will forward it to the driver.
task uvm_wait_for_nba_region
Callers of this task will not return until the NBA region, thus allowing other processes any number of delta cycles (#0) to settle out before continuing.