I am facing this type of fatal error, code as below
function void write (apb_master_items t);
item_h=t;
And I am sampling in scoreboard file like,
Cov_h.cg_apb.sample(item_h.PRESETn, item_h.PCLK, item_h.PWRITE, item_h.PADDR, item_h.PWDATA, item_h. PRDATA);
I have created item_h file also
Fatal - bad handle or reference
Fatal: Trouble with simulation kernel.
I can’t understand how to solve this error, kindly help to solve this fatal error.
check whether for cov_h & cg_apb whether the instance is created.
Regards,
Shanthi
In reply to shanthi :
check whether for cov_h & cg_apb whether the instance is created.
Regards,
Shanthi
Thanks for reply,
Yes, I have created both instances.
cgales
August 29, 2020, 11:48am
4
In reply to CHANDANI B KUKADIA :
Please post a complete example which demonstrates your error so we can give better advice.
cgales
August 29, 2020, 11:31pm
5
In reply to CHANDANI B KUKADIA :
Your coverage class ‘apb_coverage’ is a uvm_subscriber. You want to call sample() as part of your write() function, where it will sample the transaction written to the class. You don’t want to call sample() from outside of this class.
In reply to cgales :
In reply to CHANDANI B KUKADIA :
Your coverage class ‘apb_coverage’ is a uvm_subscriber. You want to call sample() as part of your write() function, where it will sample the transaction written to the class. You don’t want to call sample() from outside of this class.
Thanks for reply, but I can’t understand. Can you please elaborate it or send a sample code whatever you are trying to say?
cgales
August 30, 2020, 11:24am
7
In reply to CHANDANI B KUKADIA :
class apb_coverage extends uvm_subscriber #(apb_master_items);
//factory registration
`uvm_component_utils(apb_coverage
covergroup cg_apb (ref apb_master_items item);
option.name = "cg_apb";
option.per_instance=1; //track coverage for each instance
APB_WRITE : coverpoint item.PWRITE iff (item.PRESETn==0) {bins reset = (0=>1=>0);}
APB_ADDR : coverpoint item.PADDR {bins low_addr = (0=>2[->50]=>350);
bins med_addr = {355, 610, 700, 750, 855, 899};
bins high_addr = {[900:$]};
bins rest_of_PADDR = default;}
//{option.auto_bin_max = 256; // the automatically created bins are controlled by auto_bin_max // The identifier option is built-in member of any cov. group
//wildcard bins addr1 = (3'b1x0 => 3'bx00);}
APB_WRITE_DATA : coverpoint item.PWDATA {bins low_wdata = (0=>2[->55]=>249);
bins med_wdata = {250, 355, 400, 450, 500};
bins high_wdata = {[502:$]};
//ignore_bins ig_pwdata = {[1:$]};}
bins rest_of_PWDATA = default;}
APB_READ : coverpoint item.PRDATA iff (item.PRESETn==0) {bins rst = (0=>1=>0);}
APB_READ_DATA : coverpoint item.PRDATA {bins low_rdata = {11, 55, 100, 151, 215, 250};
bins med_rdata = (251=>2[->301]=>501);
bins high_rdata = {[502:$]};
bins rest_of_PRDATA = default;}
endgroup:cg_apb
function new (string name = "apb_coverage", uvm_component parent);
super.new(name,parent);
item_h = new();
cg_apb = new(item_h);
endfunction:new
function void write(apb_master_items t);
item_h=t;
cg_apb.sample(item_h);
endfunction:write
virtual function void report_phase(uvm_phase phase);
`uvm_info("apb_coverage",$sformatf("\n\n\t functional_coverage=%2.2f%%\n",cg_apb.get_inst_coverage),UVM_LOW)
endfunction:report_phase
endclass
I haven’t run this code, so there may be errors, but this is the general methodology to use.
In reply to cgales :
Thanks for help. It has error in ref keyword, but I will try to solve it.
cgales
August 30, 2020, 3:43pm
9
In reply to CHANDANI B KUKADIA :
The ‘ref’ should be inside the parenthesis. I fixed it above.