VLSI DV Interview Puzzles · All levels

per_instance exposure of hidden holes

With per-instance tracking enabled, compute each instance coverage and type-level average.

Puzzle

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

With per-instance tracking enabled, compute each instance coverage and type-level average.

Code

systemverilog
covergroup cg with function sample(bit mode);
  option.per_instance = 1;
  cp_mode: coverpoint mode {
    bins off = {0};
    bins on  = {1};
  }
endgroup

initial begin
  cg c0 = new();
  cg c1 = new();
  c0.sample(0);
  c0.sample(1);
  c1.sample(0);
end

Hint

per_instance=1 keeps c0 and c1 separate instead of merged.

Step-by-step solution

diagram
1) c0 hits off and on -> 2/2 = 100% inst coverage.
2) c1 hits only off -> 1/2 = 50% inst coverage.
3) Type-level get_coverage with per_instance=1 reflects instance average -> (100 + 50)/2 = 75%.

Answer

Answer: c0.get_inst_coverage()=100%, c1.get_inst_coverage()=50%, and type coverage is 75%.

Why candidates get it wrong

Without per-instance thinking, merged closure can hide one unexercised interface instance.

Interviewer follow-up

How would results appear if option.per_instance were left at 0?

Related topics