FPV: writing a formal testbench interview questions
Assumptions, over- and under-constraint, auxiliary code, end-to-end checks and data integrity.
📚 Learn it first: Chapter 4: Formal Property Verification (FPV) Basics · Chapter 6: FPV for Bug Hunting and Signoff · Chapter 9: When Proofs Lie: Avoiding False Positives · Chapter 13: Auxiliary Code and Modelling
Q1What does a formal property verification (FPV) testbench contain?
Basic
- The DUT with inputs left free (no stimulus).
- Assumptions describing legal input behaviour (protocol rules, stable configuration, reset sequence).
- Assertions for the required behaviour, from small local checks up to end-to-end checks.
- Covers for key scenarios.
- Optional auxiliary (modelling) code: counters, small reference models, trackers.
- Tool setup: clocks, reset, black boxes, engine and depth settings.
Usually written as a separate module and attached with bind, so the RTL is untouched.
Q2What are over-constraint and under-constraint? Which one is more dangerous?
Basic
- Over-constraint: assumptions rule out legal behaviour. Proofs pass but may miss real bugs — silently.
- Under-constraint: assumptions allow illegal input behaviour. You get false failures (CEXs that cannot happen in the system) — noisy but visible.
Over-constraint is more dangerous because nothing tells you something is wrong. Guard against it with covers, by reviewing assumptions with the designer, and by proving your assumptions as assertions on the neighbouring block (assume-guarantee).
Q3What is auxiliary (modelling) code and when do you use it?
Intermediate
Extra synthesizable logic in the formal testbench that makes a property easier to express — for example a counter of outstanding requests, a shadow copy of a register, or a small reference model.
// count outstanding requests, then check the design's credit logic against it
logic [3:0] outstanding;
always_ff @(posedge clk or negedge rst_n)
if (!rst_n) outstanding <= '0;
else outstanding <= outstanding + (req && gnt) - rsp;
assert property (@(posedge clk) outstanding <= MAX_OUT);
assert property (@(posedge clk) (outstanding == MAX_OUT) |-> !gnt);Keep it small and obviously correct — a bug in the model is a bug in the check.
Q4What is an end-to-end property and why is it preferred over many local checks?
Intermediate
An end-to-end property checks the block's contract from its inputs to its outputs ("every packet that goes in comes out once, unchanged, in order") rather than internal implementation details ("the write pointer increments when push is high").
It catches bugs anywhere in the block, survives RTL refactoring, and matches the spec. It is harder to converge, so teams combine it with local properties that act as helper invariants.
Q5How would you formally verify data integrity of a FIFO without modelling the whole FIFO?
Advanced
Track one symbolic item instead of all of them. Let the tool choose any data value and any moment to "tag" an incoming item. Count how many items are ahead of it, then check that when it reaches the output, the data matches.
// the tool picks the moment and the value (both stay free)
logic tracking, armed;
logic [7:0] tag_data;
logic [4:0] ahead; // items in front of the tracked one
// ... capture: on a push when !tracking and armed, store data and ahead=count
// ... each pop while tracking decrements ahead
assert property (@(posedge clk)
tracking && pop && (ahead == 0) |-> (dout == tag_data));Because the tagged moment and value are free, a proof covers every item and every value. This "tracked item" (symbolic data) technique scales to deep FIFOs and reorder buffers.
Q6What is assume-guarantee reasoning?
Advanced
You verify a system by verifying each block separately. Block B assumes rules about its inputs; those same rules must then be proven as assertions on block A that drives them. If every assumption is proven somewhere, the system-level result follows without ever running formal on the whole system.
Watch out for circular reasoning (A assumes what B guarantees while B assumes what A guarantees); tools and methodology should break such loops, e.g. with induction on time.
Q7Why do we use bind for formal properties?
Basic
bind for formal properties?bind attaches a checker module to every instance of a design module without editing the RTL file:
bind fifo fifo_props #(.DEPTH(DEPTH)) u_props (.*);It keeps verification code out of the design, lets the same properties run in simulation and formal, and lets the properties see internal signals via port connections.
Q8Can a formal proof be wrong? Give examples of "false positives".
Intermediate
The engine's math is sound, but the setup can make the result meaningless:
- an over-constraining assumption (or a contradictory set of assumptions — then everything passes),
- a vacuous implication whose antecedent can never happen,
- wrong reset or clock setup so the design never leaves reset,
- a black box or cut point that removed the logic you wanted to check,
- a bounded proof presented as a full proof.
Covers, vacuity checks, assumption reviews and coverage reports are the defences.
Q9How do formal tools treat X and uninitialised registers?
Advanced
Uninitialised flops (no reset) start with any value: the tool treats each as a free 0/1 choice, so all possible initial states are explored. X assignments in RTL are usually treated as "any value" too, which is more pessimistic than simulation's X-optimism.
That is useful: formal finds bugs where non-reset flops leak into outputs. If a flop truly needs no reset, write an assertion that its value never matters (e.g. data flop is only read when its valid bit, which is reset, is set).
Q10How would you decide which properties to write first for a new block?
Basic
- Read the spec and list the block's contract: what goes in, what must come out, what must never happen.
- Start with cheap, high-value checks: one-hot states, no overflow/underflow, handshake rules, no output without input.
- Add covers for main scenarios to sanity-check the environment.
- Then write end-to-end checks (data integrity, ordering, liveness/latency).
- Review assumptions with the designer before trusting any proof.
Discussion
No comments yet.