Reputation: 73
I got the following covergroup implemented:
covergroup my_covergroup_cg (input string name);
enable_reg_cp : coverpoint enabled_reg[PARAM1-1:0] {
illegal_bins no_enable = {0};
}
feature_active_reg_cp : coverpoint feature_active_reg_mask[PARAM2-1:0] { // Interested in covering a PARAM2-width chunk of a 32-bit feature_active_reg
illegal_bins all_features_active = {'1}; // We must not activate all features (1 bit = 1 feature active)
}
my_covergroup_cross : cross enable_reg_cp , feature_active_reg_cp {
illegal_bins il0 = (binsof (enable_reg_cp) intersect {0});
illegal_bins il1 = (binsof (feature_active_reg_cp) intersect {'1});
}
endgroup : my_covergroup_cg
Upon execution, the "il1" illegal bin of my cross gets hit with a value "0x1" of the feature_active_reg_mask[PARAM2-1:0] - which is completly legal and does not match the {'1} (equivalent to ..111111 : all ones).
Is there a particular issue of how these {'1} are treated in the "binsof" scope ?
Upvotes: 0
Views: 1114
Reputation: 73
Just to share my workaround for knowledge share:
I have decided to go with using localparam
semantic. As it appears the issue is related to the tool interpreting the {'1}
.
I did the following:
localparam all_ones = {PARAM2{1'b1}};
covergroup my_covergroup_cg (input string name);
enable_reg_c .... // rest of code
and I passed the alias into my illegal_bins
illegal_bins il1 = (binsof (feature_active_reg_cp) intersect {all_ones});
Cheers,
Upvotes: 0
Reputation: 42738
This is most likley a tool issue. According to section 19.5.7 Value resolution in the 1800-20167 LRM, All bin expression get evaluated in the context of the coverpoint type. You can use [$:$]
as an alternative that represents the largest possible value.
BUT... the illegal_bins
in the cross
is unnecessary because only the included bins of a coverpoint get crossed. AND... one you define an explicit set of bins, there are no implicitly defined bins, so you should write this as
covergroup my_covergroup_cg (input string name);
enable_reg_cp : coverpoint enabled_reg[PARAM1-1:0] {
bins enable[] = {[1:$]}; // will be split into N bins according to auto_bins_max
}
feature_active_reg_cp : coverpoint feature_active_reg_mask[PARAM2-1:0] { // Interested in covering a PARAM2-width chunk of a 32-bit feature_active_reg
bins some_features_active = {[0:$]};
ignore_bins all_features_active = {[$:$]}; // We must not activate all features (1 bit = 1 feature active)
}
my_covergroup_cross : cross enable_reg_cp , feature_active_reg_cp;
endgroup : my_covergroup_cg
In the 2nd coverpoint, the $ value overlaps the two bin specifications, but the ignore_bins
overrides that.
Upvotes: 1