Cover image for Where to Use Formal Verification: a fit test on three real blocks. The arbiter (control) was proved in 0.24 s, the FIFO (data movement) with 4 helper facts, and the multiplier (arithmetic) gave no answer in 15 minutes at 12 bits. The Art of Verification.

Where to Use Formal Verification: A Fit Test on Three Real Blocks

In short: Use formal verification where the logic is control, the state is small, and the rule fits in one line of the spec: arbiters, state machines, handshakes and FIFO pointers. I ran one free formal flow on three blocks. It proved a round-robin arbiter in 0.24 s, proved an 8-deep FIFO keeps data in order once I added four helper facts, and did not finish a 12-bit multiplier in 15 minutes. Wide arithmetic, large memories and long pipelines need a plan first: a narrower width, an abstraction, or equivalence checking.

Formal also fits the glue logic of an SoC well. In SoC verification: the key areas a smoke test caught only 1 of 4 wiring bugs, and it took targeted checks on the pin mux, address decode and interrupts to catch all four.

Simulation has its own version of a proof’s blind spot. In RISC-V verification with an ISS golden model a lock-step bench passed because the core and its golden model shared the same mistake.

Clock logic shows the same split between rules and data. In Clock multiplication vs division the lock handshake assertions passed while a timed period check caught an early-lock bug.

Why does it matter where you use formal?

Formal verification can prove a rule holds for every input, on every cycle, forever. That sounds like it should replace simulation everywhere. It doesn’t, because the cost of a proof depends far more on what kind of logic the block holds than on how big it looks.

Point formal at the right block and it finishes in under a second with a proof no simulation can give you. Point it at the wrong one and it runs all night and tells you nothing. So the useful skill is not “how do I run formal”. It is “which block should I run it on first”.

In this post I take one free, open-source formal flow and run it on three small blocks: an arbiter, a FIFO and a multiplier. I time every run, plant bugs in each, and then run the same blocks in a UVM bench for comparison. The numbers make the fit test easy to remember.

The picture: a metal detector on a beach

A metal detector is perfect for finding a ring in a small patch of sand. It checks every inch, and it either beeps or proves the patch is clean.

Now ask it to clear a whole beach, inch by inch. It still works, in theory. In practice you run out of day long before you run out of sand.

Formal is the detector. Control logic is the small patch: few states, every one checked fast. Wide arithmetic is the beach: the tool is not wrong, there is just too much ground. The trick is knowing which one you are standing on before you start sweeping.

What will you learn in this post?

By the end of this post you will be able to:

  • Use a five-question fit test to rank blocks for formal before you write a single property.
  • Explain why control logic proves fast, why data movement needs a trick, and why wide arithmetic blows up.
  • Use the tracked-word trick to prove a FIFO keeps data in order, without modelling every entry.
  • Tell a bounded check from a full proof, and know when helper facts are needed to finish one.
  • Decide what to give formal, what to give simulation, and where you need both.

What makes a block a good fit for formal?

Before I write a single property, I ask five questions about the block. The more yes answers, the sooner formal pays for itself.

  1. Is it control, not number crunching? Arbiters, state machines, handshakes and flow control are decisions between a few options. A solver handles decisions well.
  2. Is the interesting state small? A few pointers, a few flags, short counters. Every extra bit of state the rule depends on doubles the space the tool has to cover.
  3. Can I write the rule in one line from the spec? “Never grant two requesters.” “Data leaves in the order it came in.” Short rules make short proofs, and they are easy to review.
  4. Is the bug hard to reach in simulation? A corner that needs five things to line up is cheap for formal and expensive for random stimulus.
  5. Would a miss be expensive? Deadlock, a lost transaction, a security mode that turns on when it shouldn’t. These are the bugs you want proved absent, not just not seen.

There are also three warning signs. Wide arithmetic, such as multipliers, dividers and floating point. Large memories, where the data itself is the state. And long pipelines, where a rule only resolves many cycles later. None of these rules formal out, but each one needs a plan before you start: a narrower width, an abstraction, or a different tool such as equivalence checking.

The rest of this post tests those questions on three real blocks, one from each group.

Diagram: the formal fit test. Five questions: is the block control rather than number crunching, is the interesting state small, does the rule fit in one line of spec, is the bug hard to reach in simulation, and would a miss be expensive. Warning signs: wide arithmetic, large memories, long pipelines. Plans for those: prove a narrower version, abstract the data and track one item, prove the building blocks one by one, or use equivalence checking.
Five questions to ask before you write a single property.

How do three real blocks score on the fit test?

I picked one block from each group and gave all three the same treatment: the same open-source formal flow (Yosys 0.33, yosys-smtbmc and the Z3 4.8.12 solver), the same machine, every run timed. Then I planted bugs and ran the same blocks in a UVM bench on VCS.

The three blocks

  • tav_rr_arb4, a 4-requester round-robin arbiter. Pure control. The state is a 2-bit pointer and a 4-bit grant. Rules: the grant is one-hot or zero, it only goes to a requester that asked, someone is granted whenever anyone asked, and nobody waits more than 4 cycles. Fit test: five yes.
  • tav_fifo8, an 8-deep, 8-bit FIFO. Data movement. The pointers and count are small, but 64 bits of memory are state too. Rules: count, full and empty match a simple model, and data leaves in the order it arrived. Fit test: yes, with a trick for the data.
  • tav_mult, a W x W multiplier built from shift-and-add. Arithmetic. No state at all, one rule: p == a * b. Fit test: a warning sign.

The planted bugs

Block+BUG=1+BUG=2
ArbiterThe pointer stays put after granting requester 2, so requester 3 can starveGrants the last winner when nobody asked
FIFOThe read pointer skips entry 6A push while full is not ignored and overwrites a stored word
Multiplier0xFFFF x 0xFFFF gives a wrong answer: one input pair out of 2^32 at 16 bitsnone

How does formal check data order without modelling the whole FIFO?

With the tracked-word trick. The harness has a free input, pick, and the solver can raise it on any push. That word is saved, and a small counter remembers how many words were ahead of it. Each pop counts down. When the counter reaches zero and the next pop happens, dout must equal the saved word.

Because the solver can pick any push, with any data, at any time, one tracker covers every word. That is the whole idea: let the tool choose the case instead of modelling all of them.

Diagram: testbench architecture. The same three blocks, tav_rr_arb4, tav_fifo8 and tav_mult, go to a formal harness on Yosys and Z3, where the solver chooses every input, and to a UVM bench on VCS with a random sequence, driver, monitor, scoreboard with a spec model per block, SVA assertions in the interface, and a RESULT and REACH report per block.
One formal flow and one UVM bench, on the same three blocks.

What did formal find on each block?

I ran the harness on 24 Nov 2026 with Yosys 0.33, yosys-smtbmc and Z3 4.8.12. The tools are free, so you can repeat every number below.

BlockBounded check, clean, 20 stepsFull proof+BUG=1 found at+BUG=2 found at
ArbiterPASSED in 0.98 sPASSED in 0.24 sstep 7step 3
FIFOPASSED in 2.56 sPASSED in 0.19 s, with 4 helper factsstep 9step 11
Multiplier, 8 bitPASSED in 14.20 sthe same run: it has no state, so one step covers every a and bfound in 1.56 sno bug

The arbiter: all five yes, and it shows

Every run finished in under a second, including the full proof. The starvation bug needed 7 steps: requester 2 keeps winning, requester 3 keeps asking, and the fairness rule breaks when the wait passes 4. The grant-with-no-request bug needed only 3.

This is what a good fit looks like. Small state, short rules, and a proof that costs less time than reading the log.

The FIFO: a good fit, with two catches

The tracked-word check found both bugs in 9 and 11 steps, and the bounded check to 20 steps passed in 2.56 s. The full proof also passed, in 0.19 s, but only because of four helper facts: the model count never passes 8, the tracked word has fewer words ahead of it than are stored, the word at that slot still holds the saved value, and the write pointer equals the read pointer plus the count.

I took the four helper facts out to see what happens. Induction then failed on the data-order check, even with a 20-step window. The counterexample started from a state reset can never reach. The bounded check slowed down too: it did not finish 20 steps in 110 s, against 2.56 s with the helpers. Helper facts are not just for the proof. They also keep the solver out of states that cannot happen.

The multiplier: no state at all, and still the hardest

The multiplier has no registers. One step of the bounded check covers every possible a and b, so a pass is already a full proof. That sounds easy. It isn’t.

Chart: multiplier formal run time against width, log scale. Proving p equals a times b took 0.10 s at 4 bits, 0.16 s at 5, 0.53 s at 6, 2.71 s at 7, 14.20 s at 8, 104 s at 9 and 516 s at 10. Finding the one bad input pair took 0.08 s at 4 bits up to 8.00 s at 10. At 12 bits neither finished in 15 minutes.
A multiplier proof grows 5 to 7 times per bit from 7 bits on.

At 4 bits the proof took 0.10 s. At 10 bits it took 516 s. At 12 bits it did not finish in 15 minutes, and neither did the search for the one bad input pair. From 7 bits on, each extra bit multiplied the proof time by 5 to 7.

That is the beach from the opening. The tool is not wrong. There is just too much ground. For a real 16 or 32-bit datapath, prove a narrow version, prove the adder and shifter steps one at a time, or use equivalence checking against a trusted model.

What did simulation see on the same blocks?

I ran the UVM bench three times on Synopsys VCS X-2025.06-SP1 on EDA Playground: 20,002 checked cycles per block per run, a spec model for each block, and assertions for the rules the harness also proves. The multiplier in the bench is the full 16 bits.

Results grid: where each method won. Arbiter: clean design proved in 0.24 s; +BUG=1 caught by random simulation with 4,078 mismatches and by formal at step 7; +BUG=2 caught by simulation from cycle 2 and by formal at step 3. FIFO: proved in 0.19 s; +BUG=1 caught by simulation from cycle 16 and by formal at step 9; +BUG=2 caught from cycle 69 and at step 11. Multiplier: simulation passed the clean design and missed +BUG=1 because the bad input pair never came up; formal found it in 1.56 s at 8 bits but not in 15 minutes at 12 bits.
Where each method won, from the VCS logs and the Yosys runs.

On the arbiter and the FIFO, random simulation caught every bug, and fast: the earliest arbiter mismatch came at cycle 2 (+BUG=2) and the earliest FIFO one at cycle 16 (+BUG=1). These blocks are small, so random stimulus visits their corners all the time. The FIFO was full on 1,408 cycles of the clean run and took 688 pushes while full.

One detail is worth a second look. The starvation bug, +BUG=1 on the arbiter, gave 4,078 mismatches but 0 assertion fails, because the bench has no fairness assertion. The spec model caught it. Formal caught it with the fairness rule, at step 7.

On the multiplier, simulation passed +BUG=1 without a single mismatch. The REACH line says why: in 20,002 cycles, a and b were both 0xFFFF exactly 0 times. With 2^32 possible input pairs, random stimulus would need about 4.3 billion cycles on average to hit that one pair once.

So the blocks split cleanly. On control and data movement, simulation found the bugs and formal added what simulation can’t: a proof that no bug is left. On wide arithmetic, neither method won alone. That is the block that needs a plan: exhaustive simulation or formal at a narrow width, then equivalence checking for the real one.

The code

Both files, with their expected output, are also on GitHub in the course repo: tav-verification-basics, bonus-where-to-use-formal.

Two files. The formal harness runs on free, open-source Yosys. It carries its own copy of all three blocks, so it is one file. It is not a simulation testbench, so do not run it in VCS:

// tav_where_formal_fv.sv : one formal flow, three blocks, to see where formal fits
// Run on Yosys 0.33, yosys-smtbmc and Z3 4.8.12, 24 Nov 2026.
// The Art of Verification | theartofverification.com
//
// This is a formal harness, not a simulation testbench: run it with Yosys, not VCS.
// Pick a top (tav_fv_arb, tav_fv_fifo or tav_fv_mult) and a BUG value (0 = clean):
//   yosys -q -p "read_verilog -sv -formal tav_where_formal_fv.sv; \
//                chparam -set BUG 0 tav_fv_arb; prep -top tav_fv_arb; async2sync; dffunmap; \
//                write_smt2 -wires arb.smt2"
//   yosys-smtbmc -s z3 --unroll -t 20 arb.smt2       (bounded check, 20 cycles)
//   yosys-smtbmc -s z3 --unroll -i -t 20 arb.smt2    (induction: a full proof)
// For the multiplier, also set its width (chparam -set W 8 -set BUG 0 tav_fv_mult) and use -t 1:
// it has no state, so one step checks every a and b.
// --unroll matters: without it, this Z3 version stalled on the FIFO in my runs.

// ---------------------------------------------------------------------------
// Block 1: a 4-requester round-robin arbiter (control logic)
// Spec: gnt is one-hot or zero, gnt goes only to a requester that asked last cycle,
// someone is granted whenever anyone asked, and the search for the next winner
// starts just after the last winner.
// ---------------------------------------------------------------------------
module tav_rr_arb4 (input logic clk, rst_n, input logic [3:0] req,
                    output logic [3:0] gnt, input int bug);
  logic [1:0] last;
  logic [1:0] pick;
  logic       found;
  always_comb begin
    found = 0; pick = last;
    for (int k = 1; k <= 4; k++)
      if (!found && req[(last + k) % 4]) begin found = 1; pick = (last + k) % 4; end
  end
  always_ff @(posedge clk or negedge rst_n)
    if (!rst_n) begin gnt <= 0; last <= 3; end
    else if (found) begin
      gnt  <= 4'b1 << pick;
      if (!(bug == 1 && pick == 2)) last <= pick;          // BUG=1: pointer stuck after granting 2
    end else gnt <= (bug == 2) ? (4'b1 << last) : 4'b0;   // BUG=2: grants with no request
endmodule

module tav_fv_arb #(parameter int BUG = 0) (input logic clk, input logic [3:0] req);
  reg init = 1; always @(posedge clk) init <= 0;
  logic [3:0] gnt;
  tav_rr_arb4 dut (.clk(clk), .rst_n(!init), .req(req), .gnt(gnt), .bug(BUG));
  logic [3:0] req_q;  always @(posedge clk) req_q <= init ? 4'b0 : req;   // requests while in reset don't count
  // how long each requester has been asking without a grant
  logic [3:0] wait_cnt [4];
  always @(posedge clk) for (int i = 0; i < 4; i++)
    wait_cnt[i] <= (init || !req[i] || gnt[i]) ? 0 : (wait_cnt[i] == 15 ? 15 : wait_cnt[i] + 1);
  always @(posedge clk) if (!init) begin
    assert ((gnt & (gnt - 1)) == 0);                    // one-hot or zero
    assert ((gnt & ~req_q) == 0);                       // only to a requester that asked
    assert ((req_q == 0) || (gnt != 0));                // nobody left waiting when someone asked
    for (int i = 0; i < 4; i++) assert (wait_cnt[i] <= 4);   // fairness: served within 4 cycles
  end
`ifndef FORMAL
  // Yosys defines FORMAL for read_verilog -formal. Any simulator lands here instead.
  initial $fatal(1, "tav_where_formal_fv.sv is a formal harness: run it with Yosys (see the header), not in a simulator. For VCS, use tav_where_formal_uvm.sv.");
`endif
endmodule

// ---------------------------------------------------------------------------
// Block 2: an 8-deep, 8-bit FIFO (data movement)
// Spec: data comes out in the order it went in; full at 8, empty at 0;
// a push while full and a pop while empty are ignored.
// ---------------------------------------------------------------------------
module tav_fifo8 (input logic clk, rst_n, push, pop, input logic [7:0] din,
                  output logic [7:0] dout, output logic full, empty, output logic [3:0] count,
                  input int bug,
                  // debug view for the formal helper facts (not used by the design)
                  output logic [2:0] dbg_wp, dbg_rp, input logic [2:0] dbg_idx, output logic [7:0] dbg_word);
  logic [7:0] mem [8];
  logic [2:0] wp, rp;
  logic do_push, do_pop;
  assign full = (count == 8); assign empty = (count == 0);
  assign do_push = push && (!full || bug == 2);                    // BUG=2: a push while full is not ignored
  assign do_pop  = pop && !empty;
  assign dout = mem[rp];
  assign dbg_wp = wp; assign dbg_rp = rp; assign dbg_word = mem[dbg_idx];
  always_ff @(posedge clk or negedge rst_n)
    if (!rst_n) begin wp <= 0; rp <= 0; count <= 0; end
    else begin
      if (do_push) begin mem[wp] <= din; wp <= wp + 1; end
      if (do_pop)  rp <= (bug == 1 && rp == 5) ? 3'd7 : rp + 1;   // BUG=1: read pointer skips entry 6
      count <= count + do_push - do_pop;
    end
endmodule

// The tracked-word trick: the tool picks one push to watch (any push, any time),
// counts how many words are ahead of it, and checks that word when it reaches the head.
module tav_fv_fifo #(parameter int BUG = 0)
  (input logic clk, input logic push, pop, input logic [7:0] din, input logic pick);
  reg init = 1; always @(posedge clk) init <= 0;
  logic [7:0] dout; logic full, empty; logic [3:0] count;
  logic [2:0] wp, rp; logic [7:0] word_at;
  logic       armed, done;
  logic [7:0] tdata;
  logic [3:0] ahead;          // words in front of the tracked word
  tav_fifo8 dut (.clk(clk), .rst_n(!init), .push(push), .pop(pop), .din(din),
                 .dout(dout), .full(full), .empty(empty), .count(count), .bug(BUG),
                 .dbg_wp(wp), .dbg_rp(rp), .dbg_idx(rp + ahead[2:0]), .dbg_word(word_at));
  wire do_push = push && !full, do_pop = pop && !empty;
  always @(posedge clk)
    if (init) begin armed <= 0; done <= 0; ahead <= 0; end
    else if (!armed && !done && pick && do_push) begin
      armed <= 1; tdata <= din; ahead <= count - do_pop;
    end else if (armed && do_pop) begin
      if (ahead == 0) begin armed <= 0; done <= 1; end else ahead <= ahead - 1;
    end
  // a model of how many words are stored
  logic [3:0] m_count;
  always @(posedge clk) m_count <= init ? 0 : m_count + do_push - do_pop;
  always @(posedge clk) if (!init) begin
    assert (count == m_count);                          // occupancy matches the model
    assert (full == (m_count == 8) && empty == (m_count == 0));
    if (armed && ahead == 0 && do_pop) assert (dout == tdata);   // the tracked word comes out intact, in order
    // helper facts for induction (true by construction, they stop the proof wandering into unreachable states)
    assert (m_count <= 8);
    if (armed) assert (ahead < m_count);
    if (armed) assert (word_at == tdata);
    assert (wp == rp + m_count[2:0]);
  end
`ifndef FORMAL
  // Yosys defines FORMAL for read_verilog -formal. Any simulator lands here instead.
  initial $fatal(1, "tav_where_formal_fv.sv is a formal harness: run it with Yosys (see the header), not in a simulator. For VCS, use tav_where_formal_uvm.sv.");
`endif
endmodule

// ---------------------------------------------------------------------------
// Block 3: a W x W multiplier built from shift-and-add (arithmetic)
// Spec: p == a * b for every a and b.
// ---------------------------------------------------------------------------
module tav_mult #(parameter int W = 8) (input logic [W-1:0] a, b, output logic [2*W-1:0] p,
                                        input int bug);
  always_comb begin
    p = 0;
    for (int i = 0; i < W; i++)
      if (b[i]) p = p + ({{W{1'b0}}, a} << i);
    // BUG=1: one input pair out of all of them gives a wrong answer: all ones times all ones
    if (bug == 1 && a == {W{1'b1}} && b == {W{1'b1}}) p[0] = ~p[0];
  end
endmodule

module tav_fv_mult #(parameter int W = 8, parameter int BUG = 0) (input logic clk, input logic [W-1:0] a, b);
  logic [2*W-1:0] p;
  tav_mult #(.W(W)) dut (.a(a), .b(b), .p(p), .bug(BUG));
  always @* assert (p == a * b);   // combinational: checked on every step
`ifndef FORMAL
  // Yosys defines FORMAL for read_verilog -formal. Any simulator lands here instead.
  initial $fatal(1, "tav_where_formal_fv.sv is a formal harness: run it with Yosys (see the header), not in a simulator. For VCS, use tav_where_formal_uvm.sv.");
`endif
endmodule

The UVM bench, every name starting with tav_: paste it into EDA Playground, pick Synopsys VCS with UVM 1.2, set the top module to tav_top, and run. Add +BUG=1 or +BUG=2 to switch a bug on in all three blocks at once.

// tav_where_formal_uvm.sv : three blocks, one random UVM bench, to compare with the formal runs (UVM 1.2)
// Run on Synopsys VCS X-2025.06-SP1 with UVM 1.2 (EDA Playground), 25 Nov 2026.
// The Art of Verification | theartofverification.com
//
// EDA Playground: Synopsys VCS, UVM 1.2, top module "tav_top".
// Paste this whole file into testbench.sv and leave design.sv empty.
//
// The same three blocks as the formal harness tav_where_formal_fv.sv:
//   ARB   a 4-requester round-robin arbiter (control logic)
//   FIFO  an 8-deep, 8-bit FIFO (data movement)
//   MULT  a 16 x 16 shift-and-add multiplier (arithmetic)
// One test drives all three with 20,000 cycles of random stimulus. A spec model checks
// every output, SVA assertions check rules the formal harness also proves, and
// the scoreboard prints one RESULT line and one REACH line per block.
//
// Run options (one per run):
//   (none)    the clean design
//   +BUG=1    ARB: the pointer stays put after granting requester 2
//             FIFO: the read pointer skips entry 6
//             MULT: 0xFFFF x 0xFFFF gives a wrong answer (one input pair in 2^32)
//   +BUG=2    ARB: grants the last winner when nobody asks
//             FIFO: a push while full is not ignored
//             MULT: no bug
//
// Spec:
//   ARB   gnt is one-hot or zero, goes only to a requester that asked last cycle, someone is
//         granted whenever anyone asked, and the search starts just after the last winner
//         (requester 0 first after reset).
//   FIFO  data comes out in the order it went in; full at 8, empty at 0; a push while full
//         and a pop while empty are ignored. dout shows the oldest word.
//   MULT  p == a * b for every a and b.

`timescale 1ns/1ns
`include "uvm_macros.svh"
import uvm_pkg::*;

// ---------------------------------------------------------------------------
// The designs (the same logic as the formal harness; the formal copy of the FIFO adds a debug view)
// ---------------------------------------------------------------------------
module tav_rr_arb4 (input logic clk, rst_n, input logic [3:0] req,
                    output logic [3:0] gnt, input int bug);
  logic [1:0] last;
  logic [1:0] pick;
  logic       found;
  always_comb begin
    found = 0; pick = last;
    for (int k = 1; k <= 4; k++)
      if (!found && req[(last + k) % 4]) begin found = 1; pick = (last + k) % 4; end
  end
  always_ff @(posedge clk or negedge rst_n)
    if (!rst_n) begin gnt <= 0; last <= 3; end
    else if (found) begin
      gnt  <= 4'b1 << pick;
      if (!(bug == 1 && pick == 2)) last <= pick;          // BUG=1: pointer stuck after granting 2
    end else gnt <= (bug == 2) ? (4'b1 << last) : 4'b0;   // BUG=2: grants with no request
endmodule

module tav_fifo8 (input logic clk, rst_n, push, pop, input logic [7:0] din,
                  output logic [7:0] dout, output logic full, empty, output logic [3:0] count,
                  input int bug);
  logic [7:0] mem [8];
  logic [2:0] wp, rp;
  logic do_push, do_pop;
  assign full = (count == 8); assign empty = (count == 0);
  assign do_push = push && (!full || bug == 2);                    // BUG=2: a push while full is not ignored
  assign do_pop  = pop && !empty;
  assign dout = mem[rp];
  always_ff @(posedge clk or negedge rst_n)
    if (!rst_n) begin wp <= 0; rp <= 0; count <= 0; end
    else begin
      if (do_push) begin mem[wp] <= din; wp <= wp + 1; end
      if (do_pop)  rp <= (bug == 1 && rp == 5) ? 3'd7 : rp + 1;   // BUG=1: read pointer skips entry 6
      count <= count + do_push - do_pop;
    end
endmodule

module tav_mult #(parameter int W = 16) (input logic [W-1:0] a, b, output logic [2*W-1:0] p,
                                         input int bug);
  always_comb begin
    p = 0;
    for (int i = 0; i < W; i++)
      if (b[i]) p = p + ({{W{1'b0}}, a} << i);
    // BUG=1: one input pair out of all of them gives a wrong answer: all ones times all ones
    if (bug == 1 && a == {W{1'b1}} && b == {W{1'b1}}) p[0] = ~p[0];
  end
endmodule

// ---------------------------------------------------------------------------
// Interface: the pins of all three blocks, and the same rules the formal harness proves
// ---------------------------------------------------------------------------
interface tav_blocks_if (input logic clk);
  logic        rst_n;
  logic [3:0]  req, gnt;
  logic        push, pop, full, empty;
  logic [7:0]  din, dout;
  logic [3:0]  count;
  logic [15:0] a, b;
  logic [31:0] p;
  clocking mon_cb @(posedge clk);
    default input #1step;
    input rst_n, req, gnt, push, pop, full, empty, din, dout, count, a, b, p;
  endclocking

  // Each assertion reports its first 3 fails and then switches itself off, so a bug that
  // fires all the time cannot flood the log (EDA Playground stops at 5,000 lines).
  // The scoreboard still counts every mismatch.
  int tav_fails [4];   // A_ARB_ONEHOT, A_ARB_ASKED, A_FIFO_FLAGS, A_MULT

  A_ARB_ONEHOT: assert property (@(posedge clk) disable iff (!rst_n) $onehot0(gnt))
    else begin
      tav_fails[0]++; `uvm_error("SVA", $sformatf("A_ARB_ONEHOT: gnt=%b", $sampled(gnt)))
      if (tav_fails[0] == 3) $assertoff(0, A_ARB_ONEHOT);
    end
  A_ARB_ASKED: assert property (@(posedge clk) disable iff (!rst_n) $past(rst_n) |-> (gnt & ~$past(req)) == 0)
    else begin
      tav_fails[1]++; `uvm_error("SVA", $sformatf("A_ARB_ASKED: gnt=%b, req last cycle=%b", $sampled(gnt), $past(req)))
      if (tav_fails[1] == 3) $assertoff(0, A_ARB_ASKED);
    end
  A_FIFO_FLAGS: assert property (@(posedge clk) disable iff (!rst_n) count <= 8 && full == (count == 8) && empty == (count == 0))
    else begin
      tav_fails[2]++; `uvm_error("SVA", $sformatf("A_FIFO_FLAGS: count=%0d full=%b empty=%b", $sampled(count), $sampled(full), $sampled(empty)))
      if (tav_fails[2] == 3) $assertoff(0, A_FIFO_FLAGS);
    end
  A_MULT: assert property (@(posedge clk) disable iff (!rst_n) p == a * b)
    else begin
      tav_fails[3]++; `uvm_error("SVA", $sformatf("A_MULT: %h x %h gave %h", $sampled(a), $sampled(b), $sampled(p)))
      if (tav_fails[3] == 3) $assertoff(0, A_MULT);
    end
endinterface

// ---------------------------------------------------------------------------
// Transaction: one clock cycle of stimulus for all three blocks
// ---------------------------------------------------------------------------
class tav_blocks_item extends uvm_sequence_item;
  rand bit [3:0]  req;
  rand bit        push, pop;
  rand bit [7:0]  din;
  rand bit [15:0] a, b;
  bit             rst;
  `uvm_object_utils(tav_blocks_item)
  function new(string name = "tav_blocks_item");
    super.new(name);
  endfunction
endclass

class tav_blocks_cycle extends uvm_object;
  bit          rst;
  bit [3:0]    req;
  logic [3:0]  gnt;
  bit          push, pop;
  logic        full, empty;
  bit [7:0]    din;
  logic [7:0]  dout;
  logic [3:0]  count;
  bit [15:0]   a, b;
  logic [31:0] p;
  `uvm_object_utils(tav_blocks_cycle)
  function new(string name = "tav_blocks_cycle");
    super.new(name);
  endfunction
endclass

// ---------------------------------------------------------------------------
// Sequences
// ---------------------------------------------------------------------------
class tav_reset_seq extends uvm_sequence #(tav_blocks_item);
  `uvm_object_utils(tav_reset_seq)
  function new(string name = "tav_reset_seq");
    super.new(name);
  endfunction
  task body();
    req = tav_blocks_item::type_id::create("req");
    start_item(req);
    req.rst = 1;
    finish_item(req);
  endtask
endclass

class tav_random_seq extends uvm_sequence #(tav_blocks_item);
  `uvm_object_utils(tav_random_seq)
  int unsigned n = 20000;
  function new(string name = "tav_random_seq");
    super.new(name);
  endfunction
  task body();
    repeat (n) begin
      req = tav_blocks_item::type_id::create("req");
      start_item(req);
      if (!req.randomize()) `uvm_fatal("RAND", "randomize failed")
      finish_item(req);
    end
  endtask
endclass

// ---------------------------------------------------------------------------
// Driver: drives on the falling edge
// ---------------------------------------------------------------------------
class tav_blocks_driver extends uvm_driver #(tav_blocks_item);
  `uvm_component_utils(tav_blocks_driver)
  virtual tav_blocks_if vif;
  function new(string name, uvm_component parent);
    super.new(name, parent);
  endfunction
  function void build_phase(uvm_phase phase);
    if (!uvm_config_db#(virtual tav_blocks_if)::get(this, "", "vif", vif))
      `uvm_fatal("NOVIF", "no virtual interface")
  endfunction
  task idle();
    vif.req <= 0; vif.push <= 0; vif.pop <= 0;
  endtask
  task run_phase(uvm_phase phase);
    vif.rst_n <= 0; idle(); vif.din <= 0; vif.a <= 0; vif.b <= 0;
    forever begin
      seq_item_port.get_next_item(req);
      @(negedge vif.clk);
      if (req.rst) begin
        vif.rst_n <= 0; idle();
        @(negedge vif.clk);
        vif.rst_n <= 1;
      end else begin
        vif.req <= req.req; vif.push <= req.push; vif.pop <= req.pop; vif.din <= req.din;
        vif.a <= req.a; vif.b <= req.b;
      end
      seq_item_port.item_done();
    end
  endtask
endclass

// ---------------------------------------------------------------------------
// Monitor: one snapshot of all pins per clock
// ---------------------------------------------------------------------------
class tav_blocks_monitor extends uvm_monitor;
  `uvm_component_utils(tav_blocks_monitor)
  virtual tav_blocks_if vif;
  uvm_analysis_port #(tav_blocks_cycle) ap;
  function new(string name, uvm_component parent);
    super.new(name, parent);
    ap = new("ap", this);
  endfunction
  function void build_phase(uvm_phase phase);
    if (!uvm_config_db#(virtual tav_blocks_if)::get(this, "", "vif", vif))
      `uvm_fatal("NOVIF", "no virtual interface")
  endfunction
  task run_phase(uvm_phase phase);
    forever begin
      tav_blocks_cycle t;
      @(vif.mon_cb);
      t = tav_blocks_cycle::type_id::create("t");
      t.rst  = (vif.mon_cb.rst_n !== 1'b1);
      t.req  = vif.mon_cb.req;   t.gnt   = vif.mon_cb.gnt;
      t.push = vif.mon_cb.push;  t.pop   = vif.mon_cb.pop;   t.din = vif.mon_cb.din;
      t.dout = vif.mon_cb.dout;  t.full  = vif.mon_cb.full;  t.empty = vif.mon_cb.empty;
      t.count = vif.mon_cb.count;
      t.a = vif.mon_cb.a; t.b = vif.mon_cb.b; t.p = vif.mon_cb.p;
      ap.write(t);
    end
  endtask
endclass

// ---------------------------------------------------------------------------
// Scoreboard: a spec model for each block, and how far the stimulus reached
// ---------------------------------------------------------------------------
class tav_blocks_scoreboard extends uvm_scoreboard;
  `uvm_component_utils(tav_blocks_scoreboard)
  uvm_analysis_imp #(tav_blocks_cycle, tav_blocks_scoreboard) imp;

  // models
  bit [3:0]  m_gnt;   bit [1:0] m_last;
  bit [7:0]  m_q[$];
  // counts per block: 0 = ARB, 1 = FIFO, 2 = MULT
  int checks[3], mism[3], shown[3];
  int cycles;
  // reach: did random stimulus get to the places where the bugs live?
  int arb_grant2_then_ask, fifo_full_cycles, fifo_push_while_full, mult_all_ones;
  int max_wait; int wait_cnt[4];

  function new(string name, uvm_component parent);
    super.new(name, parent);
    imp = new("imp", this);
  endfunction

  function void miss(int k, string msg);
    mism[k]++;
    if (shown[k] < 3) begin shown[k]++; `uvm_error("MISMATCH", msg) end
  endfunction

  function void write(tav_blocks_cycle t);
    if (t.rst) begin m_gnt = 0; m_last = 3; m_q.delete(); wait_cnt = '{0, 0, 0, 0}; return; end
    cycles++;
    // ARB: check this cycle's grant, then predict the next one from this cycle's requests
    checks[0]++;
    if (t.gnt !== m_gnt) miss(0, $sformatf("ARB cycle %0d: gnt=%b, expected %b", cycles, t.gnt, m_gnt));
    for (int i = 0; i < 4; i++) begin
      wait_cnt[i] = (t.req[i] && !t.gnt[i]) ? wait_cnt[i] + 1 : 0;
      if (wait_cnt[i] > max_wait) max_wait = wait_cnt[i];
    end
    if (m_gnt == 4'b0100 && t.req != 0) arb_grant2_then_ask++;
    begin
      bit found = 0;
      for (int k = 1; k <= 4 && !found; k++) begin
        int j = (m_last + k) % 4;
        if (t.req[j]) begin found = 1; m_gnt = 4'b1 << j; m_last = j; end
      end
      if (!found) m_gnt = 0;
    end
    // FIFO: flags, count and the oldest word, then apply this cycle's push and pop
    checks[1]++;
    if (t.count !== m_q.size() || t.full !== (m_q.size() == 8) || t.empty !== (m_q.size() == 0))
      miss(1, $sformatf("FIFO cycle %0d: count=%0d full=%b empty=%b, expected count=%0d", cycles, t.count, t.full, t.empty, m_q.size()));
    else if (m_q.size() > 0 && t.dout !== m_q[0])
      miss(1, $sformatf("FIFO cycle %0d: dout=%0d, expected %0d", cycles, t.dout, m_q[0]));
    if (m_q.size() == 8) begin fifo_full_cycles++; if (t.push) fifo_push_while_full++; end
    begin
      bit can_pop = m_q.size() > 0, can_push = m_q.size() < 8;
      if (t.pop && can_pop) begin void'(m_q.pop_front()); end
      if (t.push && can_push) m_q.push_back(t.din);
    end
    // MULT: combinational, checked every cycle
    checks[2]++;
    if (t.a == 16'hFFFF && t.b == 16'hFFFF) mult_all_ones++;
    if (t.p !== 32'(t.a) * 32'(t.b)) miss(2, $sformatf("MULT cycle %0d: %h x %h gave %h", cycles, t.a, t.b, t.p));
  endfunction

  function void tav_print_results(int f0, f1, f2, f3);   // not "report": that name is taken by uvm_component
    int sva[3] = '{f0 + f1, f2, f3};
    string nm[3] = '{"ARB ", "FIFO", "MULT"};
    for (int k = 0; k < 3; k++) begin
      string note = "";
      if (sva[k] >= 3) note = " (assertions switched off after 3)";
      `uvm_info("RESULT", $sformatf("%s checks=%0d mismatches=%0d assertion_fails=%0d%s -> %s",
                nm[k], checks[k], mism[k], sva[k], note, (mism[k] == 0 && sva[k] == 0) ? "PASS" : "FAIL"), UVM_NONE)
    end
    `uvm_info("REACH", $sformatf("ARB  longest wait=%0d cycles, grants to requester 2 followed by a request=%0d", max_wait, arb_grant2_then_ask), UVM_NONE)
    `uvm_info("REACH", $sformatf("FIFO cycles full=%0d, pushes while full=%0d", fifo_full_cycles, fifo_push_while_full), UVM_NONE)
    `uvm_info("REACH", $sformatf("MULT cycles=%0d, times a and b were both 0xFFFF=%0d", cycles, mult_all_ones), UVM_NONE)
  endfunction
endclass

// ---------------------------------------------------------------------------
// Agent, environment, test
// ---------------------------------------------------------------------------
class tav_blocks_agent extends uvm_agent;
  `uvm_component_utils(tav_blocks_agent)
  uvm_sequencer #(tav_blocks_item) sqr;
  tav_blocks_driver  drv;
  tav_blocks_monitor mon;
  function new(string name, uvm_component parent);
    super.new(name, parent);
  endfunction
  function void build_phase(uvm_phase phase);
    sqr = uvm_sequencer#(tav_blocks_item)::type_id::create("sqr", this);
    drv = tav_blocks_driver::type_id::create("drv", this);
    mon = tav_blocks_monitor::type_id::create("mon", this);
  endfunction
  function void connect_phase(uvm_phase phase);
    drv.seq_item_port.connect(sqr.seq_item_export);
  endfunction
endclass

class tav_blocks_env extends uvm_env;
  `uvm_component_utils(tav_blocks_env)
  tav_blocks_agent      agt;
  tav_blocks_scoreboard scb;
  function new(string name, uvm_component parent);
    super.new(name, parent);
  endfunction
  function void build_phase(uvm_phase phase);
    agt = tav_blocks_agent::type_id::create("agt", this);
    scb = tav_blocks_scoreboard::type_id::create("scb", this);
  endfunction
  function void connect_phase(uvm_phase phase);
    agt.mon.ap.connect(scb.imp);
  endfunction
endclass

class tav_where_formal_test extends uvm_test;
  `uvm_component_utils(tav_where_formal_test)
  tav_blocks_env env;
  virtual tav_blocks_if vif;
  function new(string name, uvm_component parent);
    super.new(name, parent);
  endfunction
  function void build_phase(uvm_phase phase);
    env = tav_blocks_env::type_id::create("env", this);
    if (!uvm_config_db#(virtual tav_blocks_if)::get(this, "", "vif", vif))
      `uvm_fatal("NOVIF", "no virtual interface")
  endfunction
  task run_phase(uvm_phase phase);
    tav_reset_seq  r = tav_reset_seq::type_id::create("r");
    tav_random_seq s = tav_random_seq::type_id::create("s");
    phase.raise_objection(this);
    r.start(env.agt.sqr);
    s.start(env.agt.sqr);
    repeat (2) @(vif.mon_cb);
    #1;
    env.scb.tav_print_results(vif.tav_fails[0], vif.tav_fails[1], vif.tav_fails[2], vif.tav_fails[3]);
    phase.drop_objection(this);
  endtask
endclass

// ---------------------------------------------------------------------------
// Top
// ---------------------------------------------------------------------------
module tav_top;
  logic clk = 0;
  int   BUG = 0;
  always #5 clk = ~clk;

  tav_blocks_if vif (clk);
  tav_rr_arb4 u_arb  (.clk(clk), .rst_n(vif.rst_n), .req(vif.req), .gnt(vif.gnt), .bug(BUG));
  tav_fifo8   u_fifo (.clk(clk), .rst_n(vif.rst_n), .push(vif.push), .pop(vif.pop), .din(vif.din),
                      .dout(vif.dout), .full(vif.full), .empty(vif.empty), .count(vif.count), .bug(BUG));
  tav_mult #(.W(16)) u_mult (.a(vif.a), .b(vif.b), .p(vif.p), .bug(BUG));

  initial begin
    void'($value$plusargs("BUG=%d", BUG));
    `uvm_info("TOP", $sformatf("Running with BUG=%0d", BUG), UVM_NONE)
    uvm_config_db#(virtual tav_blocks_if)::set(null, "uvm_test_top", "vif", vif);
    uvm_config_db#(virtual tav_blocks_if)::set(null, "uvm_test_top.env.agt.*", "vif", vif);
    run_test("tav_where_formal_test");
  end
endmodule

What output should you expect from simulation?

With no option, every block passes:

UVM_INFO testbench.sv(329) @ 200036: uvm_test_top.env.scb [RESULT] ARB  checks=20002 mismatches=0 assertion_fails=0 -> PASS
UVM_INFO testbench.sv(329) @ 200036: uvm_test_top.env.scb [RESULT] FIFO checks=20002 mismatches=0 assertion_fails=0 -> PASS
UVM_INFO testbench.sv(329) @ 200036: uvm_test_top.env.scb [RESULT] MULT checks=20002 mismatches=0 assertion_fails=0 -> PASS
UVM_INFO testbench.sv(332) @ 200036: uvm_test_top.env.scb [REACH] ARB  longest wait=4 cycles, grants to requester 2 followed by a request=4356
UVM_INFO testbench.sv(333) @ 200036: uvm_test_top.env.scb [REACH] FIFO cycles full=1408, pushes while full=688
UVM_INFO testbench.sv(334) @ 200036: uvm_test_top.env.scb [REACH] MULT cycles=20002, times a and b were both 0xFFFF=0

With +BUG=1, the arbiter and FIFO fail, and the multiplier passes with its bug still inside:

UVM_ERROR testbench.sv(283) @ 165: uvm_test_top.env.scb [MISMATCH] ARB cycle 15: gnt=0010, expected 0001
UVM_ERROR testbench.sv(283) @ 175: uvm_test_top.env.scb [MISMATCH] FIFO cycle 16: dout=x, expected 170
...
UVM_INFO testbench.sv(329) @ 200036: uvm_test_top.env.scb [RESULT] ARB  checks=20002 mismatches=4078 assertion_fails=0 -> FAIL
UVM_INFO testbench.sv(329) @ 200036: uvm_test_top.env.scb [RESULT] FIFO checks=20002 mismatches=16475 assertion_fails=0 -> FAIL
UVM_INFO testbench.sv(329) @ 200036: uvm_test_top.env.scb [RESULT] MULT checks=20002 mismatches=0 assertion_fails=0 -> PASS
UVM_INFO testbench.sv(332) @ 200036: uvm_test_top.env.scb [REACH] ARB  longest wait=7 cycles, grants to requester 2 followed by a request=4356
UVM_INFO testbench.sv(334) @ 200036: uvm_test_top.env.scb [REACH] MULT cycles=20002, times a and b were both 0xFFFF=0

The dout=x is the skipped read pointer landing on an entry that was never written. With +BUG=2, both bugs fire assertions too, and each assertion switches itself off after 3 fails:

UVM_ERROR testbench.sv(283) @ 35: uvm_test_top.env.scb [MISMATCH] ARB cycle 2: gnt=1000, expected 0000
UVM_ERROR testbench.sv(115) @ 35: reporter [SVA] A_ARB_ASKED: gnt=1000, req last cycle=0000
...
UVM_ERROR testbench.sv(283) @ 715: uvm_test_top.env.scb [MISMATCH] FIFO cycle 70: count=9 full=0 empty=0, expected count=8
UVM_ERROR testbench.sv(120) @ 715: reporter [SVA] A_FIFO_FLAGS: count=9 full=0 empty=0
...
UVM_INFO testbench.sv(329) @ 200036: uvm_test_top.env.scb [RESULT] ARB  checks=20002 mismatches=1263 assertion_fails=3 (assertions switched off after 3) -> FAIL
UVM_INFO testbench.sv(329) @ 200036: uvm_test_top.env.scb [RESULT] FIFO checks=20002 mismatches=11786 assertion_fails=3 (assertions switched off after 3) -> FAIL
UVM_INFO testbench.sv(329) @ 200036: uvm_test_top.env.scb [RESULT] MULT checks=20002 mismatches=0 assertion_fails=0 -> PASS

What are the most common mistakes when choosing where to use formal?

MistakeWhat it looks likeFix
Starting with the hardest blockA week on a datapath, no proof, and the team decides formal “doesn’t work here”Start with control blocks. Win early, then widen
Reading a bounded pass as a proof“Formal passed” after 20 cycles on a FIFO that can take longer to show a bugSay the depth out loud. Run induction for a real proof
Giving up when induction failsThe bounded check passes, induction fails, and the property is thrown awayRead the counterexample. It usually starts from a state reset can never reach. Add a helper fact that rules it out
Copying the RTL into the propertyThe checker computes the answer the same way the design does, bugs includedWrite the rule from the spec, as a short relation, not a second implementation
Modelling a whole FIFO in the harnessA shadow memory of every entry makes the proof as big as the designTrack one word the tool picks. It covers every word, because the tool can pick any of them
Proving wide arithmetic at full widthA 16-bit multiplier proof that never finishesProve a narrow version, prove the building blocks one at a time, or use equivalence checking against a trusted model
Too many assumptionsEvery property passes, because the assumptions removed the inputs that break itKeep assumptions to the real input protocol, and add cover properties to show the bug scenarios are still reachable

Can AI tell you where to use formal, and write the harness?

I wanted to know two things: does an assistant rank blocks the way the numbers do, and can it write a FIFO harness that actually proves something.

Task: rank the three blocks for this open-source flow, then write the FIFO data-order harness from the spec alone.

Tool: Claude, in Anthropic’s Cowork app, 24 Nov 2026, in a fresh session that had never seen my RTL, my harness or the bug list.

Prompt (shortened):

You are a senior formal verification engineer. I have three blocks and limited time on an
open-source formal flow (Yosys + yosys-smtbmc + Z3, bounded checks and k-induction,
immediate assertions only, no SVA sequences, no $past).
Block A: a 4-requester round-robin arbiter. Block B: an 8-deep, 8-bit FIFO.
Block C: a 16 x 16 combinational shift-and-add multiplier.
Task 1: rank the three blocks from best to worst fit, one line each.
Task 2: for Block B, write a harness that instantiates tav_fifo8 and proves data comes out
in the order it went in, plus full/empty/count. You cannot see the FIFO's internals.
Task 3: will k-induction prove it with no extra work, and why?

Output (excerpts):

1. Block A (round-robin arbiter): best fit. ... k-induction should close at a small k.
2. Block B (FIFO): good fit, but it needs a harness. ... a full k-induction proof needs
   invariants on the internals.
3. Block C (16x16 shift-and-add multiplier): worst fit. ... Z3 will likely run out of time.

Task 3: No, not the data-ordering property. ... the induction step starts from an arbitrary
state, not from reset. ... no value of k is large enough.

Its harness used the same tracked-word idea as mine: a free pick input, a saved word and a count of the words ahead of it.

How I validated it: I ran its harness through the same flow, on the clean FIFO and both bugs, then tried induction.

RunResult
As writtenDid not compile: it passed bug as a parameter, but in tav_fifo8 it is a port
After that one-line fix, +BUG=1FAILED at step 9, the same depth as my harness
After the fix, +BUG=2FAILED at step 11, the same depth as my harness
After the fix, clean, bounded check to 20 stepsPASSED, but took 250 s. My harness took 2.56 s
After the fix, clean, inductionFAILED: the data check, exactly as it predicted

Where it fell short:

  • It guessed the port list and got one connection wrong. It even flagged the guess in its notes. Always compile AI code against the real module before you read the results.
  • It knew induction would fail and named the right helper facts, but its harness did not include them, because I told it it could not see the internals. That was a fair answer to my prompt, and a reminder that a proof needs access to the state it talks about.
  • The ranking matched my numbers exactly. Where it helped most was the reasoning around the proof, not the harness itself.

The surprise was the 100x gap in bounded-check time. My helper facts are true in every reachable state, so they also stop the solver from wasting time on states that can never happen. They are not just for induction.

Use an assistant to rank the work and draft the harness, then let the formal tool decide which parts are right.

Interview questions on where to use formal verification

  1. Which blocks are the best candidates for formal? Control-heavy blocks with small state and rules you can write in one line: arbiters, state machines, handshakes, credit and flow control, FIFO pointer logic, and anything with a rare mode or deep corner.
  2. Why is a multiplier hard for formal? The solver works on bits. Proving a wide multiplier equal to a reference means reasoning about every way the partial products can carry into each other, and the effort grows very fast with width.
  3. What is the difference between a bounded check and a proof? A bounded check says no input sequence breaks the rule within N cycles of reset. A proof, for example by induction, says it never breaks at any depth.
  4. Why can induction fail on a correct design? The induction step starts from any state, including states reset can never reach. If one of those leads to a failure, induction fails. Helper facts that describe the reachable states fix it.
  5. How do you check data integrity through a FIFO without modelling every entry? Let the tool pick one word to track, count the words ahead of it, and check that word when it reaches the head. Because the tool can pick any word, one tracker covers all of them.
  6. When would you choose simulation over formal for a block? When the block is mostly wide datapath, when the rule needs a full reference model, or when the behaviour only shows up through long software-driven scenarios.
  7. How do formal and simulation share work on one project? Formal proves the control rules and finds deep corners. Simulation covers end-to-end behaviour and datapaths. They share assertions, and formal counterexamples become directed tests.
  8. What does it mean if every property passes on the first run? Be suspicious. Check the assumptions, add cover properties, and plant a bug to make sure the harness can fail at all.

Practice challenge

Try these with the demo files:

  1. Run the multiplier harness at widths 4 to 8 and plot the proof time. How much longer does each extra bit take?
  2. Remove the four helper facts from the FIFO harness and run induction. Which assertion fails, and from what kind of state?
  3. Change the arbiter’s fairness limit from 4 to 3. Does the clean design still pass? Why?
  4. Add a fifth requester to the arbiter. How do the bounded check and induction times change?
  5. Run the UVM bench with +BUG=1 and look at the MULT REACH line. How many random cycles would you need, on average, to hit the one bad input pair once?

Frequently asked questions

Where should you use formal verification?

On control-heavy blocks with small state and rules you can state in one line: arbiters, state machines, handshakes, flow control, FIFO pointers, and logic with rare modes or deep corners. These prove quickly and hide the bugs simulation struggles to reach.

Where is formal verification a poor fit?

Wide arithmetic such as multipliers, dividers and floating point, large memories where the data is the state, and behaviour that only resolves after long pipelines or software sequences. Formal can still help there, but only with a narrower width, an abstraction, or a different method such as equivalence checking.

Can formal verification prove a FIFO keeps data in order?

Yes. Track one word the tool chooses, count the words ahead of it, and check it when it reaches the output. A bounded check finds ordering bugs quickly. A full proof by induction needs a few helper facts that tie the pointers, the count and the tracked word together.

Why does formal verification take so long on a multiplier?

The solver reasons about bits, and in a multiplier every output bit depends on many input bits through long carry chains. The work grows very fast with width, so in my runs a proof that took 0.10 s at 4 bits took 516 s at 10 bits and did not finish in 15 minutes at 12.

Do I need a commercial tool to try formal verification?

No. Open-source Yosys with yosys-smtbmc and a solver such as Z3 runs bounded checks and induction on SystemVerilog designs with immediate assertions. Commercial tools add full SVA, larger capacity and more proof engines.

References and related lessons

References

Related lessons