The uvm_transaction class is the root base class for UVM transactions. Inheriting all the methods of uvm_object, uvm_transaction adds a timing and recording interface.
This class provides timestamp properties, notification events, and transaction recording support.
Use of this class as a base for user-defined transactions is deprecated. Its subtype, uvm_sequence_item, shall be used as the base class for all user-defined transaction types.
The intended use of this API is via a <uvm_driver> to call uvm_component::accept_tr, uvm_component::begin_tr, and uvm_component::end_tr during the course of sequence item execution. These methods in the component base class will call into the corresponding methods in this class to set the corresponding timestamps (accept_time, begin_time, and end_tr), trigger the corresponding event (begin_event and end_event, and, if enabled, record the transaction contents to a vendor-specific transaction database.
Note that start_item/finish_item (or `uvm_do* macro) executed from a uvm_sequence #(REQ,RSP) will automatically trigger the begin_event and end_events via calls to begin_tr and end_tr. While convenient, it is generally the responsibility of drivers to mark a transaction’s progress during execution. To allow the driver to control sequence item timestamps, events, and recording, you must add +define+UVM_DISABLE_AUTO_ITEM_RECORDING when compiling the UVM package. Alternatively, users may use the transaction’s event pool, events, to define custom events for the driver to trigger and the sequences to wait on. Any in-between events such as marking the begining of the address and data phases of transaction execution could be implemented via the events pool.
In pipelined protocols, the driver may release a sequence (return from finish_item() or it’s `uvm_do macro) before the item has been completed. If the driver uses the begin_tr/end_tr API in uvm_component, the sequence can wait on the item’s end_event to block until the item was fully executed, as in the following example.
task uvm_execute(item, ...); // can use the `uvm_do macros as well start_item(item); item.randomize(); finish_item(item); item.end_event.wait_on(); // get_response(rsp, item.get_transaction_id()); //if needed endtask
A simple two-stage pipeline driver that can execute address and data phases concurrently might be implemented as follows:
task run(); // this driver supports a two-deep pipeline fork do_item(); do_item(); join endtask task do_item(); forever begin mbus_item req; lock.get(); seq_item_port.get(req); // Completes the sequencer-driver handshake accept_tr(req); // request bus, wait for grant, etc. begin_tr(req); // execute address phase // allows next transaction to begin address phase lock.put(); // execute data phase // (may trigger custom "data_phase" event here) end_tr(req); end endtask: do_item
uvm_transaction | ||||
The uvm_transaction class is the root base class for UVM transactions. | ||||
Class Hierarchy | ||||
| ||||
Class Declaration | ||||
| ||||
Methods | ||||
new | Creates a new transaction object. | |||
accept_tr | Calling accept_tr indicates that the transaction item has been received by a consumer component. | |||
do_accept_tr | This user-definable callback is called by accept_tr just before the accept event is triggered. | |||
begin_tr | This function indicates that the transaction has been started and is not the child of another transaction. | |||
begin_child_tr | This function indicates that the transaction has been started as a child of a parent transaction given by parent_handle. | |||
do_begin_tr | This user-definable callback is called by begin_tr and begin_child_tr just before the begin event is triggered. | |||
end_tr | This function indicates that the transaction execution has ended. | |||
do_end_tr | This user-definable callback is called by end_tr just before the end event is triggered. | |||
get_tr_handle | Returns the handle associated with the transaction, as set by a previous call to begin_child_tr or begin_tr with transaction recording enabled. | |||
disable_recording | Turns off recording for the transaction stream. | |||
enable_recording | Turns on recording to the stream specified by stream, whose interpretation is implementation specific. | |||
is_recording_enabled | Returns 1 if recording is currently on, 0 otherwise. | |||
is_active | Returns 1 if the transaction has been started but has not yet been ended. | |||
get_event_pool | Returns the event pool associated with this transaction. | |||
set_initiator | Sets initiator as the initiator of this transaction. | |||
get_initiator | Returns the component that produced or started the transaction, as set by a previous call to set_initiator. | |||
get_accept_time | ||||
get_begin_time | ||||
get_end_time | Returns the time at which this transaction was accepted, begun, or ended, as by a previous call to accept_tr, begin_tr, begin_child_tr, or end_tr. | |||
set_transaction_id | Sets this transaction’s numeric identifier to id. | |||
get_transaction_id | Returns this transaction’s numeric identifier, which is -1 if not set explicitly by set_transaction_id. | |||
Variables | ||||
events | The event pool instance for this transaction. | |||
begin_event | A uvm_event that is triggered when this transaction’s actual execution on the bus begins, typically as a result of a driver calling uvm_component::begin_tr. | |||
end_event | A uvm_event that is triggered when this transaction’s actual execution on the bus ends, typically as a result of a driver calling uvm_component::end_tr. |
function new ( string name = "", uvm_component initiator = null )
Creates a new transaction object. The name is the instance name of the transaction. If not supplied, then the object is unnamed.
function void accept_tr ( time accept_time = )
Calling accept_tr indicates that the transaction item has been received by a consumer component. Typically a <uvm_driver> would call uvm_component::accept_tr, which calls this method-- upon return from a get_next_item(), get(), or peek() call on its sequencer port, <uvm_driver::seq_item_port>.
With some protocols, the received item may not be started immediately after it is accepted. For example, a bus driver, having accepted a request transaction, may still have to wait for a bus grant before begining to execute the request.
virtual protected function void do_accept_tr ()
This user-definable callback is called by accept_tr just before the accept event is triggered. Implementations should call super.do_accept_tr to ensure correct operation.
function integer begin_tr ( time begin_time = )
This function indicates that the transaction has been started and is not the child of another transaction. Generally, a consumer component begins execution of a transactions it receives.
Typically a <uvm_driver> would call uvm_component::begin_tr, which calls this method, before actual execution of a sequence item transaction. Sequence items received by a driver are always a child of a parent sequence. In this case, begin_tr obtains the parent handle and delegates to begin_child_tr.
See accept_tr for more information on how the begin-time might differ from when the transaction item was received.
The return value is a transaction handle, which is valid (non-zero) only if recording is enabled. The meaning of the handle is implementation specific.
function integer begin_child_tr ( time begin_time = 0, integer parent_handle = 0 )
This function indicates that the transaction has been started as a child of a parent transaction given by parent_handle. Generally, a consumer component calls this method via uvm_component::begin_child_tr to indicate the actual start of execution of this transaction.
The parent handle is obtained by a previous call to begin_tr or begin_child_tr. If the parent_handle is invalid (=0), then this function behaves the same as begin_tr.
The return value is a transaction handle, which is valid (non-zero) only if recording is enabled. The meaning of the handle is implementation specific.
virtual protected function void do_begin_tr ()
This user-definable callback is called by begin_tr and begin_child_tr just before the begin event is triggered. Implementations should call super.do_begin_tr to ensure correct operation.
function void end_tr ( time end_time = 0, bit free_handle = 1 )
This function indicates that the transaction execution has ended. Generally, a consumer component ends execution of the transactions it receives.
You must have previously called begin_tr or begin_child_tr for this call to be successful.
Typically a <uvm_driver> would call uvm_component::end_tr, which calls this method, upon completion of a sequence item transaction. Sequence items received by a driver are always a child of a parent sequence. In this case, begin_tr obtain the parent handle and delegate to begin_child_tr.
function integer get_tr_handle ()
Returns the handle associated with the transaction, as set by a previous call to begin_child_tr or begin_tr with transaction recording enabled.
function void disable_recording ()
Turns off recording for the transaction stream. This method does not effect a uvm_component’s recording streams.
function void enable_recording ( string stream, uvm_recorder recorder = null )
Turns on recording to the stream specified by stream, whose interpretation is implementation specific. The optional recorder argument specifies
If transaction recording is on, then a call to record is made when the transaction is started and when it is ended.
function bit is_recording_enabled()
Returns 1 if recording is currently on, 0 otherwise.
function bit is_active ()
Returns 1 if the transaction has been started but has not yet been ended. Returns 0 if the transaction has not been started.
function uvm_event_pool get_event_pool ()
Returns the event pool associated with this transaction.
By default, the event pool contains the events: begin, accept, and end. Events can also be added by derivative objects. An event pool is a specialization of an <uvm_pool #(T)>, e.g. a uvm_pool#(uvm_event).
function void set_initiator ( uvm_component initiator )
Sets initiator as the initiator of this transaction.
The initiator can be the component that produces the transaction. It can also be the component that started the transaction. This or any other usage is up to the transaction designer.
function uvm_component get_initiator ()
Returns the component that produced or started the transaction, as set by a previous call to set_initiator.
function time get_accept_time ()
function time get_begin_time ()
function time get_end_time ()
Returns the time at which this transaction was accepted, begun, or ended, as by a previous call to accept_tr, begin_tr, begin_child_tr, or end_tr.
function void set_transaction_id( integer id )
Sets this transaction’s numeric identifier to id. If not set via this method, the transaction ID defaults to -1.
When using sequences to generate stimulus, the transaction ID is used along with the sequence ID to route responses in sequencers and to correlate responses to requests.
function integer get_transaction_id()
Returns this transaction’s numeric identifier, which is -1 if not set explicitly by set_transaction_id.
When using a uvm_sequence #(REQ,RSP) to generate stimulus, the transaction ID is used along with the sequence ID to route responses in sequencers and to correlate responses to requests.
const uvm_event_pool events = new
The event pool instance for this transaction. This pool is used to track various The begin_event
uvm_event begin_event
A uvm_event that is triggered when this transaction’s actual execution on the bus begins, typically as a result of a driver calling uvm_component::begin_tr. Processes that wait on this event will block until the transaction has begun.
For more information, see the general discussion for uvm_transaction. See uvm_event for details on the event API.
uvm_event end_event
A uvm_event that is triggered when this transaction’s actual execution on the bus ends, typically as a result of a driver calling uvm_component::end_tr. Processes that wait on this event will block until the transaction has ended.
For more information, see the general discussion for uvm_transaction. See uvm_event for details on the event API.
virtual task my_sequence::body(); ... start_item(item); \ item.randomize(); } `uvm_do(item) finish_item(item); / // return from finish item does not always mean item is completed item.end_event.wait_on(); ...
The uvm_object class is the base class for all UVM data and hierarchical classes.
virtual class uvm_object extends uvm_void
The uvm_transaction class is the root base class for UVM transactions.
virtual class uvm_transaction extends uvm_object
Creates a new transaction object.
function new ( string name = "", uvm_component initiator = null )
Calling accept_tr indicates that the transaction item has been received by a consumer component.
function void accept_tr ( time accept_time = )
This user-definable callback is called by accept_tr just before the accept event is triggered.
virtual protected function void do_accept_tr ()
This function indicates that the transaction has been started and is not the child of another transaction.
function integer begin_tr ( time begin_time = )
This function indicates that the transaction has been started as a child of a parent transaction given by parent_handle.
function integer begin_child_tr ( time begin_time = 0, integer parent_handle = 0 )
This user-definable callback is called by begin_tr and begin_child_tr just before the begin event is triggered.
virtual protected function void do_begin_tr ()
This function indicates that the transaction execution has ended.
function void end_tr ( time end_time = 0, bit free_handle = 1 )
This user-definable callback is called by end_tr just before the end event is triggered.
virtual protected function void do_end_tr ()
Returns the handle associated with the transaction, as set by a previous call to begin_child_tr or begin_tr with transaction recording enabled.
function integer get_tr_handle ()
Turns off recording for the transaction stream.
function void disable_recording ()
Turns on recording to the stream specified by stream, whose interpretation is implementation specific.
function void enable_recording ( string stream, uvm_recorder recorder = null )
Returns 1 if recording is currently on, 0 otherwise.
function bit is_recording_enabled()
Returns 1 if the transaction has been started but has not yet been ended.
function bit is_active ()
Returns the event pool associated with this transaction.
function uvm_event_pool get_event_pool ()
Sets initiator as the initiator of this transaction.
function void set_initiator ( uvm_component initiator )
Returns the component that produced or started the transaction, as set by a previous call to set_initiator.
function uvm_component get_initiator ()
function time get_accept_time ()
function time get_begin_time ()
Returns the time at which this transaction was accepted, begun, or ended, as by a previous call to accept_tr, begin_tr, begin_child_tr, or end_tr.
function time get_end_time ()
Sets this transaction’s numeric identifier to id.
function void set_transaction_id( integer id )
Returns this transaction’s numeric identifier, which is -1 if not set explicitly by set_transaction_id.
function integer get_transaction_id()
The event pool instance for this transaction.
const uvm_event_pool events = new
A uvm_event that is triggered when this transaction’s actual execution on the bus begins, typically as a result of a driver calling uvm_component::begin_tr.
uvm_event begin_event
The uvm_event class is a wrapper class around the SystemVerilog event construct.
class uvm_event extends uvm_object
This function marks the start of a transaction, tr, by this component.
function integer begin_tr ( uvm_transaction tr, string stream_name = "main", string label = "", string desc = "", time begin_time = 0, integer parent_handle = 0 )
A uvm_event that is triggered when this transaction’s actual execution on the bus ends, typically as a result of a driver calling uvm_component::end_tr.
uvm_event end_event
This function marks the end of a transaction, tr, by this component.
function void end_tr ( uvm_transaction tr, time end_time = 0, bit free_handle = 1 )
The base class for user-defined sequence items and also the base class for the uvm_sequence class.
class uvm_sequence_item extends uvm_transaction
This function marks the acceptance of a transaction, tr, by this component.
function void accept_tr ( uvm_transaction tr, time accept_time = )
The uvm_sequence class provides the interfaces necessary in order to create streams of sequence items and/or other sequences.
virtual class uvm_sequence #( type REQ = uvm_sequence_item, type RSP = REQ ) extends uvm_sequence_base
This function marks the start of a child transaction, tr, by this component.
function integer begin_child_tr ( uvm_transaction tr, integer parent_handle = 0, string stream_name = "main", string label = "", string desc = "", time begin_time = 0 )
The uvm_component class is the root base class for UVM components.
virtual class uvm_component extends uvm_report_object