Difficulty: Easy · Puzzle 2 of 6 · Topic: Cross Coverage Puzzles
No ignores, no custom bins. Compute auto cross denominator and percentage. Options: none set (all defaults: at_least = 1, weight = 1, auto_bin_max = 64).
covergroup cg with function sample(bit [1:0] a, bit b);
cp_a: coverpoint a {
bins a0 = {0};
bins a1 = {1};
bins a2 = {2};
}
cp_b: coverpoint b {
bins b0 = {0};
bins b1 = {1};
}
x_ab: cross cp_a, cp_b;
endgroup
initial begin
cg c = new();
c.sample(0,0);
c.sample(1,1);
c.sample(2,1);
c.sample(2,0);
endCross denominator is product of coverpoint bin counts.
1) cp_a has 3 bins and cp_b has 2 bins -> auto cross has 6 bins.
2) Hit tuples are (a0,b0), (a1,b1), (a2,b1), (a2,b0) -> 4 unique cross bins hit.
3) Coverage = 4/6 = 66.67%.Answer: Cross denominator is 6 bins and achieved coverage is 66.67%.
Checked by running a model of the rule in a Python model. A model of the auto-cross rule: 3 x 2 gives 6 tuples and 4 distinct ones are hit.
Judging by the coverpoints instead of the cross: cp_a is 3/3 = 100% and cp_b is 2/2 = 100%, yet the cross is only 4/6 = 66.67%. Full coverage of each variable says nothing about the combinations.
Which exact two tuples are still uncovered after the shown traffic? Model answer: (a0,b1) and (a1,b0): the six tuples are a0/a1/a2 x b0/b1 and the four hit are (a0,b0), (a1,b1), (a2,b1), (a2,b0).
I would multiply the coverpoint bins: the auto cross has six bins, and four are hit, so the cross is 66.67 percent. Each coverpoint is 100 percent on its own, but covering each variable says nothing about the combinations. The trap is quoting the coverpoint numbers as closure. Next I would list the two missing combinations and ask whether they are reachable.