Home / Learn / Chip Design / Functional Coverage Explained

On this pageWhy it is neededCode coverage and functional coverageHow it is expressedA simple exampleCoverage-driven verificationClosing the gapsCommon pitfallsWhat good coverage looks likeIts role in sign-offCommon questionsRelated guides

Functional Coverage Explained

Functional coverage measures how much of a chip design’s intended behavior has been exercised during verification. Engineers define the situations that matter, such as each type of operation, each mode and each combination of conditions, and the tools record which of them have actually occurred in testing. It answers a question that passing tests alone cannot: have we tested the right things?

Why it is needed

Modern verification relies on randomly generated tests. Thousands of them can be run with little effort, and each explores a different path through the design.

Random testing raises an obvious problem. If nobody wrote each test by hand, nobody knows exactly what was tested. A million passing tests are reassuring only if they reached the situations that matter.

Functional coverage supplies that knowledge. It is the instrument that makes random testing measurable.

Code coverage and functional coverage

Two different measures are used together.

Code coverage is generated automatically by the simulator. It records which lines of the design’s code ran, which branches were taken and which signals changed value. It shows what parts of the implementation were touched.

Functional coverage is written by engineers from the specification. It records whether specific scenarios occurred. It shows whether the intended behavior was exercised.

Code coverageFunctional coverage
Created byThe tool, automaticallyEngineers, from the specification
MeasuresWhich code was executedWhich intended scenarios occurred
Can revealUntested codeUntested features and combinations
Cannot revealMissing featuresProblems in scenarios nobody listed
EffortLowSignificant

Neither is sufficient alone. Complete code coverage does not show that a feature was tested in every important situation, and it can never detect a feature that was left out of the design. Complete functional coverage shows only that the listed scenarios happened.

How it is expressed

In SystemVerilog, functional coverage is built from a few elements.

  • A covergroup collects related measurements.
  • A coverpoint tracks one variable, such as packet length or operation type.
  • Bins divide a coverpoint’s possible values into meaningful categories, such as minimum length, maximum length and typical lengths.
  • Cross coverage tracks combinations of two or more coverpoints, such as every operation type at every priority level.

Coverage can also be collected from assertions, recording that a particular sequence of events took place.

A simple example

Consider a block that handles network packets. A verification engineer might decide the following need to be seen.

  • Packets of minimum length, maximum length and several sizes in between
  • Each supported packet type
  • Packets arriving back to back, and packets with gaps between them
  • Each error condition
  • Every packet type at minimum and maximum length

The last item is a cross. It matters because bugs often lie in combinations, such as the largest packet of a rarely used type.

Coverage-driven verification

Coverage turns verification into a loop.

  • Write a plan listing what must be covered.
  • Implement the coverage model.
  • Run random tests and collect coverage.
  • Examine the gaps.
  • Adjust the test constraints, or write directed tests, to reach what is missing.
  • Repeat until the targets are met.

The percentage of coverage achieved becomes a principal measure of progress and one of the criteria for deciding the design is ready for manufacture.

Closing the gaps

The last few percent are usually the hardest. Each remaining hole falls into one of a few categories.

  • Reachable but unlikely. Random tests rarely produce it. Constraints are tightened or a directed test is written.
  • Unreachable. The design cannot get into that situation. This can be proven with formal methods and the item excluded.
  • Not applicable. The scenario is not relevant in this configuration and is waived with a documented reason.
  • A real problem. The design or the testbench prevents something that should be possible.

Every exclusion should be reviewed. Waiving coverage holes carelessly is a common way for bugs to escape.

Common pitfalls

  • Coverage without checking. Coverage records that a scenario occurred. It says nothing about whether the design responded correctly. Without a checker, a covered scenario proves little.
  • A weak coverage model. Reaching 100 percent of a model that omits important cases is meaningless.
  • Too many crosses. Combining many variables creates millions of bins, most of them irrelevant.
  • Chasing the number. The goal is confidence in the design, and the figure is only a proxy for it.
  • Stale models. Coverage must be updated when the specification changes.

What good coverage looks like

  • Derived directly from the verification plan, so each item traces to a requirement
  • Focused on boundaries, transitions and combinations where bugs concentrate
  • Sampled at the moment the scenario is known to be valid
  • Paired with checks that confirm correct behavior
  • Reviewed by designers as well as verification engineers

Its role in sign-off

Before a design is released for manufacture, teams review coverage alongside other evidence: code coverage, the trend in newly found bugs, formal results and the outcome of running real software. Functional coverage is central, but it is one input among several.

Common questions

Does 100 percent functional coverage mean the design has no bugs?

No. It means every scenario in the coverage model occurred. Scenarios that were never listed are not measured, and coverage alone does not confirm the design responded correctly.

Who writes functional coverage?

Verification engineers, working from the specification and the verification plan, usually with input from the designers.

Is functional coverage only used with UVM?

No. It is a feature of SystemVerilog and can be used in any testbench. It is closely associated with UVM because both support coverage-driven random verification.

Related guides