Every formal tool eventually meets a design that is too big or too hard. The answer is rarely a faster computer. It is a smaller problem: removing logic a property does not need, replacing complex logic with free values, shrinking widths and depths, following symbolic values instead of all values, and splitting a design into blocks that are checked separately. This chapter covers these techniques, with measurements on the lab engine.
A design with n bits of state has up to 2n states. Add one 32-bit register and the state space grows four billion times. This is called state explosion, and it is the reason formal tools work on blocks, not chips. Yet the size of the design alone does not decide whether a check finishes. This article explains what really matters, shows the cone of influence that every tool uses automatically, and gives an overview of the techniques in this chapter.
8 min read | Intermediate
What You'll Learn
- Explain state explosion and why it does not always hurt
- Describe the cone of influence of a property and how tools use it
- Predict which properties of a design will be easy and which hard
- Choose a technique from this chapter for a check that does not finish
State Explosion
The state and reachability article showed how the state space doubles with every register bit. Bounded model checking does not enumerate those states, it hands a formula to a solver. Still, the formula grows with the number of bits that matter, and some kinds of logic make it very hard to solve. The performance article measured a multiplier check that took 15 seconds at 8 bits and more than 300 at 10.
Two observations make the problem manageable. First, most properties depend on a small part of the design. Second, most of the hard logic, such as wide arithmetic, does not matter for most properties.
The Cone of Influence
The cone of influence of a property is the set of signals and registers that can affect it, directly or through any chain of logic, at any time. Everything outside the cone cannot change the outcome, so tools remove it before solving. Yosys and SymbiYosys do this as part of their normal optimization.
The effect can be dramatic. The shift-and-add multiplier from the performance article has two kinds of property:
- Control:
donecomes exactlyWcycles after a start. Its cone contains the start logic and the cycle counter, not the product. - Data: the product equals
a * b. Its cone contains the whole datapath.
On the lab engine, the control property passes at 12 bits in under a second, and at 32 bits in about a second too. The data property times out at 10 bits. Same design, same depth, completely different difficulty, because the cones differ.
Quick Check
Q: A design has a 64-bit multiplier and a 3-state controller. A property only mentions the controller's state and its handshake signals. Will the multiplier slow the check down?
Show Answer
Only if it is in the cone of influence: if the controller's decisions depend on the multiplier output, it is. If not, the tool removes it and the check is as fast as for the controller alone.
What Makes a Cone Hard
- Arithmetic compared with arithmetic: a product checked against a different product, or a divider against a multiplication.
- Deep sequential depth: counters and timeouts whose interesting values are many cycles from reset.
- Many interacting registers: large state machines, long pipelines with feedback, caches.
- Large memories with complex addressing, although simple read-after-write checks are cheap.
The Techniques of This Chapter
| Technique | Idea | Article |
|---|---|---|
| Cut points and black boxes | Replace logic in the cone with free values | Black Boxes and Cut Points |
| Shrinking | Smaller widths, depths and counts via parameters | Shrinking the Problem |
| Symbolic values | Check one freely chosen index or value instead of all | Symbolic Values |
| Assume-guarantee | Check blocks separately against their interface contracts | Assume-Guarantee |
All of them make the problem smaller while keeping the result meaningful. Each has a condition for being sound, and each article states it.
Quick Check
Q: Why is splitting one big property into several small ones often faster, even though there are more runs?
Show Answer
Each small property has a smaller cone of influence. Several easy runs usually finish much faster than one run over the combined cone, which may not finish at all.
Running It in ChipVerify Lab
The example below is the shift-and-add multiplier with the control property only, at W = 6, which needs a depth of 10. A job takes W cycles, so wider versions need more depth: with PRO, try W = 12 at depth 16 and W = 32 at depth 36. The time barely changes. Compare with the data property in the performance example.
`ifdef FORMAL
// ... reset ...
// control only: done comes exactly W cycles after a start
reg [7:0] since = 8'd0; reg running = 1'b0;
always @(posedge clk)
if (rst) running <= 1'b0;
else if (start && !busy) begin running <= 1'b1; since <= 8'd0; end
else if (running) begin since <= since + 8'd1; if (done) running <= 1'b0; end
always @(posedge clk) if (!init && done) assert (running && since == W);
`endif
Common Mistakes
Mistake #1: Judging difficulty by the size of the design
What matters is the cone of each property. A small property on a large design can be easy, and a large property on a small design can be hopeless.
Mistake #2: Writing one end-to-end property for everything
A single property over the whole design pulls everything into its cone. Split it into properties per function and per interface.
Mistake #3: Mixing control and data in one assertion
"done comes in time and the result is right" puts the datapath into the cone of the timing check. Write them as two assertions.
Practice Exercise
Challenge: Watch the Cone at Work
Open the example and run it at W = 6. With PRO, run it at W = 12 (depth 16) and W = 32 (depth 36), and compare the times. Then add the data property always @(posedge clk) if (!init && done) assert (p == ra * rb); back, with W = 6, then 8. Why do the two properties scale so differently?
Hint
Which registers can influence done? Which can influence p?
Solution
The control property takes about a second at every width: done depends only on the start logic and the cycle counter n, so the multiplier registers are outside its cone and removed. The data property depends on the whole datapath and on a * b, so its difficulty grows with the width: a few seconds at 6 bits and about 15 at 8 bits on the lab engine.
Open the ready-made example in the lab and run the formal check from the formal panel. The free tier allows a depth of up to 10 cycles, and PRO allows up to 100.
Summary
- State grows exponentially with register bits, but formal difficulty depends on the cone of influence of each property.
- Tools remove everything outside the cone automatically.
- The multiplier's control property passed at 32 bits in about a second; its data property timed out at 10 bits.
- Hard cones contain arithmetic compared with arithmetic, deep counters, and many interacting registers.
- The rest of this chapter: cut points, shrinking, symbolic values and assume-guarantee.