← Design Verification Interviews

Interview Question · Concept

Ignore, Illegal and Default Bins

L0 FresherL1 Juniorfunctional coveragebins

The Question

The interviewer asks

An opcode field has 8 values, and 6 and 7 are reserved. Do you use ignore_bins, illegal_bins or a default bin? What does each one do?

Reveal the Model Answer

All three keep values out of the coverage total, but they act differently when a value arrives. ignore_bins drops the value silently. illegal_bins drops it and raises a run-time error when it is hit. A default bin collects every value no other bin names, and it never counts toward coverage. For reserved opcodes, use ignore_bins and a separate check in the monitor or an assertion.

Where Each Length Lands in len_classesA length coverpoint with three normal bins and one illegal_bins. Arrows show where a sampled length goes, and what each kind of bin feeds.
Where each length lands in len_classesA length coverpoint with three normal bins and one `illegal_bins`. Arrows show where a sampled length goes, and what each kind of bin feeds. call sample(len) one length per call bin bins one {1} bin bins short_ {[2:4]} bin bins long_ {[5:8]} excluded illegal_bins bad {0, [9:15]} result Coverage covered bins out of 3 result Run-time error at the sample thathits it on a hit
Read the diagram as text
  • sample(len): one length per call
  • bins one: {1}
  • bins short_: {[2:4]}
  • bins long_: {[5:8]}
  • illegal_bins bad: {0, [9:15]}
  • Coverage: covered bins out of 3
  • Run-time error: at the sample that hits it
  • sample(len) → bins one
  • sample(len) → bins short_
  • sample(len) → bins long_
  • sample(len) → illegal_bins bad
  • bins one → Coverage
  • bins short_ → Coverage
  • bins long_ → Coverage
  • illegal_bins bad → Run-time error: on a hit

bins count toward the total. ignore_bins and illegal_bins do not, and a hit on illegal_bins is an error.

Kind of binCounted in coverage?If a sample hits it
binsyesthe bin is covered
ignore_binsnonothing happens
illegal_binsnoa run-time error is reported
bins x = defaultnocounted in x, outside the total

Only normal bins count toward the total. The other three kinds differ in what happens when a value arrives.

Self-Check

Tick each key point you covered in your answer.

What Interviewers Listen For (Fresher)

A good fresher answer explains each kind of bin in one line. It also says that none of the three counts toward the total.

Cross-Questions

Where the interviewer goes next. Open a node to practise that follow-up.

WhyWhat IfBreak ItCompare

  1. Ignore, Illegal and Default Bins
  2. WhyWhy Teams Avoid Illegal Bins for CheckingL1 JuniorL2 Mid-Level

    Why do many teams avoid illegal_bins for protocol errors, even though it does raise an error?

    Reveal the Model Answer

    Coverage is often switched off for speed in some regressions, and the check would vanish with it. An illegal bin also fires only when the covergroup samples. If sampling is gated, a bad value in an unsampled cycle passes unseen. The error text is short and has no transaction context. A checker or assertion runs in every regression and gives a useful message.

    Self-Check

    Tick each key point you covered in your answer.

    Missed Corner

    "An illegal bin catches the bad value whenever it appears on the bus."

    It sees only the values passed to sample(). A value in a cycle the covergroup does not sample is never checked.

    Source IEEE 1800-2017 §19.5.6

  3. Break ItAn Illegal Value the Illegal Bin Never SawL2 Mid-Level

    The opcode coverpoint has iff (valid && ready). How can a reserved opcode still get past without the illegal bin firing?

    Reveal the Model Answer

    The guard means the coverpoint only looks at accepted transfers. Suppose the design wrongly accepts a beat while ready is low. The coverpoint never sees that beat, so a reserved opcode on it goes unchecked. An assertion on the interface, such as valid |-> op inside {[0:5]}, checks every clock.

    Self-Check

    Tick each key point you covered in your answer.

    Missed Corner

    "The guard only removes idle cycles, so nothing important is lost."

    The guard is written from the testbench's idea of a legal transfer. Bugs that break that idea are exactly the cycles it hides.

    Source IEEE 1800-2017 §19.5

  4. CompareIllegal Bin vs Assertion for a Reserved ValueL1 JuniorL2 Mid-Level

    Compare an illegal bin with an assertion in the interface for the same reserved opcode.

    Reveal the Model Answer

    The assertion is a check: it runs every clock, survives when coverage is off and reports with the time and signal values. The illegal bin is a side effect of a coverage model, and it runs only on samples. Use the assertion to catch the bug. Keep the reserved values in ignore_bins so they don't sit as permanent holes.

    Illegal binAssertion in the interface
    RunsOnly when the covergroup samplesEvery clock
    With coverage switched offGoneStill checks
    MessageShort, no transaction contextTime and signal values

    Use the assertion to catch the bug, and ignore_bins to keep the reserved values out of the total.

    Self-Check

    Tick each key point you covered in your answer.

    Wrong Altitude

    "Use both, so the error is reported twice and nobody misses it."

    Two reports of one bug add noise and double-count failures in triage. One check, one owner.

    Source Mehta, SystemVerilog Assertions and Functional Coverage (3rd ed.), §26.19 guidelines (PDF p477)

  5. What IfA Reserved Value That Becomes LegalL2 Mid-LevelL3 Senior

    Asked if they choose ignore_bins

    What if a later spec revision makes opcode 6 legal, and nobody touches the covergroup?

    Reveal the Model Answer

    The new opcode stays in ignore_bins, so it never appears as a hole, and coverage still reads 100%. The new feature ships untested by any coverage measure. Keep every exclusion next to its spec reference and review them all when the spec changes. Treat a change to an exclusion like a design change.

    Self-Check

    Tick each key point you covered in your answer.

    What Interviewers Listen For (Senior)

    A good senior answer puts every exclusion under the same review as the verification plan. It checks the exclusions again at each new spec revision.

    Missed Corner

    "The tests would fail if opcode 6 mattered."

    Tests only fail on what they check. A new opcode that no test sends fails nothing, and the ignore bin hides that it was never sent.

    Source Spear & Tumbush, SystemVerilog for Verification (3rd ed.), §9.2.2 (PDF p364)

What People Get Wrong

Common wrong answers and why they fail. Run It shows the wrong belief failing on a real simulator.

Misconception

"ignore_bins will warn me if a reserved opcode shows up."

Ignored values are dropped with no message. In the twin, opcode 7 arrives and coverage still reads 100% with nothing printed.

Run It

Reserved opcodes in ignore_bins, and opcode 7 arrives.

RUNVerilator (coverage build) · simulator service
Edit the code, then run it
Expected: coverage=100.00 reserved reports=0 FAIL: ignore_bins dropped opcode 7 silently; coverage still reads 100%
See the Fix
module tb;
  bit [2:0] op;
  bit [2:0] seen[$] = '{0, 1, 2, 3, 4, 5, 7};   // opcode 7 is reserved
  int reserved_reports = 0;
  covergroup cg;
    cp: coverpoint op { bins legal[] = {[0:5]}; ignore_bins reserved = {6, 7}; }
  endgroup
  cg c = new();
  initial begin
    foreach (seen[i]) begin
      op = seen[i];
      c.sample();
      // The fix: the monitor checks for reserved opcodes; the covergroup only counts.
      if (op inside {6, 7}) begin
        reserved_reports++;
        $display("ERROR: reserved opcode %0d seen at item %0d", op, i);
      end
    end
    $display("coverage=%0.2f reserved reports=%0d", c.get_coverage(), reserved_reports);
    if (reserved_reports == 0) $display("FAIL: ignore_bins dropped opcode 7 silently; coverage still reads 100%%");
    else $display("PASS: the monitor check flagged the reserved opcode; coverage ignores it as planned");
  end
endmodule

Prints: ERROR: reserved opcode 7 seen at item 6 coverage=100.00 reserved reports=1 PASS: the monitor check flagged the reserved opcode; coverage ignores it as planned

Misconception

"A default bin makes unexpected values count in the total."

A default bin is excluded from coverage. The twin puts two values in it and coverage stays at 0.

Run It

Only the default bin is hit.

RUNVerilator (coverage build) · simulator service
Edit the code, then run it
Expected: coverage=0.00 after two values in the default bin FAIL: the default bin caught 9 and 12 but adds nothing to the coverage total

Half-Truth

"illegal_bins just drops the value, like ignore_bins with a different name."

An illegal bin hit is a run-time error. On the coverage build it stops the run with "Illegal bin hit".

Source IEEE 1800-2017 §19.5.6

Learn It, Then Prove It