Division of Labour: The Gaps Between Proofs

Find what no proof covers after a design is divided: the glue, a missing case and a hack left in the file.

You Will Be Able To

  • Write a top-level property that crosses the glue between two proven blocks.
  • Prove that a case split is complete with one assertion.
  • Find a temporary ifdef FORMAL change and rerun without it.
  • Keep a ledger of blocks, cases and hacks for the sign-off review.
Lesson
F10.4
Time
18 min
Runs on
SymbiYosys
Check
5 questions

Two engineers each proved one block: the encoder never raised hi and lo together, and the server always gave hi the higher grant. A third person wrote the top level and crossed the two wires. Both proofs stayed green, and every high request got the low grant.

Each block is right, and the answer is wrong
01234clkfreelvl0210abgrant012level 2 requestedenc raises hi on wire agrant is 1
Scroll horizontally ↔

Measured with smtbmc yices at depth 20. Level 2 goes in at step 1, and grant 1 comes out at step 3. Wire a carries hi into the lo pin of the server.

The Wires Between Two Proofs

Who Proved WhatTwo blocks, each with its own proof, and two wires between them. The arrows are signals.
  • Design
  • Property
  • Data
  • Analysis
Who proved whatTwo blocks, each with its own proof, and two wires between them. The arrows are signals. design lvl top-level input design enc: proven never hi and lotogether design Glue: proven bynobody wire a to lo, wire b tohi design srv: proven hi wins property Top-levelproperty grant equals the leveltwo cycles ago design grant top-level output hi, locrossedchecks
  1. design lvltop-level input
    • enc: proven
  2. design enc: provennever hi and lo together
    • hi, lo → Glue: proven by nobody
  3. property Top-level propertygrant equals the level two cycles ago
    • checks → grant
  4. design Glue: proven by nobodywire a to lo, wire b to hi
    • crossed → srv: proven
  5. design srv: provenhi wins
    • grant
  6. design granttop-level output
Read the diagram as text
  • lvl: top-level input
  • enc: proven: never hi and lo together
  • Glue: proven by nobody: wire a to lo, wire b to hi
  • srv: proven: hi wins
  • Top-level property: grant equals the level two cycles ago
  • grant: top-level output
  • lvl → enc: proven
  • enc: proven → Glue: proven by nobody: hi, lo
  • Glue: proven by nobody → srv: proven: crossed
  • srv: proven → grant
  • Top-level property → grant: checks

Only the bottom-left box crosses the glue. Without it, the two green proofs say nothing about the pair.

RunMeasured resultTime
enc alone, its block propertyBMC PASS to depth 20437 ms
srv alone, its block propertyBMC PASS to depth 20437 ms
pair with crossed glue, both block propertiesBMC PASS to depth 20459 ms
pair with crossed glue, the top-level propertyFAIL at reported step 4468 ms
pair with straight glue, the top-level propertyBMC PASS to depth 20578 ms

Mode bmc, depth 20, smtbmc yices, reset assumed in step 0.

A block proof stops at the block's ports. The glue is everything outside every block: wires, inverters, small muxes. Someone must own it. Give it a top-level property, or a connectivity check (F5.3) when it is only wires.

A Case Split with a Hole

CaseIn the planMeasured result
FIXEDyespart of the run below
INCRyespart of the run below
WRAPno: "nothing changed there"never run
FIXED and INCR together-BMC PASS to depth 20
The cases cover every mode: busy |-> mode_q == FIXED || mode_q == INCR-FAIL at reported step 3

am steps an address inside a window. The last row is one extra assertion. Its trace shows mode_q at 2, which is WRAP.

A case split proves one property once per case (F4.3). The proof of the whole needs one more fact: the cases together are every legal input. Write that fact as an assertion and prove it. A list in a plan is not a proof.

A hard split uses an assumption per case, so a missing case is a missing run. A soft split uses a condition per assertion, so a missing case is a missing line. The completeness assertion catches both.

A Hack That Stayed

In the file since week two

`ifdef FORMAL
  localparam LIMIT = 3;    // temporary
`else
  localparam LIMIT = 40;
`endif

The watchdog barks after 3 quiet cycles. BMC PASS to depth 20.

What ships

localparam LIMIT = 40;
reg [4:0] cnt;

Five bits cannot count to 40, so the watchdog never barks. At depth 50: FAIL at reported step 42.

A smaller parameter is a sound way to start (F4.5). It becomes a false positive when nobody removes it. The same is true of a forced signal, a cut and an extra assumption added for one debug session. Search the RTL and the bench for FORMAL before sign-off, and justify or delete each hit.

The Ledger

RowQuestion at the reviewEvidence
Every blockWho proved it, and at which boundary?the proof report
Every wire and gate outside the blocksWhich property crosses it?a top-level or connectivity run
Every case splitDo the cases cover every legal input?the completeness assertion, proven
Every FORMAL hit, cut and extra assumptionIs it still needed, and is it sound?a run without it, or a written argument

The ledger is part of the sign-off page (F7.3). It is reviewed by someone outside the proof team.

Division of labour is the only way to prove a large design. Each division adds a seam. The ledger lists the seams, so that the parts add up to the whole.

Asked in Interviews

QuestionAnswer
Block A and block B are both proven. What is still unverified?The glue between them, and whether each block's assumptions hold at the other's outputs.
How do you know a case split is complete?An assertion that the disjunction of the cases covers every legal input, proven on the design.
What is the risk of ifdef FORMAL in RTL?The proven design differs from the shipped one. Every such change needs a removal or a justification.
Who should check the glue around a blackboxed analog block?Whoever owns the level above it. It must be named, because both block owners will assume the other does.

Try It

A block property

if (!rst && hi_q) assert(grant == 2'd2);

It reads the server's own pins. It cannot see which wire feeds them.

The top-level property

if (!rst && age == 2'd2)
  assert(grant == (lvl_qq == 2'd3 ? 2'd0 : lvl_qq));

It reads a top-level input and a top-level output, so it crosses the glue.

The task. top is pair; the two blocks are flattened into it.
[options]
mode bmc
depth 20
[engines]
smtbmc yices
[script]
read_verilog -formal -sv design.sv
prep -top pair
[files]
design.sv
  1. Run the block properties

    Run as it is: BMC PASS to depth 20. Both block properties are inside the pair.

  2. Add the top-level property

    Keep the level of two cycles ago in lvl_qq and assert that grant matches it: FAIL at reported step 4.

  3. Read the wires

    In the trace, follow a and b from the encoder to the server.

  4. Uncross the glue

    Connect a to hi and b to lo: BMC PASS to depth 20.

design.sv

props.sv

Use assert property (@(posedge clk) ...);. Leave blank for immediate assertions in the design.

Inputs are free unless constrained. Run to find a counterexample or check a proof.

Model: one positive-edge clock, binary data. Sampled history requires declaration-initialized variables; primary-input history is unsupported.

SBY summary and log

Check Yourself

Predict the outputThe wd bench without the ifdef: LIMIT is 40 and the counter has five bits. Mode bmc, depth 20, smtbmc yices, reset assumed in step 0. The check fires only after 40 quiet cycles. The verdict is:
module wd(input clk, rst, kick, output reg bark=0);
  localparam LIMIT = 40;
  reg [4:0] cnt=0;                // bug: five bits cannot count to 40
  always @(posedge clk)
    if (rst || kick) begin cnt <= 0; bark <= 0; end
    else begin
      cnt <= cnt + 1'b1;
      if (cnt == LIMIT - 1) bark <= 1;
    end
`ifdef FORMAL
  always @(posedge clk) begin
    if ($initstate) begin assume(rst); end else begin assume(!rst); end
  end
  reg [6:0] quiet=0;             // cycles since the last kick or reset
  always @(posedge clk) begin
    quiet <= rst || kick ? 7'd0 : quiet + 7'd1;
    if (!rst && quiet == LIMIT) assert(bark);
  end
`endif
endmodule
ConceptA soft split has assertions for cases A and B. Case C exists and has no assertion. What does the run report?
Read the waveformIn this top-level failure, which wire carries the wrong meaning at step 2?
Each block is right, and the answer is wrong
01234clkfreelvl0210abgrant012level 2 requestedenc raises hi on wire agrant is 1
Scroll horizontally ↔

Measured with smtbmc yices at depth 20. Level 2 goes in at step 1, and grant 1 comes out at step 3. Wire a carries hi into the lo pin of the server.

ConceptA split covers exponent values 0 to 31 and 33 to 63 of a 6-bit field. Which single check finds the gap?
ConceptWhich item does NOT belong in the ledger of hacks?

Common Mistakes

Wrong Counting green block proofs as a proof of the assembly.

No block property reads the wires outside its own ports.

Fix Add one end-to-end property per function, or a connectivity check, at the level that holds the glue.

Wrong Listing the cases in the plan and running them.

A missing case produces no failure, because nothing in the tool knows that it exists.

Fix Assert that the cases cover every legal input, and prove it.

Before
// cases: x4 and x8
assume property (@(posedge clk) width == X8);
After
assert property (@(posedge clk)
  width == X4 || width == X8 || width == X16);

Wrong Leaving ifdef FORMAL changes in the RTL after the proof converges.

The tool proves the file it reads, which is no longer the shipped design.

Fix Search for FORMAL at sign-off. Remove each hit or justify it in the ledger.

Remember

  • A block proof ends at the block's ports. The glue needs its own property.
  • A case split needs a proven assertion that the cases cover every legal input.
  • A reduced parameter, a cut or a force is a different design until it is removed or justified.
  • The ledger lists blocks, glue, cases and hacks, and someone outside the team reviews it.

Practice

Report a problem with this page