Académique Documents
Professionnel Documents
Culture Documents
`uvm_do_callbacks_exit_on(T,CB,METHOD,VAL)
Calls the given METHOD of all callbacks of type CB registered with the calling object (i.e. this object), which is or is
based on type T, returning upon the first callback returning the bit value given by VAL.
This macro executes all of the callbacks associated with the calling object (i.e. this object). The macro takes three
arguments:
CB is the class type of the callback objects to execute. The class type must have a function signature that
matches the METHOD argument.
T is the type associated with the callback. Typically, an instance of type T is passed as one the arguments in
the METHOD call.
METHOD is the method call to invoke, with all required arguments as if they were invoked directly.
VAL, if 1, says return upon the first callback invocation that returns 1. If 0, says return upon the first callback
invocation that returns 0.
`uvm_do_callbacks(T,CB,METHOD)
Calls the given METHOD of all callbacks of type CB registered with the calling object (i.e. this object), which is or is
based on type T.
This macro executes all of the callbacks associated with the calling object (i.e. this object). The macro takes three
arguments:
CB is the class type of the callback objects to execute. The class type must have a function signature that
matches the METHOD argument.
T is the type associated with the callback. Typically, an instance of type T is passed as one the arguments in
the METHOD call.
METHOD is the method call to invoke, with all required arguments as if they were invoked directly.
`uvm_register_cb(T,CB)
Registers the given CB callback type with the given T object type. If a type-callback pair is not registered then a
warning is issued if an attempt is made to use the pair (add, delete, etc.). The registration will typically occur in the
component that executes the given type of callback
Class link_layer extends uvm_component;
`uvm_register_cb(link_layer, link_layer_cbs)
virtual function bit on_enter_link_layer(packet pkt);
`uvm_do_callbacks_exit_on(
link_layer,
//
link_layer_cbs,
//
on_enter_link_layer(this,tr), //
1
// return after the
)
endfunction
this type
callback type
callback call
first invocation
begin
uvm_report_info("pkt dropped", "user callback indicated DROPPED\n");
return;
end
drive_pkt_to_next_layer(pkt); // user task
on_exit_link_layer(pkt);
uvm_report_info(get_type_name(),"pkt is Exiting Link Layer",UVM_LOW);
endtask
endclass
End-User Use Model
The end-user simply needs to extend the callback base class, overriding any or all of the prototypes provided in the
developer-supplied callback interface. Then, register an instance of the callback class with any object designed to
use the base callback type.
class my_ll_cbs extends link_layer_cbs;
// override the callback methodes here.
Endclass
To avoid compilation issue due to the order of compilation, define the type of callback
typedef uvm_callbacks #(link_layer,link_layer_cbs) link_layer_cbs_t;
ADD/DELETE
INTEFACE
add
add_by_name
delete
delete_by_name
ITERATOR
INTERFACE
get_first
get_last
get_next
get_prev
DEBUG
display
uvm_callbacks methods
Registers the given callback object, cb, with the givenobj handle.
Eg: uvm_callbacks#(my_comp)::add(comp_a, cb);
Registers the given callback object, cb, with one or more uvm_components.
Deletes the given callback object, cb, from the queue associated with the given obj handle.
Eg: uvm_callbacks#(my_comp, my_callback)::delete(comp_a,cb);
Removes the given callback object, cb, associated with one or more uvm_component
callback queues.
This set of functions provide an iterator interface for callback queues.
Returns the first enabled callback of type CB which resides in the queue for obj.
Returns the last enabled callback of type CB which resides in the queue for obj.
Returns the next enabled callback of type CB which resides in the queue for obj, using itr as
the starting point.
Returns the previous enabled callback of type CB which resides in the queue for obj, using
itr as the starting point.
This function displays callback information for obj.
User Guidelines
=============
Create a callback implementation class which implements all of the pure virtual methods in the callback class.
Allocate a new callback object for each callback you add.
Sirajudheen Mubarak.E
siraj.mubarak@gmail.com