Close code coverage and ensure all errors are exercised
Signed-off-by: Matthew Ballance <matt.ballance@gmail.com>
This commit is contained in:
parent
1d4e224ea7
commit
5d55719e56
|
|
@ -16,3 +16,13 @@ cg4.cp.all_vals[2]: 1
|
||||||
cg4.cp.all_vals[3]: 0
|
cg4.cp.all_vals[3]: 0
|
||||||
cg5.cp.hi_vals[0]: 1
|
cg5.cp.hi_vals[0]: 1
|
||||||
cg5.cp.hi_vals[1]: 0
|
cg5.cp.hi_vals[1]: 0
|
||||||
|
cg6.cp.lo_open[0]: 1
|
||||||
|
cg6.cp.lo_open[1]: 0
|
||||||
|
cg7.cp.rev[0]: 1
|
||||||
|
cg7.cp.rev[1]: 0
|
||||||
|
cg8.cp.w[0]: 0
|
||||||
|
cg8.cp.w[1]: 1
|
||||||
|
cg9.__cross7.cumulative_x_lo [cross]: 1
|
||||||
|
cg9.__cross7.ok_x_lo [cross]: 1
|
||||||
|
cg9.cpA.ok: 1
|
||||||
|
cg9.cpB.lo: 1
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,7 @@
|
||||||
module t;
|
module t;
|
||||||
bit [7:0] data;
|
bit [7:0] data;
|
||||||
bit [1:0] sel;
|
bit [1:0] sel;
|
||||||
|
bit [63:0] wide;
|
||||||
|
|
||||||
covergroup cg;
|
covergroup cg;
|
||||||
coverpoint data {
|
coverpoint data {
|
||||||
|
|
@ -54,18 +55,64 @@ module t;
|
||||||
}
|
}
|
||||||
endgroup
|
endgroup
|
||||||
|
|
||||||
|
// cg6: upper-open range {[$:hi]} == {[0:hi]} -> bins for 0 and 1
|
||||||
|
covergroup cg6;
|
||||||
|
cp: coverpoint sel {
|
||||||
|
bins lo_open[] = {[$ : 1]};
|
||||||
|
}
|
||||||
|
endgroup
|
||||||
|
|
||||||
|
// cg7: a reversed range {[hi:lo]} (hi<lo) contributes no bins; the plain
|
||||||
|
// values 5 and 7 each create one bin -> 2 bins total.
|
||||||
|
covergroup cg7;
|
||||||
|
cp: coverpoint data {
|
||||||
|
bins rev[] = {[3 : 1], 5, 7};
|
||||||
|
}
|
||||||
|
endgroup
|
||||||
|
|
||||||
|
// cg8: wide (>= 64-bit) coverpoint, exercising the 64-bit domain-max path
|
||||||
|
covergroup cg8;
|
||||||
|
cp: coverpoint wide {
|
||||||
|
bins w[] = {[0 : 1]};
|
||||||
|
}
|
||||||
|
endgroup
|
||||||
|
|
||||||
|
// cg9: two ranges that are each under COVER_BINS_LIMIT (1000) but whose
|
||||||
|
// cumulative size exceeds it. The first range populates the value list, the
|
||||||
|
// second trips the running-total guard -> COVERIGN, the whole bin is ignored.
|
||||||
|
// cpA is crossed, so it is non-convertible and routes through the legacy
|
||||||
|
// per-bin generateArrayBins() path (exercising its unsupported-bin guard).
|
||||||
|
covergroup cg9;
|
||||||
|
cpA: coverpoint wide {
|
||||||
|
bins cumulative[] = {[0 : 500], [0 : 500]};
|
||||||
|
bins ok = {5};
|
||||||
|
}
|
||||||
|
cpB: coverpoint sel {
|
||||||
|
bins lo = {1};
|
||||||
|
}
|
||||||
|
cross cpA, cpB;
|
||||||
|
endgroup
|
||||||
|
|
||||||
initial begin
|
initial begin
|
||||||
cg cg_inst;
|
cg cg_inst;
|
||||||
cg2 cg2_inst;
|
cg2 cg2_inst;
|
||||||
cg3 cg3_inst;
|
cg3 cg3_inst;
|
||||||
cg4 cg4_inst;
|
cg4 cg4_inst;
|
||||||
cg5 cg5_inst;
|
cg5 cg5_inst;
|
||||||
|
cg6 cg6_inst;
|
||||||
|
cg7 cg7_inst;
|
||||||
|
cg8 cg8_inst;
|
||||||
|
cg9 cg9_inst;
|
||||||
|
|
||||||
cg_inst = new();
|
cg_inst = new();
|
||||||
cg2_inst = new();
|
cg2_inst = new();
|
||||||
cg3_inst = new();
|
cg3_inst = new();
|
||||||
cg4_inst = new();
|
cg4_inst = new();
|
||||||
cg5_inst = new();
|
cg5_inst = new();
|
||||||
|
cg6_inst = new();
|
||||||
|
cg7_inst = new();
|
||||||
|
cg8_inst = new();
|
||||||
|
cg9_inst = new();
|
||||||
|
|
||||||
// Hit first array bin value (1)
|
// Hit first array bin value (1)
|
||||||
data = 1;
|
data = 1;
|
||||||
|
|
@ -130,6 +177,26 @@ module t;
|
||||||
cg5_inst.sample();
|
cg5_inst.sample();
|
||||||
`checkr(cg5_inst.get_inst_coverage(), 50.0);
|
`checkr(cg5_inst.get_inst_coverage(), 50.0);
|
||||||
|
|
||||||
|
// Hit cg6 upper-open bins ([$:1] == [0:1], 2 bins): cover 1 of 2
|
||||||
|
sel = 0;
|
||||||
|
cg6_inst.sample();
|
||||||
|
`checkr(cg6_inst.get_inst_coverage(), 50.0);
|
||||||
|
|
||||||
|
// Hit cg7 bins (reversed [3:1] -> no bins; 5 and 7 -> 2 bins): cover 1 of 2
|
||||||
|
data = 5;
|
||||||
|
cg7_inst.sample();
|
||||||
|
`checkr(cg7_inst.get_inst_coverage(), 50.0);
|
||||||
|
|
||||||
|
// Hit cg8 wide bins ([0:1], 2 bins): cover 1 of 2
|
||||||
|
wide = 1;
|
||||||
|
cg8_inst.sample();
|
||||||
|
`checkr(cg8_inst.get_inst_coverage(), 50.0);
|
||||||
|
|
||||||
|
// Exercise cg9 (crossed cpA with an ignored cumulative array bin, legacy path)
|
||||||
|
wide = 5;
|
||||||
|
sel = 1;
|
||||||
|
cg9_inst.sample();
|
||||||
|
|
||||||
$write("*-* All Finished *-*\n");
|
$write("*-* All Finished *-*\n");
|
||||||
$finish;
|
$finish;
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -1,76 +1,88 @@
|
||||||
%Error: t/t_covergroup_autobins_bad.v:17:12: Automatic bins array size must be a constant
|
%Error: t/t_covergroup_autobins_bad.v:18:12: Automatic bins array size must be a constant
|
||||||
: ... note: In instance 't'
|
: ... note: In instance 't'
|
||||||
17 | bins auto[size_var];
|
18 | bins auto[size_var];
|
||||||
| ^~~~
|
| ^~~~
|
||||||
... See the manual at https://verilator.org/verilator_doc.html?v=latest for more assistance.
|
... See the manual at https://verilator.org/verilator_doc.html?v=latest for more assistance.
|
||||||
%Error: t/t_covergroup_autobins_bad.v:24:12: Automatic bins array size must be >= 1, got 0
|
%Error: t/t_covergroup_autobins_bad.v:25:12: Automatic bins array size must be >= 1, got 0
|
||||||
: ... note: In instance 't'
|
: ... note: In instance 't'
|
||||||
24 | bins auto[0];
|
25 | bins auto[0];
|
||||||
| ^~~~
|
| ^~~~
|
||||||
%Error: t/t_covergroup_autobins_bad.v:31:12: Automatic bins array size of 1001 exceeds limit of 1000
|
%Error: t/t_covergroup_autobins_bad.v:32:12: Automatic bins array size of 1001 exceeds limit of 1000
|
||||||
: ... note: In instance 't'
|
: ... note: In instance 't'
|
||||||
31 | bins auto[1001];
|
32 | bins auto[1001];
|
||||||
| ^~~~
|
| ^~~~
|
||||||
%Error: t/t_covergroup_autobins_bad.v:43:26: Non-constant expression in bin value list; values must be constants
|
%Error: t/t_covergroup_autobins_bad.v:44:26: Non-constant expression in bin value list; values must be constants
|
||||||
: ... note: In instance 't'
|
: ... note: In instance 't'
|
||||||
43 | ignore_bins ign = {size_var};
|
44 | ignore_bins ign = {size_var};
|
||||||
| ^~~~~~~~
|
| ^~~~~~~~
|
||||||
%Error: t/t_covergroup_autobins_bad.v:44:32: Non-constant expression in bin range; range bounds must be constants
|
%Error: t/t_covergroup_autobins_bad.v:45:32: Non-constant expression in bin range; range bounds must be constants
|
||||||
: ... note: In instance 't'
|
: ... note: In instance 't'
|
||||||
44 | ignore_bins ign_range = {[0:size_var]};
|
45 | ignore_bins ign_range = {[0:size_var]};
|
||||||
| ^
|
| ^
|
||||||
%Error: t/t_covergroup_autobins_bad.v:38:12: Non-constant expression in array bins range; range bounds must be constants
|
|
||||||
: ... note: In instance 't'
|
|
||||||
38 | bins b[] = {[size_var:size_var]};
|
|
||||||
| ^
|
|
||||||
%Error: t/t_covergroup_autobins_bad.v:39:12: Non-constant expression in array bins range; range bounds must be constants
|
%Error: t/t_covergroup_autobins_bad.v:39:12: Non-constant expression in array bins range; range bounds must be constants
|
||||||
: ... note: In instance 't'
|
: ... note: In instance 't'
|
||||||
39 | bins b_mixed[] = {[0:size_var]};
|
39 | bins b[] = {[size_var:size_var]};
|
||||||
|
| ^
|
||||||
|
%Error: t/t_covergroup_autobins_bad.v:40:12: Non-constant expression in array bins range; range bounds must be constants
|
||||||
|
: ... note: In instance 't'
|
||||||
|
40 | bins b_mixed[] = {[0:size_var]};
|
||||||
| ^~~~~~~
|
| ^~~~~~~
|
||||||
%Error: t/t_covergroup_autobins_bad.v:40:23: Non-constant expression in bin range; range bounds must be constants
|
%Error: t/t_covergroup_autobins_bad.v:41:23: Non-constant expression in bin range; range bounds must be constants
|
||||||
: ... note: In instance 't'
|
: ... note: In instance 't'
|
||||||
40 | bins b_range = {[size_var:4]};
|
41 | bins b_range = {[size_var:4]};
|
||||||
| ^
|
| ^
|
||||||
%Error: t/t_covergroup_autobins_bad.v:41:24: Non-constant expression in bin range; range bounds must be constants
|
%Error: t/t_covergroup_autobins_bad.v:42:24: Non-constant expression in bin range; range bounds must be constants
|
||||||
: ... note: In instance 't'
|
: ... note: In instance 't'
|
||||||
41 | bins b_range2 = {[0:size_var]};
|
42 | bins b_range2 = {[0:size_var]};
|
||||||
| ^
|
| ^
|
||||||
%Error: t/t_covergroup_autobins_bad.v:42:18: Non-constant expression in bin range; values must be constants
|
%Error: t/t_covergroup_autobins_bad.v:43:18: Non-constant expression in bin range; values must be constants
|
||||||
: ... note: In instance 't'
|
: ... note: In instance 't'
|
||||||
42 | bins b2 = {size_var};
|
43 | bins b2 = {size_var};
|
||||||
| ^~~~~~~~
|
| ^~~~~~~~
|
||||||
%Error: t/t_covergroup_autobins_bad.v:43:26: Non-constant expression in bin range; values must be constants
|
%Error: t/t_covergroup_autobins_bad.v:44:26: Non-constant expression in bin range; values must be constants
|
||||||
: ... note: In instance 't'
|
: ... note: In instance 't'
|
||||||
43 | ignore_bins ign = {size_var};
|
44 | ignore_bins ign = {size_var};
|
||||||
| ^~~~~~~~
|
| ^~~~~~~~
|
||||||
%Warning-COVERIGN: t/t_covergroup_autobins_bad.v:51:25: Ignoring unsupported: non-constant 'option.at_least'; using default value
|
%Warning-COVERIGN: t/t_covergroup_autobins_bad.v:52:25: Ignoring unsupported: non-constant 'option.at_least'; using default value
|
||||||
: ... note: In instance 't'
|
: ... note: In instance 't'
|
||||||
51 | option.at_least = size_var;
|
52 | option.at_least = size_var;
|
||||||
| ^~~~~~~~
|
| ^~~~~~~~
|
||||||
... For warning description see https://verilator.org/warn/COVERIGN?v=latest
|
... For warning description see https://verilator.org/warn/COVERIGN?v=latest
|
||||||
... Use "/* verilator lint_off COVERIGN */" and lint_on around source to disable this message.
|
... Use "/* verilator lint_off COVERIGN */" and lint_on around source to disable this message.
|
||||||
%Error: t/t_covergroup_autobins_bad.v:61:31: Non-constant expression in bin range; range bounds must be constants
|
%Error: t/t_covergroup_autobins_bad.v:62:31: Non-constant expression in bin range; range bounds must be constants
|
||||||
: ... note: In instance 't'
|
: ... note: In instance 't'
|
||||||
61 | ignore_bins ign_nclo = {[size_var:4]};
|
62 | ignore_bins ign_nclo = {[size_var:4]};
|
||||||
| ^
|
| ^
|
||||||
%Error: t/t_covergroup_autobins_bad.v:58:20: Four-state (x/z) value in bin range bound; range bounds must be two-state constants
|
%Error: t/t_covergroup_autobins_bad.v:59:20: Four-state (x/z) value in bin range bound; range bounds must be two-state constants
|
||||||
: ... note: In instance 't'
|
: ... note: In instance 't'
|
||||||
58 | bins b_xz = {[4'bxxxx:4'hF]};
|
59 | bins b_xz = {[4'bxxxx:4'hF]};
|
||||||
| ^
|
| ^
|
||||||
%Error: t/t_covergroup_autobins_bad.v:59:32: Four-state (x/z) value in bin range bound; range bounds must be two-state constants
|
|
||||||
: ... note: In instance 't'
|
|
||||||
59 | ignore_bins ign_xz_lo = {[4'bxxxx:4'hF]};
|
|
||||||
| ^
|
|
||||||
%Error: t/t_covergroup_autobins_bad.v:60:32: Four-state (x/z) value in bin range bound; range bounds must be two-state constants
|
%Error: t/t_covergroup_autobins_bad.v:60:32: Four-state (x/z) value in bin range bound; range bounds must be two-state constants
|
||||||
: ... note: In instance 't'
|
: ... note: In instance 't'
|
||||||
60 | ignore_bins ign_xz_hi = {[4'h0:4'bzzzz]};
|
60 | ignore_bins ign_xz_lo = {[4'bxxxx:4'hF]};
|
||||||
| ^
|
| ^
|
||||||
%Error: t/t_covergroup_autobins_bad.v:62:23: Non-constant expression in bin range; range bounds must be constants
|
%Error: t/t_covergroup_autobins_bad.v:61:32: Four-state (x/z) value in bin range bound; range bounds must be two-state constants
|
||||||
: ... note: In instance 't'
|
: ... note: In instance 't'
|
||||||
62 | bins b_nc_ub = {[size_var:$]};
|
61 | ignore_bins ign_xz_hi = {[4'h0:4'bzzzz]};
|
||||||
| ^
|
| ^
|
||||||
%Error: t/t_covergroup_autobins_bad.v:63:23: Four-state (x/z) value in bin range bound; range bounds must be two-state constants
|
%Error: t/t_covergroup_autobins_bad.v:63:23: Non-constant expression in bin range; range bounds must be constants
|
||||||
: ... note: In instance 't'
|
: ... note: In instance 't'
|
||||||
63 | bins b_xz_ub = {[4'bxxxx:$]};
|
63 | bins b_nc_ub = {[size_var:$]};
|
||||||
| ^
|
| ^
|
||||||
|
%Error: t/t_covergroup_autobins_bad.v:64:23: Four-state (x/z) value in bin range bound; range bounds must be two-state constants
|
||||||
|
: ... note: In instance 't'
|
||||||
|
64 | bins b_xz_ub = {[4'bxxxx:$]};
|
||||||
|
| ^
|
||||||
|
%Error: t/t_covergroup_autobins_bad.v:65:12: Four-state (x/z) value in array bins range bound; range bounds must be two-state constants
|
||||||
|
: ... note: In instance 't'
|
||||||
|
65 | bins b_xz_arr[] = {[4'bxxxx:4'hF]};
|
||||||
|
| ^~~~~~~~
|
||||||
|
%Error: t/t_covergroup_autobins_bad.v:66:12: Four-state (x/z) value in array bins range bound; range bounds must be two-state constants
|
||||||
|
: ... note: In instance 't'
|
||||||
|
66 | bins b_xz_arr_hi[] = {[4'h0:4'bzzzz]};
|
||||||
|
| ^~~~~~~~~~~
|
||||||
|
%Warning-COVERIGN: t/t_covergroup_autobins_bad.v:73:12: Unsupported: array 'bins' covering more than 1000 values (e.g. an open '[lo:$]' range over a wide coverpoint); bin ignored
|
||||||
|
: ... note: In instance 't'
|
||||||
|
73 | bins b_huge[] = {[0:$]};
|
||||||
|
| ^~~~~~
|
||||||
%Error: Exiting due to
|
%Error: Exiting due to
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,7 @@
|
||||||
module t;
|
module t;
|
||||||
int size_var;
|
int size_var;
|
||||||
logic [3:0] cp_expr;
|
logic [3:0] cp_expr;
|
||||||
|
logic [15:0] cp_wide;
|
||||||
|
|
||||||
// Error: array size must be a constant
|
// Error: array size must be a constant
|
||||||
covergroup cg1;
|
covergroup cg1;
|
||||||
|
|
@ -61,6 +62,15 @@ module t;
|
||||||
ignore_bins ign_nclo = {[size_var:4]}; // non-constant lower bound
|
ignore_bins ign_nclo = {[size_var:4]}; // non-constant lower bound
|
||||||
bins b_nc_ub = {[size_var:$]}; // non-constant lower bound, open-ended '$' upper
|
bins b_nc_ub = {[size_var:$]}; // non-constant lower bound, open-ended '$' upper
|
||||||
bins b_xz_ub = {[4'bxxxx:$]}; // four-state lower bound, open-ended '$' upper
|
bins b_xz_ub = {[4'bxxxx:$]}; // four-state lower bound, open-ended '$' upper
|
||||||
|
bins b_xz_arr[] = {[4'bxxxx:4'hF]}; // four-state lower bound (array-bins path)
|
||||||
|
bins b_xz_arr_hi[] = {[4'h0:4'bzzzz]}; // four-state upper bound (array-bins path)
|
||||||
|
}
|
||||||
|
endgroup
|
||||||
|
|
||||||
|
// Warning (COVERIGN): array bins range exceeds COVER_BINS_LIMIT
|
||||||
|
covergroup cg6;
|
||||||
|
cp1: coverpoint cp_wide {
|
||||||
|
bins b_huge[] = {[0:$]}; // open '[lo:$]' over 16-bit coverpoint exceeds bin limit
|
||||||
}
|
}
|
||||||
endgroup
|
endgroup
|
||||||
|
|
||||||
|
|
@ -70,6 +80,7 @@ module t;
|
||||||
cg3 cg3_inst = new;
|
cg3 cg3_inst = new;
|
||||||
cg4 cg4_inst = new;
|
cg4 cg4_inst = new;
|
||||||
cg5 cg5_inst = new;
|
cg5 cg5_inst = new;
|
||||||
|
cg6 cg6_inst = new;
|
||||||
|
|
||||||
initial $finish;
|
initial $finish;
|
||||||
endmodule
|
endmodule
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue