Difficulty: Hard · Puzzle 4 of 6 · Topic: Coverage Options Puzzles
Compute each instance coverage and type-level average when type_option.at_least applies to every instance.
covergroup cg with function sample(bit err);
option.per_instance = 1;
cp_err: coverpoint err {
type_option.at_least = 2;
bins zero = {0};
bins one = {1};
}
endgroup
initial begin
cg c0 = new();
cg c1 = new();
c0.sample(0);
c0.sample(1);
c1.sample(1);
c1.sample(1);
endEach bin in each instance needs at least 2 hits due to type_option.at_least=2.
1) For c0: zero count=1 and one count=1, neither reaches 2 -> 0/2 = 0%.
2) For c1: one count=2 reaches threshold, zero count=0 does not -> 1/2 = 50%.
3) Type-level average with per_instance=1 is (0 + 50)/2 = 25%.Answer: c0=0%, c1=50%, type coverage=25%.
Candidates often apply threshold only once globally; type_option still enforces threshold per instance/bin.
What minimum extra samples are needed to raise type coverage to at least 75%?