VLSI DV Interview Puzzles · All levels

Default bin denominator puzzle

How many bins are scored, and what is the coverpoint percentage after the five samples?

Puzzle

Difficulty: Easy · Puzzle 2 of 6 · Topic: Covergroup and Coverpoint Puzzles

How many bins are scored, and what is the coverpoint percentage after the five samples?

Code

systemverilog
covergroup cg with function sample(bit [2:0] opcode);
  cp_opcode: coverpoint opcode {
    bins read   = {0};
    bins write  = {1};
    bins atomic = {2,3};
    bins other  = default;
  }
endgroup

initial begin
  cg c = new();
  c.sample(0);
  c.sample(1);
  c.sample(4);
  c.sample(7);
  c.sample(3);
end

Hint

A named default bin is a scored bin, not metadata.

Step-by-step solution

diagram
1) Scored bins are read, write, atomic, other -> 4 bins total.
2) Samples hit read (0), write (1), atomic (3), and other (4 and 7).
3) All 4 bins are hit at least once -> 4/4 = 100%.

Answer

Answer: There are 4 scored bins and coverage is 100% (4 hit of 4).

Why candidates get it wrong

Engineers often forget default contributes to denominator once it is explicitly declared as a named bin.

Interviewer follow-up

How would the denominator change if other were replaced by ignore_bins other = default?

Related topics