I have following code for covergroup inside a class:
class wdt_apb_trans extends apb_trans;
rand TransType tr_type;
covergroup apb_extra_cov; // line number 21
coverpoint tr_type;
endgroup
function new;
this.apb_extra_cov = new();
endfunction
endclass
Now during simulation I am getting following warning
ncsim: W,COVDCG: (File: /**/_trans.sv, Line: 21):(Time: 363242 NS + 4) Covergroup instance (worklib.WdtPkg::wdt_apb_trans::apb_extra_cov@5841), is garbage collected. Its instance coverage will not be reported separately and instead accumulated into corresponding type-coverage (WdtPkg.wdt_apb_trans::apb_extra_cov).
Can somebody please tell me how o get this working without above warning ?
Thanks,
In reply to MonaliDeshmukh:
Hi Monali,
You may be creating wdt_apb_trans transaction multiple times, if you want to get separate coverage reports for each instance, use per_instance option,
covergroup apb_extra_cov;
// Separate report for each instance
option.per_instance = 1;
coverpoint tr_type;
endgroup
In reply to mayurkubavat:
Hi Mayur,
Thanks for reply.
I have tried to set per_instance ( option.per_instance = 1;) but still I am getting same warning
In reply to MonaliDeshmukh:
Use “nchelp ncsim COVDCG” for more information on warning.
For the snippet I’m unable to simulate the warning.
covergroup cg ;
...
endgroup
cg cg_inst1 = new ;
cg cg_inst2 = new ;
initial begin
#5 cg_inst1 = null; // warning will be thrown
#5 cg_inst2 = null; // warning will not be thrown
end
In reply to mayurkubavat:
This warning should be ok but I didn’t understand actual cause of this warning.
Here is my code
File 1: —
typedef enum {VAL_RD, VALA_RD, LD_RD, CLRI_WR_CCCC, CLRI_WR_OTHER, MISC} TransType;
class wdt_apb_trans extends apb_trans;
rand TransType tr_type;
covergroup apb_extra_cov; // line number 21
coverpoint tr_type;
endgroup
function new;
this.apb_extra_cov = new();
endfunction
endclass
file 2 :-- Cover group is sampled in this class
class wdt_irq_seq extends apb_sequence;
`uvm_object_utils(wdt_irq_seq)
function new (string name = “wdt”);
super.new(name);
endfunction
virtual task extra_traffic;
forever begin
wdt_apb_trans tr = new();
tr.apb_extra_cov.sample();
endtask
endclass
In reply to MonaliDeshmukh:
The problem might be here,
virtual task extra_traffic;
forever begin
wdt_apb_trans tr = new();
tr.apb_extra_cov.sample();
//..
end
endtask
When creating covergroup in a forever loop, each time when new class object is constructed, previous object/covergroup will be deallocated. And according to help option, tool will only warn first time.
I think moving covergroup from class to module or creating it only once(for e.g, have separated subscriber object to implement covergroup) will remove the warning.