ovm_sequence_base

The ovm_sequence_base class provides the interfaces needed to create streams of sequence items and/or other sequences.

Summary
ovm_sequence_base
The ovm_sequence_base class provides the interfaces needed to create streams of sequence items and/or other sequences.
Class Hierarchy
Class Declaration
class ovm_sequence_base extends ovm_sequence_item
Variables
seq_kindUsed as an identifier in constraints for a specific sequence type.
Methods
newThe constructor for ovm_sequence_base.
get_sequence_stateReturns the sequence state as an enumerated value.
wait_for_sequence_stateWaits until the sequence reaches the given state.
startThe start task is called to begin execution of a sequence
pre_bodyThis task is a user-definable callback task that is called before the execution of the body, unless the sequence is started with call_pre_post=0.
post_bodyThis task is a user-definable callback task that is called after the execution of the body, unless the sequence is started with call_pre_post=0.
pre_doThis task is a user-definable callback task that is called after the sequence has issued a wait_for_grant() call and after the sequencer has selected this sequence, and before the item is randomized.
bodyThis is the user-defined task where the main sequence code resides.
is_itemThis function may be called on any sequence_item or sequence object.
mid_doThis function is a user-definable callback function that is called after the sequence item has been randomized, and just before the item is sent to the driver.
post_doThis function is a user-definable callback function that is called after the driver has indicated that it has completed the item, using either this item_done or put methods.
num_sequencesReturns the number of sequences in the sequencer’s sequence library.
get_seq_kindThis function returns an int representing the sequence kind that has been registerd with the sequencer.
get_sequenceThis function returns a reference to a sequence specified by req_kind, which can be obtained using the get_seq_kind method.
get_sequence_by_nameInternal method.
do_sequence_kindThis task will start a sequence of kind specified by req_kind, which can be obtained using the get_seq_kind method.
set_priorityThe priority of a sequence may be changed at any point in time.
get_priorityThis function returns the current priority of the sequence.
wait_for_relevantThis method is called by the sequencer when all available sequences are not relevant.
is_relevantThe default is_relevant implementation returns 1, indicating that the sequence is always relevant.
is_blockedReturns a bit indicating whether this sequence is currently prevented from running due to another lock or grab.
has_lockReturns 1 if this sequence has a lock, 0 otherwise.
lockRequests a lock on the specified sequencer.
grabRequests a lock on the specified sequencer.
unlockRemoves any locks or grabs obtained by this sequence on the specified sequencer.
ungrabRemoves any locks or grabs obtained by this sequence on the specified sequencer.
set_response_queue_error_report_disabledBy default, if the response_queue overflows, an error is reported.
get_response_queue_error_report_disabledWhen this bit is 0 (default value), error reports are generated when the response queue overflows.
set_response_queue_depthThe default maximum depth of the response queue is 8.
get_response_queue_depthReturns the current depth setting for the response queue.
clear_response_queueEmpties the response queue for this sequence.
wait_for_grantThis task issues a request to the current sequencer.
send_requestThe send_request function may only be called after a wait_for_grant call.
wait_for_item_doneA sequence may optionally call wait_for_item_done.
set_sequencerSets the default sequencer for the sequence to run on.
get_sequencerReturns a reference to the current default sequencer of the sequence.
killThis function will kill the sequence, and cause all current locks and requests in the sequence’s default sequencer to be removed.
use_response_handlerWhen called with enable set to 1, responses will be sent to the response handler.
get_use_response_handlerReturns the state of the use_response_handler bit.
response_handlerWhen the use_reponse_handler bit is set to 1, this virtual task is called by the sequencer for each response that arrives for this sequence.
create_itemCreate_item will create and initialize a sequence_item or sequence using the factory.
start_itemstart_item and finish_item together will initiate operation of either a sequence_item or sequence object.
finish_itemfinish_item, together with start_item together will initiate operation of either a sequence_item or sequence object.

seq_kind

rand int unsigned seq_kind

Used as an identifier in constraints for a specific sequence type.

new

function new (string name =  "ovm_sequence",
ovm_sequencer_base sequencer_ptr =  null,
ovm_sequence_base parent_seq =  null)

The constructor for ovm_sequence_base.

The sequencer_ptr and parent_seq arguments are deprecated in favor of their being set in the start method.

get_sequence_state

function ovm_sequence_state_enum get_sequence_state()

Returns the sequence state as an enumerated value.  Can use to wait on the sequence reaching or changing from one or more states.

wait(get_sequence_state() & (STOPPED|FINISHED));

wait_for_sequence_state

task wait_for_sequence_state(ovm_sequence_state_enum state)

Waits until the sequence reaches the given state.  If the sequence is already in this state, this method returns immediately.  Convenience for wait ( get_sequence_state == state );

start

virtual task start (ovm_sequencer_base sequencer,  
ovm_sequence_base parent_sequence =  null,
integer this_priority =  100,
bit call_pre_post =  1)

The start task is called to begin execution of a sequence

If parent_sequence is null, then the sequence is a parent, otherwise it is a child of the specified parent.

By default, the priority of a sequence is 100.  A different priority may be specified by this_priority.  Higher numbers indicate higher priority.

If call_pre_post is set to 1, then the pre_body and post_body tasks will be called before and after the sequence body is called.

pre_body

virtual task pre_body()

This task is a user-definable callback task that is called before the execution of the body, unless the sequence is started with call_pre_post=0.  This method should not be called directly by the user.

post_body

virtual task post_body()

This task is a user-definable callback task that is called after the execution of the body, unless the sequence is started with call_pre_post=0.  This method should not be called directly by the user.

pre_do

virtual task pre_do(bit is_item)

This task is a user-definable callback task that is called after the sequence has issued a wait_for_grant() call and after the sequencer has selected this sequence, and before the item is randomized.  This method should not be called directly by the user.

Although pre_do is a task, consuming simulation cycles may result in unexpected behavior on the driver.

body

virtual task body()

This is the user-defined task where the main sequence code resides.  This method should not be called directly by the user.

is_item

virtual function bit is_item()

This function may be called on any sequence_item or sequence object.  It will return 1 on items and 0 on sequences.

mid_do

virtual function void mid_do(ovm_sequence_item this_item)

This function is a user-definable callback function that is called after the sequence item has been randomized, and just before the item is sent to the driver.  This mehod should not be called directly by the user.

post_do

virtual function void post_do(ovm_sequence_item this_item)

This function is a user-definable callback function that is called after the driver has indicated that it has completed the item, using either this item_done or put methods.  This method should not be called directly by the user.

num_sequences

function int num_sequences()

Returns the number of sequences in the sequencer’s sequence library.

get_seq_kind

function int get_seq_kind(string type_name)

This function returns an int representing the sequence kind that has been registerd with the sequencer.  The seq_kind int may be used with the get_sequence or do_sequence_kind methods.

get_sequence

function ovm_sequence_base get_sequence(int unsigned req_kind)

This function returns a reference to a sequence specified by req_kind, which can be obtained using the get_seq_kind method.

get_sequence_by_name

function ovm_sequence_base get_sequence_by_name(string seq_name)

Internal method.

do_sequence_kind

task do_sequence_kind(int unsigned req_kind)

This task will start a sequence of kind specified by req_kind, which can be obtained using the get_seq_kind method.

set_priority

function void set_priority (int value)

The priority of a sequence may be changed at any point in time.  When the priority of a sequence is changed, the new priority will be used by the sequencer the next time that it arbitrates between sequences.

The default priority value for a sequence is 100.  Higher values result in higher priorities.

get_priority

function int get_priority()

This function returns the current priority of the sequence.

wait_for_relevant

virtual task wait_for_relevant()

This method is called by the sequencer when all available sequences are not relevant.  When wait_for_relevant returns the sequencer attempt to re-arbitrate.

Returning from this call does not guarantee a sequence is relevant, although that would be the ideal.  The method provide some delay to prevent an infinite loop.

If a sequence defines is_relevant so that it is not always relevant (by default, a sequence is always relevant), then the sequence must also supply a wait_for_relevant method.

is_relevant

virtual function bit is_relevant()

The default is_relevant implementation returns 1, indicating that the sequence is always relevant.

Users may choose to override with their own virtual function to indicate to the sequencer that the sequence is not currently relevant after a request has been made.

When the sequencer arbitrates, it will call is_relevant on each requesting, unblocked sequence to see if it is relevant.  If a 0 is returned, then the sequence will not be chosen.

If all requesting sequences are not relevant, then the sequencer will call wait_for_relevant on all sequences and re-arbitrate upon its return.

Any sequence that implements is_relevant must also implement wait_for_relevant so that the sequencer has a way to wait for a sequence to become relevant.

is_blocked

function bit is_blocked()

Returns a bit indicating whether this sequence is currently prevented from running due to another lock or grab.  A 1 is returned if the sequence is currently blocked.  A 0 is returned if no lock or grab prevents this sequence from executing.  Note that even if a sequence is not blocked, it is possible for another sequence to issue a lock or grab before this sequence can issue a request.

has_lock

function bit has_lock()

Returns 1 if this sequence has a lock, 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 issuing operations on the sequencer>

lock

task lock(ovm_sequencer_base sequencer =  null)

Requests a lock on the specified sequencer.  If sequencer is null, the lock will be requested on the current default sequencer.

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

task grab(ovm_sequencer_base sequencer =  null)

Requests a lock on the specified sequencer.  If no argument is supplied, the lock will be requested on the current default sequencer.

A grab equest 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

function void unlock(ovm_sequencer_base sequencer =  null)

Removes any locks or grabs obtained by this sequence on the specified sequencer.  If sequencer is null, then the unlock will be done on the current default sequencer.

ungrab

function void ungrab(ovm_sequencer_base sequencer =  null)

Removes any locks or grabs obtained by this sequence on the specified sequencer.  If sequencer is null, then the unlock will be done on the current default sequencer.

set_response_queue_error_report_disabled

function void set_response_queue_error_report_disabled(bit value)

By default, if the response_queue overflows, an error is reported.  The response_queue will overflow if more responses are sent to this sequence from the driver than get_response calls are made.  Setting value to 0 disables these errors, while setting it to 1 enables them.

get_response_queue_error_report_disabled

function bit get_response_queue_error_report_disabled()

When this bit is 0 (default value), error reports are generated when the response queue overflows.  When this bit is 1, no such error reports are generated.

set_response_queue_depth

function void set_response_queue_depth(int value)

The default maximum depth of the response queue is 8.  These method is used to examine or change the maximum depth of the response queue.

Setting the response_queue_depth to -1 indicates an arbitrarily deep response queue.  No checking is done.

get_response_queue_depth

function int get_response_queue_depth()

Returns the current depth setting for the response queue.

clear_response_queue

virtual function void clear_response_queue()

Empties the response queue for this sequence.

wait_for_grant

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

This task issues a request to the current sequencer.  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.

send_request

virtual function void send_request(ovm_sequence_item request,  
bit rerandomize =  0)

The send_request function may only be called after a wait_for_grant call.  This call will send the 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.

wait_for_item_done

virtual task wait_for_item_done(int transaction_id =  -1)

A sequence may optionally call wait_for_item_done.  This task will block until the driver calls item_done or put.  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 return when the driver indicates completion of 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, having missed the earlier notification.

set_sequencer

virtual function void set_sequencer(ovm_sequencer_base sequencer)

Sets the default sequencer for the sequence to run on.  It will take effect immediately, so it should not be called while the sequence is actively communicating with the sequencer.

get_sequencer

virtual function ovm_sequencer_base get_sequencer()

Returns a reference to the current default sequencer of the sequence.

kill

function void kill()

This function will kill the sequence, and cause all current locks and requests in the sequence’s default sequencer to be removed.  The sequence state will change to STOPPED, and its post_body() method, if will not b

If a sequence has issued locks, grabs, or requests on sequencers other than the default sequencer, then care must be taken to unregister the sequence with the other sequencer(s) using the sequencer unregister_sequence() method.

use_response_handler

function void use_response_handler(bit enable)

When called with enable set to 1, responses will be sent to the response handler.  Otherwise, responses must be retrieved using get_response.

By default, responses from the driver are retrieved in the sequence by calling get_response.

An alternative method is for the sequencer to call the response_handler function with each response.

get_use_response_handler

function bit get_use_response_handler()

Returns the state of the use_response_handler bit.

response_handler

virtual function void response_handler(ovm_sequence_item response)

When the use_reponse_handler bit is set to 1, this virtual task is called by the sequencer for each response that arrives for this sequence.

create_item

protected function ovm_sequence_item create_item(
   ovm_object_wrapper type_var,
   ovm_sequencer_base l_sequencer,
   string name
)

Create_item will create and initialize a sequence_item or sequence using the factory.  The sequence_item or sequence will be initialized to communicate with the specified sequencer.

start_item

start_item and finish_item together will initiate operation of either a sequence_item or sequence object.  If the object has not been initiated using create_item, then start_item will be initialized in start_item to use the default sequencer specified by m_sequencer.  Randomization may be done between start_item and finish_item to ensure late generation

virtual task start_item(ovm_sequence_item item, int set_priority = -1);

finish_item

finish_item, together with start_item together will initiate operation of either a sequence_item or sequence object.  Finish_item must be called after start_item with no delays or delta-cycles.  Randomization, or other functions may be called between the start_item and finish_item calls.

virtual task finish_item(ovm_sequence_item item, int set_priority = -1);
virtual class ovm_object extends ovm_void
The ovm_object class is the base class for all OVM data and hierarchical classes.
virtual class ovm_transaction extends ovm_object
The ovm_transaction class is the root base class for OVM transactions.
class ovm_sequence_item extends ovm_transaction
The base class for user-defined sequence items and also the base class for the ovm_sequence class.
class ovm_sequence_base extends ovm_sequence_item
The ovm_sequence_base class provides the interfaces needed to create streams of sequence items and/or other sequences.
rand int unsigned seq_kind
Used as an identifier in constraints for a specific sequence type.
function new (string name =  "ovm_sequence",
ovm_sequencer_base sequencer_ptr =  null,
ovm_sequence_base parent_seq =  null)
The constructor for ovm_sequence_base.
function ovm_sequence_state_enum get_sequence_state()
Returns the sequence state as an enumerated value.
task wait_for_sequence_state(ovm_sequence_state_enum state)
Waits until the sequence reaches the given state.
virtual task start (ovm_sequencer_base sequencer,  
ovm_sequence_base parent_sequence =  null,
integer this_priority =  100,
bit call_pre_post =  1)
The start task is called to begin execution of a sequence
virtual task pre_body()
This task is a user-definable callback task that is called before the execution of the body, unless the sequence is started with call_pre_post=0.
virtual task post_body()
This task is a user-definable callback task that is called after the execution of the body, unless the sequence is started with call_pre_post=0.
virtual task pre_do(bit is_item)
This task is a user-definable callback task that is called after the sequence has issued a wait_for_grant() call and after the sequencer has selected this sequence, and before the item is randomized.
virtual task body()
This is the user-defined task where the main sequence code resides.
virtual function bit is_item()
This function may be called on any sequence_item or sequence object.
virtual function void mid_do(ovm_sequence_item this_item)
This function is a user-definable callback function that is called after the sequence item has been randomized, and just before the item is sent to the driver.
virtual function void post_do(ovm_sequence_item this_item)
This function is a user-definable callback function that is called after the driver has indicated that it has completed the item, using either this item_done or put methods.
function int num_sequences()
Returns the number of sequences in the sequencer’s sequence library.
function int get_seq_kind(string type_name)
This function returns an int representing the sequence kind that has been registerd with the sequencer.
function ovm_sequence_base get_sequence(int unsigned req_kind)
This function returns a reference to a sequence specified by req_kind, which can be obtained using the get_seq_kind method.
function ovm_sequence_base get_sequence_by_name(string seq_name)
Internal method.
task do_sequence_kind(int unsigned req_kind)
This task will start a sequence of kind specified by req_kind, which can be obtained using the get_seq_kind method.
function void set_priority (int value)
The priority of a sequence may be changed at any point in time.
function int get_priority()
This function returns the current priority of the sequence.
virtual task wait_for_relevant()
This method is called by the sequencer when all available sequences are not relevant.
virtual function bit is_relevant()
The default is_relevant implementation returns 1, indicating that the sequence is always relevant.
function bit is_blocked()
Returns a bit indicating whether this sequence is currently prevented from running due to another lock or grab.
function bit has_lock()
Returns 1 if this sequence has a lock, 0 otherwise.
task lock(ovm_sequencer_base sequencer =  null)
Requests a lock on the specified sequencer.
task grab(ovm_sequencer_base sequencer =  null)
Requests a lock on the specified sequencer.
function void unlock(ovm_sequencer_base sequencer =  null)
Removes any locks or grabs obtained by this sequence on the specified sequencer.
function void ungrab(ovm_sequencer_base sequencer =  null)
Removes any locks or grabs obtained by this sequence on the specified sequencer.
function void set_response_queue_error_report_disabled(bit value)
By default, if the response_queue overflows, an error is reported.
function bit get_response_queue_error_report_disabled()
When this bit is 0 (default value), error reports are generated when the response queue overflows.
function void set_response_queue_depth(int value)
The default maximum depth of the response queue is 8.
function int get_response_queue_depth()
Returns the current depth setting for the response queue.
virtual function void clear_response_queue()
Empties the response queue for this sequence.
virtual task wait_for_grant(int item_priority =  -1,
bit lock_request =  0)
This task issues a request to the current sequencer.
virtual function void send_request(ovm_sequence_item request,  
bit rerandomize =  0)
The send_request function may only be called after a wait_for_grant call.
virtual task wait_for_item_done(int transaction_id =  -1)
A sequence may optionally call wait_for_item_done.
virtual function void set_sequencer(ovm_sequencer_base sequencer)
Sets the default sequencer for the sequence to run on.
virtual function ovm_sequencer_base get_sequencer()
Returns a reference to the current default sequencer of the sequence.
function void kill()
This function will kill the sequence, and cause all current locks and requests in the sequence’s default sequencer to be removed.
function void use_response_handler(bit enable)
When called with enable set to 1, responses will be sent to the response handler.
function bit get_use_response_handler()
Returns the state of the use_response_handler bit.
virtual function void response_handler(ovm_sequence_item response)
When the use_reponse_handler bit is set to 1, this virtual task is called by the sequencer for each response that arrives for this sequence.
protected function ovm_sequence_item create_item(
   ovm_object_wrapper type_var,
   ovm_sequencer_base l_sequencer,
   string name
)
Create_item will create and initialize a sequence_item or sequence using the factory.