Anda di halaman 1dari 10

UVM EVENT And UVM EVENT POOL

UVM EVENT
UVM EVENT EXAMPLE
UVM_OBJECT_STRING_POOL & UVM_EVENT_POOL
UVM_EVENT_POOL Example
Achieving the synchronization

UVM EVENTS
The uvm_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.

Class hierarchy : uvm_void uvm_object uvm_event

uvm_event methods

New:

Creates a new event object.

wait_on:

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

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

wait_trigger:

Waits for the event to be triggered.

wait_ptrigger: Waits for a persistent trigger of the event.

wait_trigger_data: This method calls wait_trigger followed by get_trigger_data.

wait_ptrigger_data:
get_trigger_data.

Trigger:

This method calls wait_ptrigger followed by

Triggers the event, resuming all waiting processes.

uvm_event methods cont.


get_trigger_data:

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

get_trigger_time:

Gets the time that this event was last triggered.

is_on:

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

is_off:

Indicates whether the event has been triggered or been reset.

Reset:

Resets the event to its off state.

add_callback:

Registers a callback object, cb, with this event.

delete_callback: Unregisters the given callback, cb, from this event.

Cancel:

Decrements the number of waiters on the event.

get_num_waiters:

Returns the number of processes waiting on the event.

UVM_EVENT Example
Module event_example();
uvm_event event;
Initial begin
Event = new(event);
Fork
PROCESS1: begin
object obj;
obj.data = 'h55;
event.trigger(.data(obj));
End
PROCESS2: begin
object obj;
event.wait_ptrigger_data(.data(obj));
End
join
End
endmodule

uvm_object_string_pool and
uvm_event_pool

This provides a specialization of the generic uvm_pool #(KEY,T) class


for an associative array of uvm_object-based objects indexed by string.
Specializations of this class include the uvm_event_pool (a
uvm_object_string_pool storing uvm_event#(uvm_object))

Class Hierarchy: uvm_pool #(string T) uvm_object_string_pool #(T)

uvm_object_string_pool methods
and uvm_event_pool
new:

Creates a new pool with the given name.

get_type_name: Returns the type name of this object.

get_global_pool: Returns the singleton global pool for the item type, T.

get_global: Returns the specified item instance from the global item pool.

get:

Returns the object item at the given string key.

delete: Removes the item with the given string key from the pool.

typedef uvm_object_string_pool #(uvm_event)


uvm_event_pool;

uvm_event_pool example

in the driver:

uvm_event_pool p1 = p1.get_global_pool();
uvm_event e1 = p1.get("ABC");
e1.trigger();
e1.reset();
in the receiver:

uvm_event_pool p1 = p1.get_global_pool();
uvm_event e1 = p1.get("ABC");
e1.wait_trigger()

Achieving the sync.

get_global_pool () method of uvm_event_pool returns the singleton global event pool.


This allows events to be shared between components throughout the verification
environment.

Using uvm Event callbacks

Add the callback to uvm_event using add_callback()


virtual function void add_callback (
uvm_event_callback
bit append = 1 )

cb,

Create new class extending from uvm_event_callbacks and define pre_trigger


or post_trigger or both based on requirement.

virtual function bit pre_trigger ( uvm_event e, uvm_object data = null )

virtual function void post_trigger (uvm_event e, uvm_object data = null )

Anda mungkin juga menyukai