# uvm_event_base

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

Contents

uvm_event_base | The uvm_event_base class is an abstract wrapper class around the SystemVerilog event construct.
uvm_event#(T) | The uvm_event class is an extension of the abstract uvm_event_base class.

### Methods

### new

> function new (
> | string | name | = | ""
> )

Creates a new event object.

### wait_on

> virtual task wait_on (
> | bit | delta | = | 0
> )

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 | = | 0
> )

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 uvm_event#(T)::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.

### 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 | = | 0
> )

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.

### 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.

## uvm_event#(T)

The uvm_event class is an extension of the abstract uvm_event_base class.

The optional parameter T allows the user to define a data type which can be passed during an event trigger.

Summary

uvm_event#(T)
The uvm_event class is an extension of the abstract uvm_event_base class.
Class Hierarchy
uvm_void
uvm_object
uvm_event_base
uvm_event#(T)
Class Declaration
> class uvm_event#(
> | type | T | = | uvm_object
> ) extends uvm_event_base
Methods |
new | Creates a new event object.
wait_trigger_data | This method calls uvm_event_base::wait_trigger followed by get_trigger_data.
wait_ptrigger_data | This method calls uvm_event_base::wait_ptrigger followed by get_trigger_data.
trigger | Triggers the event, resuming all waiting processes.
get_trigger_data | Gets the data, if any, provided by the last call to trigger.
add_callback | Registers a callback object, cb, with this event.
delete_callback | Unregisters the given callback, cb, from this event.

### Methods

### new

> function new (
> | string | name | = | ""
> )

Creates a new event object.

### wait_trigger_data

> virtual task wait_trigger_data (
> | output | T | data
> )

This method calls uvm_event_base::wait_trigger followed by get_trigger_data.

### wait_ptrigger_data

> virtual task wait_ptrigger_data (
> | output | T | data
> )

This method calls uvm_event_base::wait_ptrigger followed by get_trigger_data.

### trigger

> virtual function void trigger (
> | T | 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 T get_trigger_data ()

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

### add_callback

> virtual function void add_callback (
> | uvm_event_callback#(T) | 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 (
> | uvm_event_callback#(T) | cb
> )

Unregisters the given callback, cb, from this event.

> virtual class uvm_void

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.

> virtual class uvm_event_base extends uvm_object

The uvm_event_base class is an abstract wrapper class around the SystemVerilog event construct.

> class uvm_event#(
> | type | T | = | uvm_object
> ) extends uvm_event_base

The uvm_event class is an extension of the abstract uvm_event_base class.

> virtual function void reset (
> | bit | wakeup | = | 0
> )

Resets the event to its off state.

> virtual function void trigger (
> | T | data | = | null
> )

Triggers the event, resuming all waiting processes.

> virtual task wait_trigger ()

Waits for the event to be triggered.

> function new (
> | string | name | = | ""
> )

Creates a new event object.

> virtual task wait_trigger_data (
> | output | T | data
> )

This method calls uvm_event_base::wait_trigger followed by get_trigger_data.

> virtual function T get_trigger_data ()

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

> virtual task wait_ptrigger_data (
> | output | T | data
> )

This method calls uvm_event_base::wait_ptrigger followed by get_trigger_data.

> virtual task wait_ptrigger ()

Waits for a persistent trigger of the event.

> virtual function void add_callback (
> | uvm_event_callback#(T) | cb, |  |
> | bit | append | = | 1
> )

Registers a callback object, cb, with this event.

> virtual function void delete_callback (
> | uvm_event_callback#(T) | cb
> )

Unregisters the given callback, cb, from this event.