VLSI DV Interview Puzzles · All levels

auto_bin_max and at_least together

Compute final percentages for each coverpoint when both option.auto_bin_max and option.at_least are active.

Puzzle

Difficulty: Medium · Puzzle 1 of 6 · Topic: Coverage Options Puzzles

Compute final percentages for each coverpoint when both option.auto_bin_max and option.at_least are active.

Code

systemverilog
covergroup cg with function sample(bit [3:0] addr, bit err);
  cp_addr: coverpoint addr {
    option.auto_bin_max = 4;
  }

  cp_err: coverpoint err {
    option.at_least = 3;
    bins zero = {0};
    bins one  = {1};
  }
endgroup

initial begin
  cg c = new();
  c.sample(0, 0);
  c.sample(1, 1);
  c.sample(2, 0);
  c.sample(15,1);
  c.sample(8, 1);
end

Hint

addr values are grouped into 4 auto bins; err bins need at least 3 hits each.

Step-by-step solution

diagram
1) cp_addr has 4 grouped bins over 0..15.
2) Samples hit groups 0..3, 8..11, and 12..15 -> 3/4 = 75%.
3) cp_err counts are zero=2 and one=3.
4) With at_least=3, only one bin is covered -> 1/2 = 50%.

Answer

Answer: cp_addr = 75%, cp_err = 50%.

Why candidates get it wrong

A touched bin is not covered until it meets threshold. Grouped auto bins also change denominator intuition.

Interviewer follow-up

How many additional err=0 samples are required to make cp_err reach 100%?

Related topics