Difficulty: Medium · Puzzle 4 of 6 · Topic: Cross Coverage Puzzles
Compute final cross percentage when one tuple is explicitly ignored via intersect. Options: none set (all defaults: at_least = 1, weight = 1, auto_bin_max = 64).
covergroup cg with function sample(bit [1:0] cmd, bit [1:0] resp);
cp_cmd: coverpoint cmd {
bins c[] = {[0:3]};
}
cp_resp: coverpoint resp {
bins ok = {0};
bins retry = {1};
bins err = {2};
}
x_cmd_resp: cross cp_cmd, cp_resp {
ignore_bins cmd0_err = binsof(cp_cmd) intersect {0} && binsof(cp_resp.err);
}
endgroup
initial begin
cg c = new();
c.sample(0,0);
c.sample(1,1);
c.sample(2,2);
c.sample(3,0);
c.sample(0,2);
c.sample(1,2);
endAuto space is 4x3 before ignore. Then remove exactly one scored tuple.
1) Base auto cross bins = 4 * 3 = 12.
2) ignore_bins removes tuple (cmd=0,resp=err), so scored denominator = 11.
3) Hit scored tuples are (0,ok), (1,retry), (2,err), (3,ok), (1,err) -> 5 bins.
4) sample(0,2) is ignored and does not count.
5) Coverage = 5/11 = 45.45%.Answer: Scored bins = 11 and achieved coverage = 45.45%.
Checked by running a model of the rule in a Python model. A model of the cross rule: 12 tuples minus the one ignored leaves 11 scored, of which 5 are hit.
The sample (0,2) hits the ignored tuple cmd0_err, so it neither adds to the numerator nor stays in the denominator. Forgetting to shrink the denominator gives 5/12 = 41.67%; counting the ignored hit gives 6/11 = 54.55%.
How many additional unique scored tuples are needed to cross 80%? Model answer: 80% of 11 bins is 8.8, so 9 bins must be hit; 5 are hit already, so 4 more (8/11 = 72.73% is not enough).
I would take the full cross and subtract the ignored tuple, so the denominator is 11. Five bins are hit, which gives 45.45 percent. The sample on the ignored tuple cmd0_err is neither in the numerator nor in the denominator. The trap is forgetting to shrink the denominator, which gives 41.67 percent, or counting the ignored hit, which gives 54.55 percent.