Module 4: Coverage and Assertions | Intermediate UVM

Functional Coverage Planning

Plan coverage from verification requirements so that coverage measures meaningful behavior instead of simply counting activity.

Learning objectives

  • Explain the purpose of functional coverage in a verification environment.
  • Translate protocol and design requirements into measurable coverage goals.
  • Distinguish functional coverage from code coverage, assertions, and scoreboard checking.
  • Identify useful coverage dimensions such as operation type, boundary conditions, response behavior, and concurrency.
  • Choose an appropriate coverage sampling point and transaction source.
  • Recognize weak coverage models that can report high percentages without demonstrating meaningful verification.
  • Prepare a coverage plan that can later be implemented with coverpoints, bins, and crosses.

Step 1: Understand what functional coverage measures

A verification environment needs evidence that important behaviors were actually exercised. A passing test does not automatically prove that the important parts of the design space were explored.

Functional coverage measures whether scenarios, values, states, transitions, or combinations identified as important by the verification plan have occurred during simulation.

For example, suppose an APB-like interface supports:

  • read and write transfers
  • multiple address regions
  • zero-wait and multi-cycle responses
  • error responses
  • back-to-back transfers

Simply observing 10,000 transfers does not tell us whether all of these behaviors occurred. A useful coverage plan explicitly identifies them.

Verification requirement
    │
    ▼


"What behavior must be exercised?"
│
▼
Coverage item
│
▼
How will it be observed?
│
▼
How will it be sampled?
│
▼
How will results guide stimulus?
Core idea: Coverage is not a replacement for checking. A scoreboard asks "Was the observed behavior correct?" Coverage asks "Did this important behavior occur?"

Step 2: Start from requirements, not signals

A common beginner mistake is to look at the DUT signals and create a coverpoint for every interesting-looking signal.

A stronger approach starts with the specification or verification plan:

Weak approach:


DUT signal
│
└──► coverpoint

Better approach:

Requirement
│
├── What behavior matters?
├── What values matter?
├── What combinations matter?
└── What boundary cases matter?
│
▼
Coverage item
│
▼
Observable event

For example, a requirement might say:

The design must correctly handle reads and writes to each supported address region, including accesses that generate an error response.

A useful coverage plan might therefore contain dimensions such as:

  • operation type: read/write
  • address region: control/status/data/reserved
  • response: success/error
  • important combinations: operation × region × response

The exact implementation comes later. Lesson 32 will turn these planned dimensions into coverpoints and bins.

Step 3: Build a coverage plan

Before writing SystemVerilog, create a small table describing what needs to be measured. For an intermediate environment, a useful plan might look like this:

Requirement Coverage dimension Important cases Why it matters
Support both transfer directions Operation Read, write Exercises both functional paths
All address regions must be exercised Address region Control, status, data Different registers/routes may use different logic
Error handling must be exercised Response status Success, error Verifies exceptional behavior
Important combinations must occur Operation × region × response Defined meaningful combinations Finds scenarios missed by individual dimensions
Wait states must be exercised Latency category Immediate, delayed Exercises timing-dependent behavior

This plan becomes the source for the implementation rather than inventing coverage opportunistically while writing the testbench.

Step 4: Choose meaningful coverage dimensions

Useful functional coverage commonly falls into several categories.

Values

Important values or value classes, such as operation type, burst length, address region, response code, or packet size.

Boundaries

Values near meaningful limits, such as minimum size, maximum size, first address, last address, zero, maximum ID, or FIFO full/empty conditions.

Modes and states

Operating modes, configuration states, protocol states, or error modes.

Events and transitions

Important transitions such as reset → active, idle → transfer, or normal → error.

Relationships

Combinations of otherwise independent dimensions, such as operation × address region or request type × response type.

Concurrency

Scenarios involving multiple outstanding operations, multiple channels, or simultaneous activity when the protocol permits it.

The goal is not to cover everything. The goal is to identify the behavior space that matters to correctness and risk.

Step 5: Decide what event should be sampled

Coverage is only meaningful if it samples the right event. This is especially important in UVM because the same logical operation can exist in several forms:

Sequence item
 │
 │ intended stimulus
 ▼


Driver
│
│ DUT interface activity
▼
Monitor
│
│ reconstructed observed transaction
▼
Coverage model

For protocol behavior, sampling from the monitor is often preferable because it measures what actually occurred at the DUT interface rather than what the sequence intended to send.

For example, if a sequence creates a transaction while the DUT is not ready, sampling the sequence item may count a transfer that the DUT never accepted.

If the requirement concerns accepted transfers, the coverage model should sample the monitor's reconstructed transaction at the protocol-defined acceptance point.

Ask this question first: "What real event makes this coverage item true?" Then choose the sampling architecture that observes that event.

Step 6: Connect coverage to UVM data flow

A reusable coverage collector can subscribe to the monitor's analysis port, just like other analysis components.

class packet_coverage extends uvm_subscriber #(packet);


`uvm_component_utils(packet_coverage)

function new(string name = "packet_coverage",
uvm_component parent = null);
super.new(name, parent);
endfunction

covergroup packet_cg with function sample(packet tr);
operation_cp: coverpoint tr.write;
error_cp:     coverpoint tr.error;
endgroup

function void build_phase(uvm_phase phase);
super.build_phase(phase);
packet_cg = new();
endfunction

function void write(packet t);
packet_cg.sample(t);
endfunction

endclass

The important architectural point is the data flow:

Monitor


│
│ analysis_port
▼
packet_coverage
│
└── sample observed transaction

The exact coverpoints are intentionally simple here. Lesson 32 will focus on defining coverpoints, bins, and sampling behavior in detail.

Step 7: Understand why high coverage can still be weak

A coverage percentage is only meaningful relative to the quality of the coverage model.

Imagine a model containing only:

coverpoint tr.write;

If both reads and writes occur, the coverage may reach 100%. That does not prove that all important address regions, responses, boundary conditions, or timing scenarios were exercised.

Conversely, creating hundreds of automatically generated bins can produce a very detailed percentage without necessarily measuring important behavior.

This leads to an important verification principle:

100% of a weak coverage model is still weak verification evidence. Coverage quality depends on whether the model represents the behaviors the verification plan actually cares about.

Step 8: Plan crosses carefully

Some requirements concern combinations rather than individual values.

Suppose a protocol supports:

  • read and write
  • three address regions
  • success and error responses

Individual coverage can prove that each dimension occurred:

operation


address_region
response_status

But the verification plan may also require specific combinations, such as:

write + control_region + error


read  + status_region  + success

A cross can measure combinations of coverage dimensions. However, not every mathematical combination is necessarily meaningful.

For example, if an error response is impossible for one address region by specification, requiring a coverage bin for that combination may create an artificial coverage hole.

Cross planning therefore requires knowledge of the protocol and specification—not just adding every possible cross.

Step 9: Separate coverage from assertions and checking

Functional coverage, assertions, and scoreboards provide different kinds of evidence.

Mechanism Main question Typical role
Scoreboard Was the observed behavior correct? Data/transaction-level checking
Assertion Was a temporal/protocol rule violated? Cycle-level invariant and protocol checking
Functional coverage Did an important scenario occur? Verification completeness measurement
Code coverage Which implementation structures executed? Implementation-oriented coverage measurement

These mechanisms complement one another. A test can execute a line of RTL without exercising the meaningful functional scenario associated with that line, and a scenario can occur without necessarily proving that the result was correct.

Step 10: Plan coverage closure from the beginning

Coverage planning should also anticipate what happens when a bin remains uncovered.

Uncovered item
  │
  ▼


Is the scenario required?
│
┌────┴────┐
No        Yes
│          │
▼          ▼
Remove/    Why was it
revise     not reached?
│
┌──────┼─────────┐
▼      ▼         ▼
Stimulus  Constraint  DUT/protocol
problem   problem     restriction
│      │         │
└──────┴─────────┘
│
▼
Update stimulus
or coverage plan

An uncovered bin is not automatically a test failure. It is a question that must be answered.

The scenario may be:

  • missing from the stimulus space
  • blocked by an overly restrictive constraint
  • infrequent and requiring directed stimulus
  • illegal according to the protocol
  • redundant with another coverage item
  • incorrectly sampled
  • an actual design scenario that has not yet been exercised

This is why coverage closure is an engineering process rather than simply trying to increase a percentage.

Exercise 1: Create a coverage plan

Consider a simple memory-mapped peripheral with:

  • read and write operations
  • four address regions
  • success and error responses
  • single-cycle and delayed responses

Create a coverage plan containing at least five coverage items. For each item, specify:

  1. the requirement it represents
  2. the transaction field or event used to observe it
  3. the important values or categories
  4. whether a cross is required

Exercise 2: Choose the sampling source

A sequence creates a write transaction, but the DUT accepts it only when valid && ready is true.

You need coverage for "accepted writes." Should the coverage model sample the sequence item, the driver input, or the monitor's reconstructed transaction?

Explain your choice and identify the event that should cause the transaction to count.

Exercise 3: Find the weak coverage model

Suppose an engineer proposes:

coverpoint tr.addr;

for a peripheral whose specification divides the address space into control, status, data, and reserved regions.

Explain why this may be a poor coverage model even if it produces a high coverage number. Propose a better functional coverage dimension.

Exercise 4: Decide whether a cross is meaningful

A protocol has three request types and two response types. One request type can legally produce only one of the response types.

Should every mathematical request × response combination automatically become a required coverage target?

Explain how the protocol specification should influence the coverage plan.

Advanced challenge: Build a requirements-to-coverage matrix

Select a protocol you have already verified and create a small requirements-to-coverage matrix.

For every requirement, record:

Requirement
│
├── Functional scenario
├── Coverage dimension
├── Sampling event
├── Transaction source
├── Important boundary cases
├── Required cross
└── Planned stimulus

Then review every coverage item and ask: "If this reaches 100%, what verification claim can I actually make?"

Remove coverage items that do not support a meaningful claim and add items for important behaviors that are currently invisible.

Knowledge check

  1. What is the primary purpose of functional coverage?
    To measure whether important functional scenarios, values, states, or combinations identified by the verification plan actually occurred.
  2. Why should coverage planning begin with requirements?
    Because coverage should measure meaningful verification goals rather than arbitrary DUT signals or implementation details.
  3. Does 100% functional coverage prove that the DUT is correct?
    No. Coverage shows that planned scenarios occurred; scoreboards, assertions, and other checkers provide correctness evidence.
  4. Why can sampling sequence items be misleading?
    A sequence item represents intended stimulus. The DUT may not actually accept or observe that transaction because of protocol handshaking or other conditions.
  5. When is a cross useful?
    When correctness or verification completeness depends on a meaningful combination of two or more functional dimensions.
  6. Is an uncovered bin automatically a verification failure?
    No. It should trigger investigation. The scenario may be required, illegal, unreachable, redundant, incorrectly sampled, or simply missing from stimulus.
  7. How does functional coverage differ from code coverage?
    Functional coverage measures planned behaviors and scenarios; code coverage measures execution of implementation structures such as statements, branches, or other tool-defined code metrics.

Connecting the module

Lesson 31 establishes the planning layer for the entire coverage and assertions module. The next lessons progressively turn this plan into executable measurement and checking.

Lesson 31


Functional Coverage Planning
│
▼
"What should we measure?"
│
▼
Lesson 32
Coverpoints and Bins
│
▼
"How do we divide behavior into measurable values?"
│
▼
Lesson 33
Cross Coverage
│
▼
"Which combinations matter?"
│
▼
Lesson 34
Coverage Sampling Architecture
│
▼
"When and where should coverage be sampled?"
│
▼
Lesson 35
Coverage Analysis
│
▼
"What do the results actually tell us?"
│
▼
Lesson 36
Coverage Closure
│
▼
"What should we do about the gaps?"
│
▼
Lessons 37–40
Assertions, Binding, Integration, Debugging

The central progression is: requirements → coverage plan → measurement → analysis → closure.

This prevents the coverage model from becoming a collection of arbitrary coverpoints whose percentages are difficult to interpret.

Key takeaways

  • Functional coverage measures whether planned functional behavior actually occurred.
  • Start coverage planning from requirements and verification risks, not from a list of DUT signals.
  • Choose sampling events that represent the behavior being measured; observed monitor transactions are often more meaningful than intended sequence items.
  • Coverage dimensions can represent values, boundaries, modes, transitions, relationships, and concurrency.
  • Use crosses only when the combinations represent meaningful verification goals.
  • Functional coverage, scoreboards, assertions, and code coverage answer different verification questions.
  • A high percentage is useful only when the underlying coverage model measures meaningful behavior.
  • An uncovered bin is evidence to investigate, not automatically evidence of a DUT failure.
  • A strong coverage plan makes later coverage implementation, analysis, and closure much more systematic.

Next lesson

In Lesson 32, you will turn the coverage plan into SystemVerilog coverage models. You will learn how coverpoint, bins, sampling functions, and transition-oriented coverage represent the functional dimensions identified here.