Formal verification basics interview questions
Formal vs simulation, proofs, counterexamples, bounded results and where formal fits in a project.
📚 Learn it first: Chapter 1: Welcome to Formal Verification · Chapter 2: How Formal Engines Think
Q1What is formal verification, and how is it different from simulation?
Basic
Simulation checks the behaviours your stimulus happens to produce. Formal verification uses mathematical engines (SAT, BDD, model checking) to reason about all legal input sequences at once.
- A formal proof means no legal input sequence of any length can violate the property.
- A formal failure comes with a short counterexample trace from reset that you can replay.
- Formal needs no testbench stimulus, but it needs assumptions that describe legal inputs, and it scales to smaller blocks than simulation.
A good one-line answer: "Simulation shows the presence of bugs for the tests I wrote; formal shows the absence of bugs for the properties I wrote."
Q2For which kinds of blocks is formal a good fit, and where is it a poor fit?
Basic
Good fit: control-heavy logic with deep corner cases but moderate state — arbiters, FIFOs and credit logic, FSMs, bus protocol bridges, interrupt controllers, cache-coherence controllers, clock-domain handshakes, register blocks, and anything where one missed corner case is expensive.
Poor fit (without abstraction): wide datapaths with multipliers or floating point, large memories, long serial pipelines (deep sequential depth), whole SoCs, and analog/mixed-signal behaviour.
Mention that formal and simulation are complementary: formal for exhaustive block-level control, simulation for system-level scenarios and performance.
Q3What is a counterexample (CEX) and how do you debug one?
Basic
A counterexample is a concrete trace, starting from reset, in which an assertion fails. Formal tools usually return the shortest such trace.
- Read the failing property and find the exact cycle where it fails.
- Walk backwards: which signals in the property were wrong, and what drove them?
- Decide whose fault it is: a real RTL bug, a wrong property, or a missing assumption (the inputs did something illegal).
- Fix the right thing, then re-run. Never add an assumption just to make a failure disappear without proving the input really cannot do that.
Q4What does a "bounded proof of depth 20" mean? Is it good enough?
Basic
It means the tool showed that no violation exists within 20 clock cycles of reset. It says nothing about cycle 21 and later, so it is not a full proof.
It can still be useful for signoff if you show the bound is deep enough: every interesting state must be reachable within it. The usual argument is to write covers for key scenarios (FIFO full, counter wrap, every FSM state, back-pressure) and check that all of them are hit at depths well below 20. If the deepest cover needs 25 cycles, a depth-20 bound is not sufficient.
Q5Explain assert, assume and cover in a formal environment.
Basic
- assert — something the design must guarantee. The tool tries to break it.
- assume — something the environment guarantees (usually about inputs). The tool only explores traces that satisfy it.
- cover — a scenario that should be possible. The tool tries to reach it and shows a trace.
assume property (@(posedge clk) !(push && full)); // environment: no push when full
assert property (@(posedge clk) count <= DEPTH); // design: never overflow
cover property (@(posedge clk) full ##1 pop); // reachable: full then drainFollow-up they like: "What happens if an assumption is wrong?" — it can hide real bugs by removing legal behaviour (over-constraint).
Q6What is a vacuous pass and how do you detect it?
Intermediate
An implication A |-> B passes trivially whenever A never happens. If A can never happen (because of a typo, a wrong reset polarity or an over-constraining assumption), the assertion is "proven" while checking nothing.
Detect it by covering the antecedent: cover property (A);. Most tools also report vacuity automatically. If the cover is unreachable, the proof is worthless until you find out why.
Q7What is the difference between a safety property and a liveness property?
Intermediate
- Safety: "something bad never happens" — e.g. two grants are never high together. A failure is a finite trace.
- Liveness: "something good eventually happens" — e.g. every request is eventually granted. A failure needs an infinite trace, shown as a loop (lasso) where the good thing never happens.
Liveness usually needs fairness assumptions (e.g. the receiver eventually becomes ready), otherwise the tool finds trivial loops where the environment stalls forever. Many teams convert liveness to bounded safety (req |-> ##[1:16] gnt) when a latency bound is part of the spec.
Q8Why does formal verification run out of capacity? What is state-space explosion?
Intermediate
Every flop doubles the number of potential states, so a design with n state bits has up to 2n states. Engines do not enumerate states one by one, but hard problems still grow quickly with:
- the number of state bits in the property's cone of influence,
- the sequential depth needed to reach interesting states (long counters, deep pipelines),
- complex arithmetic in the cone (multipliers are notoriously hard for SAT).
The remedies are covered in the convergence topic: reduce the cone, abstract counters and memories, add helper invariants, and split the problem.
Q9Name some formal engines and say briefly what each is good at.
Advanced
- BMC (bounded model checking): unrolls the design k cycles into a SAT problem. Great at finding bugs quickly; gives bounded proofs only.
- k-induction: proves a property holds for k cycles from reset and that k good cycles always imply a good next cycle. Full proofs when the property is inductive (often needs helper assertions).
- IC3 / PDR: builds inductive invariants incrementally. Strong at full proofs of safety properties.
- BDD-based reachability: exact, but memory blows up on larger designs; good for small control blocks.
- Interpolation: derives over-approximations of reachable states from BMC refutations.
Commercial tools run several engines in parallel and report whichever finishes first.
Q10What is the cone of influence (COI) and why does it matter?
Intermediate
The COI of a property is all the logic (flops, gates, inputs) that can affect the signals the property reads. Tools remove everything outside it before proving, so a property on a small part of a big design can still converge.
It matters for two reasons: performance (smaller cone, faster proof) and coverage — logic that is outside the COI of every assertion is not checked by your formal environment at all. COI coverage reports show such unverified logic.
Discussion
No comments yet.