Module 4: Coverage and Assertions | Intermediate UVM

Coverage Closure

Turn coverage holes into concrete verification actions—and know when a hole is truly closed.

Learning objectives

  • Explain what coverage closure means beyond reaching a percentage target.
  • Classify an uncovered bin as a stimulus, constraint, sampling, monitor, model, or specification problem.
  • Choose between directed stimulus, constrained-random stimulus, coverage-model changes, or justified exclusions.
  • Use a small UVM/SystemVerilog example to close a specific coverage hole.
  • Distinguish a legitimately unreachable scenario from a scenario that has simply not been generated yet.
  • Track coverage closure without weakening the verification plan or gaming the metric.

Step 1: What coverage closure actually means

Lesson 35 taught you how to analyze coverage results. Coverage closure is the next step: deciding what to do about the holes you found.

A coverage hole is not automatically a stimulus problem. An uncovered bin can mean that the testbench has not generated the scenario, the constraints prevent it, the DUT cannot legally reach it, the monitor samples at the wrong boundary, or the coverage model itself is incorrect.

Core idea: Coverage closure is complete when every important coverage goal is either hit, correctly reworked, or justifiably excluded—with evidence for the decision.

Therefore, "coverage reached 100%" is not the definition of closure. A poorly designed model can reach 100% while important behavior remains untested.

Step 2: Start with the uncovered bin, not the percentage

Suppose Lesson 35 identified this cross:

covergroup transfer_cg with function sample(packet item);


operation_cp: coverpoint item.write {
bins read  = {0};
bins write = {1};
}

region_cp: coverpoint item.addr {
bins control = {[32'h0000_0000 : 32'h0000_00FF]};
bins status  = {[32'h0000_0100 : 32'h0000_01FF]};
bins data    = {[32'h0000_1000 : 32'h0000_1FFF]};
}

operation_x_region: cross operation_cp, region_cp;

endgroup

Imagine the report shows:

operation_x_region

         control   status   data


read           HIT       HIT      HIT
write          HIT       MISS     HIT

The useful question is not: "How do I increase coverage?"

Ask instead: "Why has a write to the status region never been observed?"

That question leads to an investigation.

Step 3: Classify the coverage hole

A practical closure investigation can use this decision tree:

  1. Is the bin required?
    If the requirement does not matter, the coverage model may be wrong or unnecessarily detailed.
  2. Can the scenario legally occur?
    Check the protocol specification, DUT architecture, address map, modes, and dependencies.
  3. Can the testbench generate it?
    Inspect sequence constraints, configuration, randomization, and scenario selection.
  4. Does the DUT accept it?
    A sequence may request an operation that the protocol or DUT legitimately rejects.
  5. Does the monitor observe it?
    A sampling-boundary bug can make real DUT behavior invisible to coverage.
  6. Does the coverage model classify it correctly?
    The address range, mode, transaction type, or derived value may be wrong.

Only after these questions should you change the stimulus.

Step 4: Choose the right closure action

Different root causes require different actions.

Root cause Typical action
Required scenario was never generated Add or improve stimulus
Constraints make the scenario too rare Refine constraints or add a targeted test
Scenario requires a specific sequence of events Add a directed or targeted scenario
Random stimulus can reach it but inefficiently Use constrained-random targeting or a directed test
Monitor misses the real event Fix the monitor or sampling boundary
Coverage bins describe the wrong behavior Fix the coverage model
Scenario is prohibited by the specification Document and justify an exclusion
Scenario is architecturally unreachable Provide evidence and document the waiver
Do not game coverage: Do not make a bin easier to hit merely because it is inconvenient. Do not remove meaningful bins just to increase the percentage. Coverage closure is about satisfying the verification plan, not producing an attractive report.

Step 5: Close a hole with targeted stimulus

Assume the status region requires a write, but the normal random tests rarely generate one. A small targeted sequence can deliberately exercise the missing scenario.

class status_write_seq extends uvm_sequence #(packet);


`uvm_object_utils(status_write_seq)

function new(string name = "status_write_seq");
super.new(name);
endfunction

task body();
packet req;


req = packet::type_id::create("req");

start_item(req);

if (!req.randomize() with {
  write == 1;
  addr inside {[32'h0000_0100 : 32'h0000_01FF]};
}) begin
  `uvm_error("COV_STIM",
             "Could not randomize status-region write")
end

finish_item(req);


endtask

endclass

This is useful because the constraint is tied directly to the uncovered requirement: write × status region.

However, the sequence alone does not prove that the bin will be covered. The transaction still has to reach the DUT, satisfy the protocol, be accepted, and be observed at the coverage sampling point.

Closure evidence: After running the targeted test, verify both the functional result and the coverage result. A coverage hit without correct scoreboard behavior is not successful verification.

Step 6: Directed versus constrained-random closure

Coverage closure does not mean replacing random testing with directed testing. Both approaches have useful roles.

Use directed stimulus when:

  • a specific rare scenario is required;
  • the scenario requires a carefully controlled sequence;
  • random stimulus is extremely inefficient;
  • the missing bin represents a precise boundary or mode transition.

Use constrained-random stimulus when:

  • many legal combinations should be explored;
  • the scenario can be described naturally with constraints;
  • you want variation around the targeted condition;
  • the closure problem is caused by overly restrictive stimulus constraints.

A good closure strategy often uses both: targeted constraints to reach a difficult region, followed by random variation to explore neighboring scenarios.

Step 7: Prove an unreachable scenario before excluding it

Some bins really are unreachable. That does not mean they should simply be deleted.

Consider a cross containing a combination that the protocol explicitly forbids. If the DUT cannot legally receive that combination, repeatedly changing random constraints will never close the bin.

Before excluding it, gather evidence:

  • identify the exact requirement or protocol rule;
  • show why the combination cannot occur;
  • verify that the monitor and coverage sampling are correct;
  • record the reason for the exclusion;
  • have the exclusion reviewed according to the project's verification process.

The important distinction is:

UNREACHED


|
+-- Legal and required? ------> Improve stimulus
|
+-- Legal but very rare? -----> Target constraints/test
|
+-- Monitor/sampling issue? --> Fix environment
|
+-- Coverage model issue? ----> Fix model
|
+-- Illegal/unreachable? -----> Justify exclusion

An exclusion is a verification decision, not a shortcut for avoiding difficult stimulus.

Step 8: Coverage closure can expose bad constraints

Suppose a required bin remains uncovered across many seeds. The problem may be a constraint that silently removes the interesting part of the stimulus space.

constraint legal_address {


addr inside {[32'h0000_0000 : 32'h0000_00FF]};
}

If the coverage plan requires transactions in the status region 32'h0000_0100 through 32'h0000_01FF, no amount of additional random seeds will cover that bin while this constraint remains active.

This is why closure analysis should inspect the entire stimulus path:

Coverage hole
 |
 v


Coverage bin
|
v
Sampled transaction
|
v
Monitor
|
v
DUT acceptance
|
v
Sequence constraints
|
v
Scenario selection

Debugging from the bin backward often finds the root cause faster than simply increasing the regression length.

Step 9: Know when more seeds will not help

More random seeds are useful when a scenario is legal but statistically rare. They are ineffective when a deterministic restriction prevents the scenario from occurring.

For example:

  • Rare legal combination: additional seeds may eventually find it.
  • Impossible constraint: additional seeds will never find it.
  • Wrong sampling point: additional seeds cannot repair the monitor.
  • Wrong bin definition: additional seeds only create misleading results.

Before launching a much larger regression, perform a small targeted experiment. It is usually cheaper to determine whether the scenario is reachable than to blindly run thousands of additional seeds.

Step 10: Track closure as engineering work

In a real verification environment, coverage closure is easier to manage when each significant hole has an explicit status.

Coverage item Status Root cause Action Evidence
write × status Open Stimulus gap Add targeted sequence Directed test result
debug × write Waived Protocol prohibits combination Document exclusion Protocol requirement
burst × boundary Investigating Possible sampling issue Inspect monitor Waveform + monitor log

This turns coverage closure into a traceable engineering process instead of a sequence of ad-hoc test modifications.

Step 11: Closure is not the same as correctness

A coverage bin records that a scenario occurred. It does not establish that the DUT behaved correctly during that scenario.

A useful mental model is:

Verification mechanism Primary question
Functional coverage Did the planned scenario occur?
Scoreboard Did the observed result match expected behavior?
Assertion Was a temporal or protocol rule violated?
Code coverage Which implementation structures executed?

A strong closure result therefore looks like:

Required scenario
   |
   +--> Functional coverage: HIT
   |
   +--> Scoreboard: PASS
   |
   +--> Assertions: PASS
   |
   +--> Regression evidence: REPRODUCIBLE

This is much stronger evidence than a single coverage percentage.

Step 12: Avoid coverage-driven testbench damage

Closure pressure can lead to poor verification decisions. Watch for these warning signs:

  • Deleting difficult bins without analyzing why they are difficult.
  • Broadening bins until important distinctions disappear.
  • Sampling sequence intent instead of actual DUT behavior merely to increase coverage.
  • Adding artificial stimulus that bypasses the normal protocol path.
  • Running many seeds without investigating deterministic constraints.
  • Calling a scenario unreachable without specification evidence.
  • Declaring success because coverage reached an arbitrary percentage.
Good closure makes the model stronger. If closing a hole makes the coverage model less meaningful, the process has moved in the wrong direction.

Step 13: A practical closure workflow

Use the following workflow whenever a required bin is uncovered:

  1. Identify the exact bin. Do not work from an overall percentage.
  2. Connect it to a requirement. Know why the bin exists.
  3. Verify the sampling boundary. Make sure the event is observed correctly.
  4. Check monitor reconstruction. Confirm the transaction contains the expected values.
  5. Inspect stimulus constraints. Determine whether the scenario can be generated.
  6. Run a small targeted experiment. Test reachability before expanding regression.
  7. Choose the closure action. Stimulus, constraint, monitor, coverage model, or exclusion.
  8. Verify correctness. Check scoreboard and relevant assertions.
  9. Record the evidence. Preserve the test, seed, diagnosis, and result.
  10. Re-run regression. Ensure the fix closes the intended hole without breaking existing coverage.

Common mistakes

Debugging strategy

When a required bin refuses to close, debug from the coverage result toward the source of the transaction:

Uncovered bin
|
+--> Is the bin required?
|
+--> Is the coverage model correct?
|
+--> Is sampling occurring at the correct event?
|
+--> Did the monitor reconstruct the transaction?
|
+--> Did the DUT accept the operation?
|
+--> Can the sequence generate it?
|
+--> Are constraints preventing it?
|
+--> Is the scenario actually reachable?
|
+--> Choose closure action

Use waveforms and UVM transaction logs when the answer is unclear. The goal is to locate the first layer where reality differs from your verification plan.

Try it yourself

  1. Create a coverage model with two coverpoints and a cross. Intentionally leave one cross combination difficult to generate.
  2. Write a targeted sequence that attempts to close the missing bin.
  3. Run the sequence and verify that the monitor observes the intended transaction.
  4. Confirm that the scoreboard still passes.
  5. Record the coverage result, test name, and seed as closure evidence.

Goal: practice closing one specific requirement rather than trying to maximize the overall coverage percentage.

Challenge: Investigate a stubborn coverage hole

Your regression reports that the following cross bin has never been hit:

mode_x_operation

         READ    WRITE


normal        HIT      HIT
debug         HIT      MISS

You are told that debug-mode writes are legal, but the normal random regression never generates them.

Determine:

  1. Where you would inspect the stimulus constraints.
  2. Whether a targeted sequence or a constraint change is more appropriate.
  3. How you would prove that the monitor samples the operation correctly.
  4. Which scoreboard or assertion evidence should accompany the coverage hit.
  5. What information you would record if the bin were eventually determined to be unreachable.

Advanced extension: Make the scenario rare rather than impossible. Compare how many seeds are required for ordinary random stimulus versus a targeted constrained-random test.

Knowledge check

  1. What is the first question to ask about an uncovered bin?
    Whether it represents a required and meaningful verification scenario.
  2. When should you change stimulus constraints?
    When the scenario is required and legal, but the current stimulus cannot or rarely generates it.
  3. Does an uncovered bin prove that the DUT cannot perform the behavior?
    No. The monitor, sampling architecture, constraints, or coverage model may be responsible.
  4. When is an exclusion justified?
    When the scenario is genuinely irrelevant, illegal, or unreachable and there is evidence supporting that decision.
  5. Does a covered bin prove that the DUT is correct?
    No. Coverage establishes occurrence; scoreboards and assertions provide complementary correctness evidence.

Key takeaways

  • Coverage closure is the process of resolving meaningful coverage holes, not simply increasing a percentage.
  • Classify the root cause before changing stimulus.
  • Use directed tests and constrained-random stimulus strategically rather than treating them as competing approaches.
  • Fix monitor, sampling, or coverage-model problems instead of masking them with stimulus changes.
  • Do not exclude a scenario without specification-based evidence that it is irrelevant or unreachable.
  • Verify coverage hits with scoreboard and assertion evidence where appropriate.
  • Record closure decisions so regression results remain explainable and reproducible.
  • Coverage closure improves confidence in the verification plan; it does not by itself prove DUT correctness.

What comes next?

You have now built the functional-coverage workflow from planning through closure:

Lesson 31  Coverage planning
 ↓


Lesson 32  Coverpoints and bins
↓
Lesson 33  Cross coverage
↓
Lesson 34  Sampling architecture
↓
Lesson 35  Coverage analysis
↓
Lesson 36  Coverage closure 

Coverage tells you whether important scenarios occurred. It does not express every kind of temporal or protocol rule efficiently.

Lesson 37: SystemVerilog Assertions introduces assertions as the next verification mechanism: concise executable properties for checking relationships across clock cycles and detecting protocol violations close to the point where they occur.