ovm_event

The ovm_event class is a wrapper class around the SystemVerilog event construct.  It provides some additional services such as setting callbacks and maintaining the number of waiters.

Summary
ovm_event
The ovm_event class is a wrapper class around the SystemVerilog event construct.
Class Hierarchy
ovm_event
Class Declaration
class ovm_event extends ovm_object
Methods
newCreates a new event object.
wait_onWaits for the event to be activated for the first time.
wait_offIf the event has already triggered and is “on”, this task waits for the event to be turned “off” via a call to reset.
wait_triggerWaits for the event to be triggered.
wait_ptriggerWaits for a persistent trigger of the event.
wait_trigger_dataThis method calls wait_trigger followed by get_trigger_data.
wait_ptrigger_dataThis method calls wait_ptrigger followed by get_trigger_data.
triggerTriggers the event, resuming all waiting processes.
get_trigger_dataGets the data, if any, provided by the last call to trigger.
get_trigger_timeGets the time that this event was last triggered.
is_onIndicates whether the event has been triggered since it was last reset.
is_offIndicates whether the event has been triggered or been reset.
resetResets the event to its off state.
add_callbackRegisters a callback object, cb, with this event.
delete_callbackUnregisters the given callback, cb, from this event.
cancelDecrements the number of waiters on the event.
get_num_waitersReturns the number of processes waiting on the event.

new

function new (string name = "")

Creates a new event object.

wait_on

virtual task wait_on (bit delta = )

Waits for the event to be activated for the first time.

If the event has already been triggered, this task returns immediately.  If delta is set, the caller will be forced to wait a single delta #0 before returning.  This prevents the caller from returning before previously waiting processes have had a chance to resume.

Once an event has been triggered, it will be remain “on” until the event is reset.

wait_off

virtual task wait_off (bit delta = )

If the event has already triggered and is “on”, this task waits for the event to be turned “off” via a call to reset.

If the event has not already been triggered, this task returns immediately.  If delta is set, the caller will be forced to wait a single delta #0 before returning.  This prevents the caller from returning before previously waiting processes have had a chance to resume.

wait_trigger

virtual task wait_trigger ()

Waits for the event to be triggered.

If one process calls wait_trigger in the same delta as another process calls trigger, a race condition occurs.  If the call to wait occurs before the trigger, this method will return in this delta.  If the wait occurs after the trigger, this method will not return until the next trigger, which may never occur and thus cause deadlock.

wait_ptrigger

virtual task wait_ptrigger ()

Waits for a persistent trigger of the event.  Unlike wait_trigger, this views the trigger as persistent within a given time-slice and thus avoids certain race conditions.  If this method is called after the trigger but within the same time-slice, the caller returns immediately.

wait_trigger_data

virtual task wait_trigger_data (output ovm_object data)

This method calls wait_trigger followed by get_trigger_data.

wait_ptrigger_data

virtual task wait_ptrigger_data (output ovm_object data)

This method calls wait_ptrigger followed by get_trigger_data.

trigger

virtual function void trigger (ovm_object data = null)

Triggers the event, resuming all waiting processes.

An optional data argument can be supplied with the enable to provide trigger-specific information.

get_trigger_data

virtual function ovm_object get_trigger_data ()

Gets the data, if any, provided by the last call to trigger.

get_trigger_time

virtual function time get_trigger_time ()

Gets the time that this event was last triggered.  If the event has not been triggered, or the event has been reset, then the trigger time will be 0.

is_on

virtual function bit is_on ()

Indicates whether the event has been triggered since it was last reset.

A return of 1 indicates that the event has triggered.

is_off

virtual function bit is_off ()

Indicates whether the event has been triggered or been reset.

A return of 1 indicates that the event has not been triggered.

reset

virtual function void reset (bit wakeup = )

Resets the event to its off state.  If wakeup is set, then all processes currently waiting for the event are activated before the reset.

No callbacks are called during a reset.

add_callback

virtual function void add_callback (ovm_event_callback cb,  
bit append = 1)

Registers a callback object, cb, with this event.  The callback object may include pre_trigger and post_trigger functionality.  If append is set to 1, the default, cb is added to the back of the callback list.  Otherwise, cb is placed at the front of the callback list.

delete_callback

virtual function void delete_callback (ovm_event_callback cb)

Unregisters the given callback, cb, from this event.

cancel

virtual function void cancel ()

Decrements the number of waiters on the event.

This is used if a process that is waiting on an event is disabled or activated by some other means.

get_num_waiters

virtual function int get_num_waiters ()

Returns the number of processes waiting on the event.

virtual class ovm_object extends ovm_void
The ovm_object class is the base class for all OVM data and hierarchical classes.
class ovm_event extends ovm_object
The ovm_event class is a wrapper class around the SystemVerilog event construct.
function new (string name = "")
Creates a new event object.
virtual task wait_on (bit delta = )
Waits for the event to be activated for the first time.
virtual task wait_off (bit delta = )
If the event has already triggered and is “on”, this task waits for the event to be turned “off” via a call to reset.
virtual function void reset (bit wakeup = )
Resets the event to its off state.
virtual task wait_trigger ()
Waits for the event to be triggered.
virtual task wait_ptrigger ()
Waits for a persistent trigger of the event.
virtual task wait_trigger_data (output ovm_object data)
This method calls wait_trigger followed by get_trigger_data.
virtual function ovm_object get_trigger_data ()
Gets the data, if any, provided by the last call to trigger.
virtual task wait_ptrigger_data (output ovm_object data)
This method calls wait_ptrigger followed by get_trigger_data.
virtual function void trigger (ovm_object data = null)
Triggers the event, resuming all waiting processes.
virtual function time get_trigger_time ()
Gets the time that this event was last triggered.
virtual function bit is_on ()
Indicates whether the event has been triggered since it was last reset.
virtual function bit is_off ()
Indicates whether the event has been triggered or been reset.
virtual function void add_callback (ovm_event_callback cb,  
bit append = 1)
Registers a callback object, cb, with this event.
virtual function void delete_callback (ovm_event_callback cb)
Unregisters the given callback, cb, from this event.
virtual function void cancel ()
Decrements the number of waiters on the event.
virtual function int get_num_waiters ()
Returns the number of processes waiting on the event.