Search the Community
Showing results for tags 'uvm_heartbeat'.
-
Hello, I am using the uvm_heartbeat object in my test bench and found that it always watches for all objection activity under the context component. By definition, it should only watch for the list of components registered to it. I found this when registering only one component to watch (my interrupt handler) and even after the component had no activity long after several heartbeat windows, a fatal HBFAIL message was not issued. Digging into the source code, I can see that the heartbeat keeps track of which components are registered by populating an associative array, like this: function void set_heartbeat (uvm_event e, ref uvm_component comps[$]); uvm_object c; foreach(comps[i]) begin c = comps[i]; if(!m_cb.cnt.exists(c)) // <-- This is the code to track... m_cb.cnt[c]=0; // <-- which components are registered if(!m_cb.last_trigger.exists(c)) m_cb.last_trigger[c]=0; end if(e==null && m_event==null) return; start(e); endfunction Skipping forward to the uvm_heartbeat_callback class, a counter is incremented every time a component raises or lowers an objection. When a component isn't found in the "cnt" associative array, it should have ignored it, but instead it sets a new index and sets the value to 0: virtual function void raised (uvm_objection objection, uvm_object obj, uvm_object source_obj, string description, int count); if(obj == target) begin if(!cnt.exists(source_obj)) cnt[source_obj] = 0; // <-- this is the bug cnt[source_obj] = cnt[source_obj]+1; // <-- BTW: isn't cnt[source_obj]++ faster? last_trigger[source_obj] = $realtime; end endfunction Instead, the code should have been written like this: virtual function void raised (uvm_objection objection, uvm_object obj, uvm_object source_obj, string description, int count); if(obj == target) begin if(!cnt.exists(source_obj)) return; // <-- bug fix cnt[source_obj]++; // <-- (seems like it should be faster) last_trigger[source_obj] = $realtime; end endfunction I have tried this change in my workspace and it works well. Thank you, David
-
Hi all, There are such codes in heartbeat class: virtual task run_phase(uvm_phase phase); uvm_callbacks_objection cb; uvm_heartbeat hb; uvm_event e; uvm_component comps[$]; if (heartbeat_window == 0) begin return; end e = new("e"); assert($cast(cb, phase.get_objection())) else `uvm_fatal("heartbeat", run_phase objection isn't the type of uvm_callbacks_objection. You need to define UVM_USE_CALLBACKS_OBJECTION_FOR_TEST_DONE!) hb = new(get_full_name(), m_context, cb); uvm_top.find_all("*", comps, m_context); hb.set_mode(UVM_ANY_ACTIVE); hb.set_heartbeat(e, comps); fork forever begin #heartbeat_window e.trigger(); end join_none endtask: run_phase The VCS always reports assertion fail even though I defined UVM_USE_CALLBACKS_OBJECTION_FOR_TEST_DONE in define.svh or in command line. The way of defining UVM_USE_CALLBACKS_OBJECTION_FOR_TEST_DONE: in define.svh `define UVM_USE_CALLBACKS_OBJECTION_FOR_TEST_DONE // For heartbeatin command line: VCS = vcs -sverilog -debug_all -picarchive -timescale=1ns/1ps \ +acc +vpi \ +define+UVM_OBJECT_MUST_HAVE_CONSTRUCTOR+UVM_USE_CALLBACKS_OBJECTION_FOR_TEST_DONE \ If I defined UVM_USE_CALLBACKS_OBJECTION_FOR_TEST_DONE, phase.get_objection() should return the uvm_callbacks_objection type and the assert should be successful, but it doesn't. Why? Thanks in advance!
-
Hi all, There are such codes in heartbeat class: virtual task run_phase(uvm_phase phase); uvm_callbacks_objection cb; uvm_heartbeat hb; uvm_event e; uvm_component comps[$]; if (heartbeat_window == 0) begin return; end e = new("e"); assert($cast(cb, phase.get_objection())) else `uvm_fatal("heartbeat", run_phase objection isn't the type of uvm_callbacks_objection. You need to define UVM_USE_CALLBACKS_OBJECTION_FOR_TEST_DONE!) hb = new(get_full_name(), m_context, cb); uvm_top.find_all("*", comps, m_context); hb.set_mode(UVM_ANY_ACTIVE); hb.set_heartbeat(e, comps); fork forever begin #heartbeat_window e.trigger(); end join_none endtask: run_phase The VCS always reports assertion fail even though I defined UVM_USE_CALLBACKS_OBJECTION_FOR_TEST_DONE in define.svh or in command line. The way of defining UVM_USE_CALLBACKS_OBJECTION_FOR_TEST_DONE: in define.svh `define UVM_USE_CALLBACKS_OBJECTION_FOR_TEST_DONE // For heartbeatin command line: VCS = vcs -sverilog -debug_all -picarchive -timescale=1ns/1ps \ +acc +vpi \ +define+UVM_OBJECT_MUST_HAVE_CONSTRUCTOR+UVM_USE_CALLBACKS_OBJECTION_FOR_TEST_DONE \ If I defined UVM_USE_CALLBACKS_OBJECTION_FOR_TEST_DONE, phase.get_objection() should return the uvm_callbacks_objection type and the assert should be successful, but it doesn't. Why? Thanks in advance!