← Design Verification Interviews

Interview Question · Project Defence

Building a Coverage Plan from a Spec

L2 Mid-LevelL3 Seniorfunctional coverageplanningcoverage model

The Question

The interviewer asks

Walk me through how you build a coverage plan from a spec. Use a FIFO with an APB register interface as the example.

Reveal the Model Answer

I start from the spec, not the RTL, and list each feature with its section number. For each one I decide what must be observed: values, sequences or combinations, and where to sample them, usually the monitor. Bins come from the spec's corners, and crosses only where the spec ties two fields together. Exclusions get a written reason. Then the designer and architect review the plan before any covergroup is coded.

REQ-7 from the Specification to a TestEach arrow is a document or code reference. The row cites the requirement, the bin and the check cite the row, and the row names the test that hits it.
REQ-7 from the specification to a testEach arrow is a document or code reference. The row cites the requirement, the bin and the check cite the row, and the row names the test that hits it. document Specification REQ-7: withCTRL.burst = 1 awrite burst isaccepted document Test plan row REQ-7: bin, check,test, closure rule coverage mon_cov binREQ-7 write, len > 1,ctrl_burst = 1, ok =1 checker Scoreboard rule ok must equal !(wr&& len > 1 &&!ctrl_burst) test burst_test(repaired) Intended: CTRL = 11,then 3 write bursts decision Closure Hit in a complete,checked run ofburst_test becomes a rowmeasured byjudged byhit byno mismatchhits counted
Read the diagram as text
  • Specification: REQ-7: with CTRL.burst = 1 a write burst is accepted
  • Test plan row: REQ-7: bin, check, test, closure rule
  • mon_cov bin REQ-7: write, len > 1, ctrl_burst = 1, ok = 1
  • Scoreboard rule: ok must equal !(wr && len > 1 && !ctrl_burst)
  • burst_test (repaired): Intended: CTRL = 11, then 3 write bursts
  • Closure: Hit in a complete, checked run of burst_test
  • Specification → Test plan row: becomes a row
  • Test plan row → mon_cov bin REQ-7: measured by
  • Test plan row → Scoreboard rule: judged by
  • mon_cov bin REQ-7 → burst_test (repaired): hit by
  • Scoreboard rule → Closure: no mismatch
  • burst_test (repaired) → Closure: hits counted

A requirement is closed by a hit in a complete, checked run, both traceable to one plan row.

Feature (spec)What to observeModel
Full and empty flagsLevel reaches 0 and DEPTH; push at full, pop at emptyCoverpoint on level, crossed with push and pop
Overflow sticky bitSet by push at full, cleared by an APB writeTransition bins on the bit; cover of set then clear
APB register accessRead and write to every register, with PSLVERR casesCross of address and direction; error bin
Reset during trafficReset when the FIFO is partial or fullCoverpoint sampled at the reset edge

A first cut of the plan for the example FIFO. Each row also names its checker and its owner.

Self-Check

Tick each key point you covered in your answer.

What Interviewers Listen For (Mid-Level)

A good mid-level answer lists the features with their spec sections. For each one it says where it is sampled and what counts as done.

Cross-Questions

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

WhyWhat IfProve ItBreak ItCompareScale It

  1. Building a Coverage Plan from a Spec
  2. WhyWhy the Plan Starts from the SpecL1 JuniorL2 Mid-Level

    Why build the coverage plan from the spec and not from the RTL?

    Reveal the Model Answer

    A plan read from the RTL only lists what was built, so it repeats the designer's understanding, mistakes included. A missing feature never appears in it. Code coverage already measures the RTL's structure. The spec is the independent source, so a plan built from it can find what the RTL left out.

    Self-Check

    Tick each key point you covered in your answer.

    Half-Truth

    "The RTL is more detailed, so it gives a better plan."

    Detail is not independence. Implementation corners from the RTL are worth adding, but on top of a spec-based plan, not instead of it.

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

  3. CompareCoverage Plan vs Test PlanL2 Mid-Level

    Compare a coverage plan with a test plan. Why keep both?

    Reveal the Model Answer

    A test plan lists the stimulus: which tests exist and what each one drives. A coverage plan lists what must be observed before a feature counts as done. With random tests the mapping is many to many: one test fills bins from many features, and one feature needs many tests. The coverage plan measures whether the tests did their job.

    Test planCoverage plan
    ListsTests and what each one drivesCases that must be observed
    AnswersWhat did we send?What did the design actually see?
    Done whenEvery test exists and passesEvery item is hit in passing runs
    MappingOne test fills bins of many featuresOne feature needs many tests

    With random tests the two plans map many to many, so one cannot replace the other.

    Self-Check

    Tick each key point you covered in your answer.

    Misconception

    "If every test in the test plan passes, the features are covered."

    A passing random test may never have produced the case it was written for. Only coverage shows what actually happened.

    Source Spear & Tumbush, SystemVerilog for Verification (3rd ed.), §9 introduction (PDF p361)

  4. Break ItCovered but Never CheckedL2 Mid-LevelL3 Senior

    How can a plan item reach 100% coverage and still be unverified?

    Reveal the Model Answer

    Coverage says the case happened; it does not say anyone checked the result. If the scoreboard ignores a field, or an assertion is missing, the case passes with any behaviour. So each plan row needs both a coverage item and a named checker. Review the checkers as carefully as the bins.

    Self-Check

    Tick each key point you covered in your answer.

    What Interviewers Listen For (Senior)

    A good senior answer adds a "checked by" column to the plan. It rejects any row that has coverage but no checker.

    Misconception

    "High coverage with no failures means high quality."

    It means many cases ran without a reported failure. Weak checkers produce exactly that picture.

    Source Mehta, SystemVerilog Assertions and Functional Coverage (3rd ed.), §25.2 (PDF p444)

  5. What IfA Corner the Spec Does Not DefineL2 Mid-Level

    Asked if they say the spec is unclear

    What if the spec is silent on one corner? For example, a push and a pop arrive in the same cycle while the FIFO is full.

    Reveal the Model Answer

    Raise it as a spec question with the architect, in writing, and don't guess. Cover the case anyway, because unclear corners are where designers and verifiers disagree. Once the answer is agreed, update the spec, the checker and the plan together. Until then, mark the row as open.

    Self-Check

    Tick each key point you covered in your answer.

    Missed Corner

    "Check what the RTL does and use that as the answer."

    Then the bench agrees with the RTL by definition. If the designer guessed wrong, nothing will catch it.

    Source Mehta, SystemVerilog Assertions and Functional Coverage (3rd ed.), §25.5 (PDF p447)

  6. Scale ItThe FIFO Plan Inside a SubsystemL3 SeniorL4 Staff

    The FIFO now sits inside a subsystem with a DMA and an interconnect. How does the coverage plan change?

    Reveal the Model Answer

    Don't re-close the FIFO's block corners; they were closed at block level. Keep the block covergroups running passively, so you can see which corners real traffic reaches. Add integration items: connections, the FIFO full while the DMA retries, and the interconnect stalling the APB side. Add system scenarios from the use cases too. Each level covers what only it can reach.

    Self-Check

    Tick each key point you covered in your answer.

    What Interviewers Listen For (Staff)

    A good staff answer splits the coverage effort between block and subsystem levels. It names the risks that only the subsystem bench can reach.

    Wrong Altitude

    "Reuse the block plan unchanged at subsystem level."

    Block corners are hard to reach through a DMA and slow to close there. Integration cases, which the block plan never listed, are left out.

    Source Mehta, ASIC/SoC Functional Design Verification, §2.2 (PDF p34)

  7. Prove ItFrom a Plan Row to a CoverpointL1 JuniorL2 Mid-Level

    Prove it: turn the "overflow sticky bit" row into coverage. What does this print for the two tests?

    systemverilog
    module tb;
      bit ovf;                         // the overflow sticky bit
      covergroup cg;
        sticky: coverpoint ovf { bins set = (0 => 1); bins held = (1 => 1); bins clear = (1 => 0); }
      endgroup
      cg full_test = new(), no_clear = new();
      bit a[$] = '{0, 0, 1, 1, 0};     // set, held, then cleared by an APB write
      bit b[$] = '{0, 1, 1, 1};        // set and held, never cleared
      initial begin
        foreach (a[i]) begin ovf = a[i]; full_test.sample(); end
        foreach (b[i]) begin ovf = b[i]; no_clear.sample(); end
        $display("set-hold-clear test: %0.2f", full_test.get_inst_coverage());
        $display("test that never clears: %0.2f", no_clear.get_inst_coverage());
      end
    endmodule
    
    Reveal the Model Answer

    It prints 100.00 for the first test and 66.67 for the second. The row says the bit is set by an overflow, stays set, and is cleared by a register write. Each of those is a transition, so each gets a transition bin. The second test never clears the bit, and the report names that hole.

    RUNVerilator (coverage build) · simulator service
    Edit the code, then run it
    Expected: set-hold-clear test: 100.00 test that never clears: 66.67

    Self-Check

    Tick each key point you covered in your answer.

    Half-Truth

    "A value bin for 1 is enough; it shows the bit was set."

    The row is about behaviour over time: set, hold and clear. A value bin is covered by the first overflow and says nothing about clearing.

    Source IEEE 1800-2017 §19.5.2

What People Get Wrong

Common wrong answers and why they fail.

Delivery

Starts by writing covergroup code.

Code before a feature list makes the model follow what is easy to write. The plan decides what to cover; the code comes after.

Buzzword Without Mechanism

"We cover all rare cases."

Without naming them, it says nothing. An interviewer wants two or three real corners, such as push at full and reset while full.

Half-Truth

"Once the plan is reviewed, it is fixed."

New corners appear as the design and the team's understanding grow. The plan is updated through the project.

Source Mehta, SystemVerilog Assertions and Functional Coverage (3rd ed.), §25.5 (PDF p447)

Learn It, Then Prove It