uvm_sqr_if_base #(REQ,RSP)

This class defines an interface for sequence drivers to communicate with sequencers.  The driver requires the interface via a port, and the sequencer implements it and provides it via an export.

Summary
uvm_sqr_if_base #(REQ,RSP)
This class defines an interface for sequence drivers to communicate with sequencers.
Class Declaration
virtual class uvm_sqr_if_base #( type  T1  =  uvm_object,
  T2  =  T1 )
Methods
get_next_itemRetrieves the next available item from a sequence.
try_next_itemRetrieves the next available item from a sequence if one is available.
item_doneIndicates that the request is completed to the sequencer.
wait_for_sequencesWaits for a sequence to have a new item available.
has_do_availableIndicates whether a sequence item is available for immediate processing.
getRetrieves the next available item from a sequence.
peekReturns the current request item if one is in the sequencer fifo.
putSends a response back to the sequence that issued the request.

get_next_item

virtual task get_next_item( output  T1  t )

Retrieves the next available item from a sequence.  The call will block until an item is available.  The following steps occur on this call:

1Arbitrate among requesting, unlocked, relevant sequences - choose the highest priority sequence based on the current sequencer arbitration mode.  If no sequence is available, wait for a requesting unlocked relevant sequence, then re-arbitrate.
2The chosen sequence will return from wait_for_grant
3The chosen sequence uvm_sequence_base::pre_do is called
4The chosen sequence item is randomized
5The chosen sequence uvm_sequence_base::post_do is called
6Return with a reference to the item

Once get_next_item is called, item_done must be called to indicate the completion of the request to the sequencer.  This will remove the request item from the sequencer fifo.

try_next_item

virtual task try_next_item( output  T1  t )

Retrieves the next available item from a sequence if one is available.  Otherwise, the function returns immediately with request set to null.  The following steps occur on this call:

1Arbitrate among requesting, unlocked, relevant sequences - choose the highest priority sequence based on the current sequencer arbitration mode.  If no sequence is available, return null.
2The chosen sequence will return from wait_for_grant
3The chosen sequence uvm_sequence_base::pre_do is called
4The chosen sequence item is randomized
5The chosen sequence uvm_sequence_base::post_do is called
6Return with a reference to the item

Once try_next_item is called, item_done must be called to indicate the completion of the request to the sequencer.  This will remove the request item from the sequencer fifo.

item_done

virtual function void item_done( input  T2  t  =  null )

Indicates that the request is completed to the sequencer.  Any uvm_sequence_base::wait_for_item_done calls made by a sequence for this item will return.

The current item is removed from the sequencer fifo.

If a response item is provided, then it will be sent back to the requesting sequence.  The response item must have it’s sequence ID and transaction ID set correctly, using the uvm_sequence_item::set_id_info method:

rsp.set_id_info(req);

Before item_done is called, any calls to peek will retrieve the current item that was obtained by get_next_item.  After item_done is called, peek will cause the sequencer to arbitrate for a new item.

wait_for_sequences

virtual task wait_for_sequences()

Waits for a sequence to have a new item available.  The default implementation in the sequencer delays <uvm_sequencer_base::pound_zero_count> delta cycles.  User-derived sequencers may override its wait_for_sequences implementation to perform some other application-specific implementation.

has_do_available

virtual function bit has_do_available()

Indicates whether a sequence item is available for immediate processing.  Implementations should return 1 if an item is available, 0 otherwise.

get

virtual task get( output  T1  t )

Retrieves the next available item from a sequence.  The call blocks until an item is available.  The following steps occur on this call:

1Arbitrate among requesting, unlocked, relevant sequences - choose the highest priority sequence based on the current sequencer arbitration mode.  If no sequence is available, wait for a requesting unlocked relevant sequence, then re-arbitrate.
2The chosen sequence will return from uvm_sequence_base::wait_for_grant
3The chosen sequence uvm_sequence_base::pre_do is called
4The chosen sequence item is randomized
5The chosen sequence uvm_sequence_base::post_do is called
6Indicate item_done to the sequencer
7Return with a reference to the item

When get is called, item_done may not be called.  A new item can be obtained by calling get again, or a response may be sent using either put, or uvm_driver::rsp_port.write().

peek

virtual task peek( output  T1  t )

Returns the current request item if one is in the sequencer fifo.  If no item is in the fifo, then the call will block until the sequencer has a new request.  The following steps will occur if the sequencer fifo is empty:

1Arbitrate among requesting, unlocked, relevant sequences - choose the highest priority sequence based on the current sequencer arbitration mode.  If no sequence is available, wait for a requesting unlocked relevant sequence, then re-arbitrate.
2The chosen sequence will return from uvm_sequence_base::wait_for_grant
3The chosen sequence uvm_sequence_base::pre_do is called
4The chosen sequence item is randomized
5The chosen sequence uvm_sequence_base::post_do is called

Once a request item has been retrieved and is in the sequencer fifo, subsequent calls to peek will return the same item.  The item will stay in the fifo until either get or item_done is called.

put

virtual task put( input  T2  t )

Sends a response back to the sequence that issued the request.  Before the response is put, it must have it’s sequence ID and transaction ID set to match the request.  This can be done using the uvm_sequence_item::set_id_info call:

rsp.set_id_info(req);

This task will not block.  The response will be put into the sequence response queue or it will be sent to the sequence response handler.

virtual class uvm_sqr_if_base #( type  T1  =  uvm_object,
  T2  =  T1 )
This class defines an interface for sequence drivers to communicate with sequencers.
virtual task get_next_item( output  T1  t )
Retrieves the next available item from a sequence.
virtual task try_next_item( output  T1  t )
Retrieves the next available item from a sequence if one is available.
virtual function void item_done( input  T2  t  =  null )
Indicates that the request is completed to the sequencer.
virtual task wait_for_sequences()
Waits for a sequence to have a new item available.
virtual function bit has_do_available()
Indicates whether a sequence item is available for immediate processing.
virtual task get( output  T1  t )
Retrieves the next available item from a sequence.
virtual task peek( output  T1  t )
Returns the current request item if one is in the sequencer fifo.
virtual task put( input  T2  t )
Sends a response back to the sequence that issued the request.
virtual task pre_do( bit  is_item )
This task is a user-definable callback task that is called on the parent sequence, if any.the sequence has issued a wait_for_grant() call and after the sequencer has selected this sequence, and before the item is randomized.
virtual function void post_do( uvm_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.
virtual task wait_for_item_done( int  transaction_id  =  -1 )
A sequence may optionally call wait_for_item_done.
function void set_id_info( uvm_sequence_item  item )
Copies the sequence_id and transaction_id from the referenced item into the calling item.
virtual task wait_for_grant( int  item_priority  =  -1,
bit  lock_request  =  0 )
This task issues a request to the current sequencer.