VLSI DV Interview Puzzles · All levels
binsof-selected tuples with default ignore
Determine scored bin count and final percentage when only selected tuples are named.
Puzzle
Difficulty: Medium · Puzzle 3 of 6 · Topic: Cross Coverage Puzzles
Determine scored bin count and final percentage when only selected tuples are named.
Code
systemverilog
covergroup cg with function sample(bit [2:0] size, bit [1:0] qos);
cp_size: coverpoint size {
bins small = {[0:3]};
bins big = {[4:7]};
}
cp_qos: coverpoint qos {
bins low = {0};
bins high = {1};
bins urgent = {2};
}
x_sz_qos: cross cp_size, cp_qos {
bins big_high = binsof(cp_size.big) && binsof(cp_qos.high);
bins big_urgent = binsof(cp_size.big) && binsof(cp_qos.urgent);
bins small_low = binsof(cp_size.small) && binsof(cp_qos.low);
ignore_bins rest = default;
}
endgroup
initial begin
cg c = new();
c.sample(6,1);
c.sample(7,2);
c.sample(2,2);
endHint
Only the three named bins are scored; one sample lands in ignored space.
Step-by-step solution
diagram
1) Denominator is 3 scored bins: big_high, big_urgent, small_low.
2) sample(6,1) hits big_high.
3) sample(7,2) hits big_urgent.
4) sample(2,2) is rest and ignored.
5) Coverage = 2/3 = 66.67%.Answer
Answer: 3 bins are scored and coverage is 66.67% (2 hit of 3).
Why candidates get it wrong
Many candidates incorrectly include all 2x3=6 possible tuples in denominator even with ignore default.
Interviewer follow-up
What single stimulus would close this model to 100%?