// 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.virtualfunctionvoidadd_callback(uvm_event_callback#(T)cb,bitappend=1);for(inti=0;i<callbacks.size();i++)beginif(cb==callbacks[i])beginuvm_report_warning("CBRGED","add_callback: Callback already registered. Ignoring.",UVM_NONE);return;endendif(append)callbacks.push_back(cb);elsecallbacks.push_front(cb);endfunction// Function: delete_callback//// Unregisters the given callback, ~cb~, from this event. virtualfunctionvoiddelete_callback(uvm_event_callback#(T)cb);for(inti=0;i<callbacks.size();i++)beginif(cb==callbacks[i])begincallbacks.delete(i);return;endenduvm_report_warning("CBNTFD","delete_callback: Callback not found. Ignoring delete request.",UVM_NONE);endfunctionvirtualfunctionvoiddo_print(uvm_printerprinter);`ifdefUVM_EVENT_CALLBACK_FIXuvm_objecttmp_object;`endifsuper.do_print(printer);
////------------------------------------------------------------------------------virtualclassuvm_event_callback#(typeT=uvm_object)extendsuvm_object;// Function: new//// Creates a new callback object.functionnew(stringname="");super.new(name);endfunction// Function: pre_trigger//// This callback is called just before triggering the associated event.// In a derived class, override this method to implement any pre-trigger// functionality.
//------------------------------------------------------------------------------// @uvm-ieee 1800.2-2020 auto 10.2.1virtualclassuvm_event_callback#(typeT=uvm_object)extendsuvm_callback;// Function -- NODOCS -- new//// Creates a new callback object.// @uvm-ieee 1800.2-2020 auto 10.2.2.1functionnew(stringname="");super.new(name);endfunction// Function -- NODOCS -- pre_trigger//// This callback is called just before triggering the associated event.// In a derived class, override this method to implement any pre-trigger
classuvm_event#(typeT=uvm_object)extendsuvm_event_base;typedefuvm_event#(T)this_type;typedefuvm_event_callback#(T)cb_type;// Type: cbs_type// Callback typedef for this event type.//// | typedef uvm_callbacks#(this_type, cb_type) cbs_type;// @uvm-contrib Potential Contribution to 1800.2typedefuvm_callbacks#(this_type,cb_type)cbs_type;// Not using `uvm_register_cb(this_type, cb_type)// so as to try and get ~slightly~ better debug// output for names.staticlocalfunctionbitm_register_cb();returnuvm_callbacks#(this_type,cb_type)::m_register_pair("uvm_pkg::uvm_event#(T)","uvm_pkg::uvm_event_callback#(T)");endfunction:m_register_cbstaticlocalbitm_cb_registered=m_register_cb();