Difficulty: Easy · Puzzle 2 of 6 · Topic: Coverage Closure and Sampling Timing Puzzles
Why does this coverpoint plateau at 75% forever, and what is the correct closure action? Options: none set (all defaults: at_least = 1, weight = 1, auto_bin_max = 64).
class tr;
rand bit [1:0] opcode;
constraint legal_c { opcode inside {[0:2]}; }
endclass
module tb;
covergroup cg with function sample(bit [1:0] opcode);
cp_opcode: coverpoint opcode {
bins op0 = {0};
bins op1 = {1};
bins op2 = {2};
bins op3 = {3};
}
endgroup
cg c = new();
tr t = new();
initial repeat (10000) begin
void'(t.randomize());
c.sample(t.opcode);
end
endmoduleCheck whether op3 can ever be generated under legal_c.
1) Constraint legal_c allows only 0,1,2.
2) Bin op3 is unreachable by construction.
3) Maximum achievable legal hit bins are 3 of 4 -> 75% ceiling.
4) Closure fix: decide from the spec what opcode 3 is. If it is reserved or illegal, the stimulus is right and the model is wrong: mark op3 illegal_bins (it must never occur) or ignore_bins (legal but out of scope), with the spec reference; the denominator becomes 3 and coverage reaches 100%. If opcode 3 is a legal operation, legal_c is a stimulus bug: relax it so op3 can be generated. Either way, more seeds never help (10000 randomized samples here still give 3/4).Answer: Coverage ceiling is 75% because op3 is unreachable. This is a model mismatch, not a random stimulus deficiency. The action depends on the spec: reserved or illegal opcode 3 -> illegal_bins/ignore_bins with a reference; legal opcode 3 -> relax legal_c.
Checked by running the code in Verilator 5; the printed output supports the answer above. Randomizing with legal_c 10000 times never produces opcode 3, so the model caps at 3 of 4 bins (a counter stands in for the covergroup).
Teams often burn regression time trying to close a mathematically unreachable bin.
What evidence would you include in a waiver request for op3? Model answer: The spec or design reference showing opcode 3 is reserved or not allowed, the constraint (legal_c) that excludes it, a formal or reachability result showing it cannot be generated, regression statistics showing zero hits over many seeds as supporting evidence, and reviewer sign-off. Then replace the bin by ignore_bins or illegal_bins rather than just deleting it.
I would first ask whether the missing bin is reachable at all. Coverage plateaus at 75 percent because opcode 3 is unreachable under the stimulus constraints, which is a model mismatch, not a lack of random stimulus. The action depends on the spec: if 3 is reserved or illegal, I would mark it illegal or ignored with a reference, and if it is legal I would relax the constraint. The trap is burning regression time on an impossible bin.