www.testbench.in Posted August 24, 2010 Report Share Posted August 24, 2010 In Normal verification, I print a message for every 1000 clock cycles, to see if simulation really running. Any API to do this in UVM ? Quote Link to comment Share on other sites More sharing options...
uwes Posted August 24, 2010 Report Share Posted August 24, 2010 hi, there is no direct API in UVM for doing this. however you can use alternate facilities to address your primary concern. as far as i understand your primary concern is that you want to be "notified" if there is no progress with your simulation. to do that with UVM you might want to look at heartbeat feature of the objection subset. The heartbeat feature requires to send a notification to the heartbeat object within a defined time window. if the trigger is missing a simulation stop is being generated. so to some extend its not showing the progress - its rather a safeguard to prevent the simualtion from stalling. attached is an example of that (this example is part of the uvm developer source kit, see uvm-10ea/tests/02objections/91heartbeat/*) regards /uwe module test; import uvm_pkg::*; `include "uvm_macros.svh" class my_catcher extends uvm_report_catcher; int id_cnt; int client_cnt[uvm_report_object]; uvm_component c; virtual function action_e catch(); if(get_id()!="HBFAIL") return THROW; $display("MSG: %s", get_message()); id_cnt++; if(!client_cnt.exists(get_client())) client_cnt[get_client()] = 0; client_cnt[get_client()]++; return CAUGHT; endfunction endclass uvm_objection myobj = new("myobj"); class mycomp extends uvm_component; time del; function new(string name, uvm_component parent); super.new(name,parent); endfunction task run; repeat(10) #del myobj.raise_objection(this); endtask endclass class myagent extends uvm_component; mycomp mc1, mc2; function new(string name, uvm_component parent); super.new(name,parent); mc1 = new("mc1", this); mc2 = new("mc2", this); mc1.del = 45; mc2.del = 55; endfunction endclass class myenv extends uvm_component; uvm_heartbeat hb; myagent agent; function new(string name, uvm_component parent); super.new(name,parent); agent = new("agent", this); hb = new("myhb", this, myobj); hb.add(agent.mc1); hb.add(agent.mc2); endfunction task run; uvm_event e = new("e"); hb.start(e); fork repeat(11) #60 e.trigger(); #550 hb.remove(agent.mc1); join uvm_top.stop_request(); endtask endclass class test extends uvm_test; myenv env; my_catcher mc; `uvm_component_utils(test) function new(string name, uvm_component parent); super.new(name,parent); env = new("env", this); mc = new; uvm_report_cb::add(null,mc); endfunction function void report; uvm_report_object r; if(mc.id_cnt != 2) begin $display("** UVM TEST FAILED **"); return; end if(mc.client_cnt.num() != 1) begin $display("** UVM TEST FAILED **"); return; end r = env; if(mc.client_cnt[r] != 2) begin $display("** UVM TEST FAILED **"); return; end if($time != 660) begin $display("** UVM TEST FAILED **"); return; end $display("** UVM TEST PASSED **"); endfunction endclass initial run_test(); endmodule Quote Link to comment Share on other sites More sharing options...
SeanChou Posted January 13, 2011 Report Share Posted January 13, 2011 uwes, This is a very good example to illsustrate not only heartbeat but also report_catcher, strongly suggest to collect it into the examples in the UVM package. (I searched uvm_heartbeat then being led here after giving up finding example in uvm-ea packages.) Thanks you so much! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.