In reply to SANJAIKUMAR:
Hi,
Can you tell me how to assign run_phase.get_objection to the uvm_callback_objection?
so that i can give the callback objection to the uvm_heartbeat new function.
Here is the code:
function void heartbeat(uvm_phase phase);
uvm_callbacks_objection cb = new("cb"); // CALLBACK OBJECTION
uvm_heartbeat hb; // HEARTBEAT COMPONENT
uvm_event e = new("e"); // UVM EVENT
uvm_component comps[$]; // LIST OF COMPONENT QUEUE
chip_timeout_catcher catcher; // TIMEOUT CATCHER
uvm_phase run_phase = phase.find_by_name("run",0);
catcher = chip_timeout_catcher :: type_id :: create("catcher",this);
catcher.m_run_phase = run_phase;
uvm_report_cb :: add(null, catcher);
if(!$cast(cb,run_phase.get_objection()))
`uvm_fatal("run_phase", $psprintf("run phase objection type isn't of type uvm_callbacks_objection. You need to define UVM_USE_CALLBACKS_OBJECTION_FOR_TEST_DONE!"));
//assert ($cast(cb,run_phase.get_objection()))
// else
// `uvm_fatal("run_phase", $psprintf("run phase objection type isn't of type uvm_callbacks_objection. You need to define UVM_USE_CALLBACKS_OBJECTION_FOR_TEST_DONE!"));
hb = new("activity_heartbeat",this,cb); // HEARTBEAT COMPONENT CREATION
uvm_top.find_all("*",comps,this);
hb.set_mode(UVM_ALL_ACTIVE);
hb.set_heartbeat(e, comps);
fork begin
forever begin
#`HEARTBEAT_TIMEOUT e.trigger();
`uvm_fatal("TEST LIBRARY","NO ACTIVITY IN THE CHIP")
end
end
join_none
endfunction : heartbeat
F.Y.I :
UVM1.2 updates the constructor of uvm_hearbeat to
function new(string name, uvm_component cntxt, uvm_objection objection=null);
// Typedef - Exists for backwards compat
typedef uvm_objection uvm_callbacks_objection;
//UVM1.1 function new(string name, uvm_component cntxt, uvm_callbacks_objection objection=null);
super.new(name);