Difficulty: Medium · Puzzle 6 of 6 · Topic: Cross Coverage Puzzles
Find the scored denominator and percentage for this 3-D cross. Two ignore_bins overlap on one tuple. Options: none set (all defaults: at_least = 1, weight = 1, auto_bin_max = 64).
covergroup cg with function sample(bit [1:0] port, bit prio, bit drop);
cp_port: coverpoint port {
bins p0 = {0};
bins p1 = {1};
bins p2 = {2};
}
cp_prio: coverpoint prio {
bins lo = {0};
bins hi = {1};
}
cp_drop: coverpoint drop {
bins no = {0};
bins yes = {1};
}
x3: cross cp_port, cp_prio, cp_drop {
ignore_bins lo_drop = binsof(cp_prio.lo) && binsof(cp_drop.yes);
ignore_bins p2_drop = binsof(cp_port.p2) && binsof(cp_drop.yes);
}
endgroup
initial begin
cg c = new();
c.sample(0,1,1);
c.sample(1,0,0);
c.sample(2,1,0);
c.sample(2,0,1);
c.sample(0,1,1);
c.sample(1,1,1);
c.sample(2,1,1);
endAuto space is 3 x 2 x 2 = 12 tuples. List the tuples each ignore_bins removes and take the union.
1) 12 auto tuples.
2) lo_drop removes (p0,lo,yes), (p1,lo,yes), (p2,lo,yes) -> 3 tuples.
3) p2_drop removes (p2,lo,yes) and (p2,hi,yes). (p2,lo,yes) is already removed, so the union is 4 tuples, not 5 -> 8 scored tuples.
4) Samples: (0,1,1)=(p0,hi,yes) hit, (1,0,0)=(p1,lo,no) hit, (2,1,0)=(p2,hi,no) hit, (2,0,1) ignored, (0,1,1) repeat, (1,1,1)=(p1,hi,yes) hit, (2,1,1) ignored.
5) 4 distinct scored tuples hit -> 4/8 = 50%.Answer: 8 tuples are scored and coverage is 50% (4 of 8).
Checked by running a model of the rule in a Python model. A model of the cross rule: the overlap is removed once, so 8 tuples are scored and 4 are hit.
(2,0,1) is selected by both ignore_bins; the removed set is a union of 4 tuples, not 3 + 2 = 5. Subtracting 5 gives a wrong denominator of 7 and 4/7 = 57.14%.
If lo_drop is deleted and only p2_drop remains, what are the scored tuples and the percentage with the same samples? Model answer: Only (p2,lo,yes) and (p2,hi,yes) are removed, so 10 tuples are scored. The hit tuples are still (p0,hi,yes), (p1,lo,no), (p2,hi,no), (p1,hi,yes) = 4, so 4/10 = 40%.
I would take the union of the ignored tuples, not the sum. The removed set is four tuples, because the tuple 2,0,1 is selected by both ignore_bins, so eight tuples are scored. Four of them are hit, giving 50 percent. The trap is subtracting five, which gives a denominator of seven and 57.14 percent. I would next check the overlap is intentional.