Home / Learn / Chip Design / Formal Verification Explained
On this page
How it differs from simulationThe main kinds of formal verificationWhat a property looks likeThe three possible resultsWhere formal works bestWhere it strugglesCommon automated usesStrengths and limitationsHow it fits with simulationWhen to use itCommon questionsRelated guidesFormal Verification Explained
Formal verification uses mathematical proof to show that a chip design meets its specification. Simulation tries a selection of inputs and checks the results. A formal tool analyzes every possible input and state at once. It either proves that a required property always holds or produces a specific sequence of events that breaks it. This makes formal methods uniquely thorough within the limits of what they can handle.
How it differs from simulation
Simulation is like testing a bridge by driving trucks over it. Each test tells you about one scenario. However many you run, there may be a combination you did not try.
Formal verification is closer to calculating the bridge’s strength from its structure. If the proof succeeds, the property holds in all cases, including ones nobody would have thought to test.
The limitation is capacity. The number of possible states in a design grows explosively with its size, and formal tools can only cope with so much. They are applied to blocks or to specific questions, not to an entire large chip at once.
The main kinds of formal verification
Equivalence checking proves that two versions of a design do the same thing. It is used after synthesis and after layout to confirm that the gates still match the original RTL. This is the most widely used formal technique and is part of every chip project.
Property checking proves that a design satisfies stated properties. Engineers write assertions, such as “a request is always followed by a grant within four cycles”, and the tool checks them against the design. This is also called model checking.
Formal apps are packaged, automated uses of property checking for common problems. They need little or no expertise in formal methods.
What a property looks like
Properties are written as assertions, usually in the assertion language that is part of SystemVerilog. There are three kinds of statement.
- Assertions state what the design must do.
- Assumptions state what the environment is allowed to do, which restricts the inputs to legal behavior.
- Covers ask the tool to show that a particular situation can actually occur.
The tool examines the design under the assumptions and tries to find any way to break an assertion.
The three possible results
| Result | Meaning |
|---|---|
| Proven | The property holds in every reachable state |
| Counterexample | The tool found a sequence of inputs that violates the property |
| Inconclusive | The tool could not finish; often reported as a bounded proof to a certain depth |
A counterexample is valuable in itself. It is usually the shortest possible sequence that triggers the problem, which makes the bug easy to understand.
An inconclusive result means the property is true for all sequences up to some number of clock cycles, with nothing known beyond that. Whether that is sufficient depends on the design.
Where formal works best
- Control logic. Arbiters, state machines, handshake protocols and flow control. These have complex corner cases and relatively little data.
- Connectivity. Checking that signals are wired correctly across a large chip.
- Clock and reset crossings. Confirming that signals passing between domains are handled safely.
- Register access. Checking that control registers behave according to their specification.
- Security properties. Proving that protected data cannot reach an unprotected output.
- Unreachable code. Proving that a piece of logic can never be exercised, so that a coverage gap can be closed.
- Processor verification. Checking that a processor implements each instruction correctly.
Where it struggles
- Large data paths. Wide arithmetic, especially multiplication, creates enormous state spaces.
- Big memories and deep counters. These need abstraction techniques to make them tractable.
- Whole-chip verification. Too large for property checking, though connectivity checks work at this scale.
Engineers overcome some limits by simplifying the problem: replacing a large memory with a small model, breaking a proof into pieces or constraining the inputs.
Common automated uses
Formal apps have made the technique accessible to engineers who are not specialists.
- Connectivity checking
- Clock domain crossing analysis
- Detection of unreachable code
- Register verification
- Propagation of unknown values
- Checking low-power behavior
- Sequential equivalence, which compares two versions of a design that differ in timing
Strengths and limitations
Strengths
- Exhaustive within the scope of the proof
- Finds corner cases that random simulation would take a very long time to hit
- No testbench needed for many checks, so it can start early
- Short, clear counterexamples
Limitations
- Capacity restricts it to blocks and targeted problems
- Quality depends on the properties written. A proof only covers what was stated.
- Wrong assumptions give false confidence. If the assumptions exclude a real scenario, a bug there goes unseen.
- Skill is required for the harder problems
How it fits with simulation
Formal verification and simulation complement each other. A typical division of labor:
- Formal for control blocks, interfaces and specific properties
- Simulation for data-heavy blocks and for behavior across the whole subsystem
- Emulation for long scenarios with real software
Results from each can be combined when judging how completely the design has been checked.
When to use it
Formal methods are most valuable early. A designer can run properties on a block before any testbench exists and find bugs within hours of writing the code. Late in a project, formal is useful for closing the last coverage gaps and for investigating bugs that are hard to reproduce in simulation.
Common questions
Does formal verification replace simulation?
No. It is exhaustive where it applies but cannot handle whole large designs. Most projects use both, each where it is strongest.
What is a counterexample?
A specific sequence of inputs, found by the tool, that causes the design to violate a property. It shows the designer exactly how the failure happens.
Is formal verification only for experts?
Not any more. Automated applications for tasks such as connectivity and clock-crossing checks can be used with little training. Proving complex custom properties still benefits from specialist skill.