it would be really helpfull to understand more if you share exact Error which you are getting.
However,few things are missing in above code
you need to create array/define array size before you new each cg instance. because when you say “skew_cg[i]” it doesnt know skew_cg is array or not!!
Last time when i tried to create array of cover-group and define cover-group inside class i was getting compilation issue as tool was not able to resolve the cover-group definition. thats why wrote cover-group outside class.
You cannot declare an array of an embedded covergroup - this is an LRM restriction because the covergroup declared in a class is an anonymous type and the covergroup name becomes the instance variable. (See 19.4 Using covergroup in classes in the 1800-2012 LRM) You need define the covergroup outside the class
covergroup skew_val_cg (ref int skew_val_vl); // note the use of a ref argument
coverpoint skew_val_vl {
bins skew_range_1 = {[124:0]};
bins skew_range_2 = {[325:125]};
bins skew_range_3 = {[526:326]};
bins skew_range_oor = {[1100:929]};
}
endgroup : skew_val_cg
class my_class extends uvm_component;
int skew_val_vl[20];
skew_val_cg sv_cg[20];
function new(string name, uvm_component parent = null);
super.new(name, parent);
foreach(sv_cg[i])
sv_cg[i] = new(skew_val_vl[i]);
endfunction
endclass
Hi Dave,
How about array of covergroup inside an interface?
I see it in apb_protocol_monitor_example (coverage cookbook) but when I try to compile code, an error is invoked:
APB_accesses_cg APB_protocol_cg[no_slaves];
|
ncvlog: *E,SVNOTY (../protocol_monitor/apb_monitor.sv,140|14): Syntactically this identifier appears to begin a datatype but it does not refer to a visible datatype in the current scope.
And this is the code in apb_monitor.sv:
// Functional Coverage for the APB transfers:
//
// Have we seen all possible PSELS activated?
// Have we seen reads/writes to all slaves?
// Have we seen good and bad PSLVERR results from all slaves?
covergroup APB_accesses_cg();
option.per_instance = 1;
RW: coverpoint PWRITE {
bins read = {0};
bins write = {1};
}
ERR: coverpoint PSLVERR {
bins err = {1};
bins ok = {0};
}
APB_CVR: cross RW, ERR;
endgroup: APB_accesses_cg
// Array of these covergroups
APB_accesses_cg APB_protocol_cg[no_slaves];
Hi everyone,
Thanks for your quick replies.
Create a wrapper class for covergroup solved the issue. But it seems that array of covergroup could not be declared inside an interface, or possibly it is the difference between Cadence IUS and Mentor ModelSim.
Thanks,
When i instantiate an array of covergroup inside an interface it says “Syntactically this identifier appears to begin a datatype but it does not refer to a visible datatype in the current scope.”
task test();
foreach(sv_cg[i]) begin
skew_val_vl[i] = 100*i;
sv_cg[i].sample();
end
endtask
and called it for an instance of the class.
When I run vcover report -details <filename.ucdb>, I get 100% result. I also added “option.per_instance=1” to the covergroup definition. Can you tell me, how do I produce overall numbers to accurately reflect my instance coverage?
Can you please give little hint, how the class will recognise the “skew_val_cg” covergroup.
In my case the class is not recognising the covergroup name.