Unstated Assumptions
Find the assumptions that nobody wrote: in a cell model, in a tool default and in a bench setting.
You Will Be Able To
- Explain how a simplified cell model can hide a timing-dependent bug.
- Predict what a multiply-driven net does in plain SBY, in this site's engine and in a simulator.
- Decide whether logic that a bench cannot reach is dead or only out of scope.
- List models, defaults and settings on the sign-off page.
- Lesson
- F10.3
- Time
- 18 min
- Runs on
- SymbiYosys
- Check
- 5 questions
A block gated its clock with a library cell. The formal library drew that cell as one AND gate. The proof said every requested cycle got its clock pulse. In silicon the enable arrived after the clock edge, and the real cell held it back for a whole cycle.
Measured with smtbmc yices at depth 20. en rises at step 2, when clk1 is already high. The latch is closed there, so gclk stays low for this cycle.
Below the Properties
- Property
- Assumption
- Result
- Model
- Structure
- Analysis
Read the diagram as text
- Properties: written and reviewed
- Assumptions: written and reviewed
- PASS: true under everything on this page
- Cell and block models: a latch drawn as a gate
- Tool defaults: two drivers tied together
- Bench settings: a mode pin tied low
- Properties → Assumptions
- Assumptions → PASS
- Cell and block models → Properties
- Tool defaults → Assumptions
- Bench settings → PASS
Nobody reviews the bottom row unless somebody writes it down.
A verdict depends on more than the properties and assumptions in your files. It also depends on three more things. They are the model of each cell, the defaults of the tool and the setup of the bench. Each of these can carry an assumption that nobody reviewed.
A Cell Drawn Simpler Than It Is
The cell as an AND gate
assign gclk = clk1 && en;
A late en still opens the gate for the rest of the high phase. "A wanted cycle gets a pulse": BMC PASS to depth 20.
The real cell: a latch, then the AND
always_latch if (!clk1) en_lat = en;
assign gclk = clk1 && en_lat;
The latch is open only while clk1 is low. A late en waits for the next cycle. The same check: FAIL at reported step 4.
| Cell, on real gates in a simulator | Pulses for an enable that changes while the clock is high |
|---|---|
| AND gate | at 35, width 5; at 50, width 10; at 70, width 5 |
| Latch, then AND | at 50, width 10; at 70, width 10 |
Icarus Verilog 12. The clock is high for 10 time units. The enable rises at 35 and falls at 75, both inside a high phase.
The AND model turns a late enable into a half-width pulse. A real flop may not clock on that. The proof counted it as a clock. The bug is the late enable, and the simple model hid it.
Run on cg | AND model | Latch model |
|---|---|---|
| Late enable; a wanted cycle gets a pulse | BMC PASS to depth 20 | FAIL at reported step 4 |
| Late enable; every pulse is two ticks wide | FAIL at reported step 3 | BMC PASS to depth 20 |
| Enable moved to the low phase; a wanted cycle gets a pulse | - | BMC PASS to depth 20 |
Mode bmc, depth 20, smtbmc yices, reset assumed in step 0. One clk1 cycle is four ticks of the engine clock.
Two Drivers on One Net
Claim about w, with assign w = a; and assign w = b; | Plain SBY | Meaning |
|---|---|---|
w == a | PASS | the first driver wins? |
w == b | PASS | the second driver wins? |
w == (a & b) | PASS | a wired AND? |
a == b | PASS | the two inputs are one signal |
Mode bmc, depth 3, smtbmc yices, read_verilog and prep with no extra check. Yosys warns about "multiple conflicting drivers".
All four claims pass. Yosys joins the two drivers into one net, so in the formal model a and b are always equal. That is an assumption on two free inputs, and it sits in a warning line. A simulator resolves the same net to x when the drivers differ: a=1 b=1 w=1, a=1 b=0 w=x (Icarus 12).
This site's engine runs check -assert after elaboration and refuses the design. In your own flow, add that line or treat this warning as an error. Other tools pick other defaults, such as a wired AND. Find out which one yours uses.
Unreachable, and Still Needed
Bench for tmux | Functional proof | Cover: shift in test mode |
|---|---|---|
assume(!test_mode): the functional bench | BMC PASS to depth 20 | Cover unreached within the depth |
test_mode free | - | Cover reached, reported step 3 |
The scan path is used on the tester only. The functional bench ties test_mode low, as it should.
An unreached cover under a bench setting does not make the logic dead. The scan path, spare cells and feature-disable bits are all unreachable in a functional bench. Before you waive an unreachable item (F5.7), ask which setting made it unreachable.
Write the Bottom Row Down
| Item | Where it hides | How to confirm it |
|---|---|---|
| Cell and block models | the formal library, a blackbox, a cutpoint | read the model against the real cell; run the checks the library asks for |
| Tool defaults | driver resolution, initial values, unconnected pins | read the log for warnings; choose the stricter option |
| Bench settings | clock ratios, reset sequence, tied mode pins | list each one beside the assumptions |
| Out of scope | test mode, spare cells, disabled features | name the flow that does verify them |
These rows go on the sign-off page with the written assumptions (F7.3). A cut or a blackbox is a model too (F4.2).
Review the tool scripts with someone who knows the tool, as you review properties with someone who knows the design. When a setting has a strict choice and a forgiving one, start with the strict one.
Asked in Interviews
| Question | Answer |
|---|---|
Where can an assumption hide if it is not in an assume? | In a cell or blackbox model, in a tool default and in a bench setting such as a tied pin. |
| A formal library models a clock gate as an AND gate. What can that hide? | An enable that arrives while the clock is high. The real latch delays it by a cycle. |
| A net has two drivers. What does the proof mean? | It depends on the tool. Plain Yosys ties the drivers together, which assumes they agree. |
| Is unreachable logic dead logic? | Only if it is unreachable in the real environment. Test logic is unreachable in a functional bench and still needed. |
Try It
The AND model in the bench
assign gclk = ph && en;
ph is clk1. en can change while ph is 1.
The latch model in the bench
reg en_lat=0;
always @(posedge clk)
if (rst) en_lat <= 0;
else if (!ph) en_lat <= en;
assign gclk = ph && en_lat;
en_lat only follows en in the low phase, so gclk is steady in the high phase.
[options]
mode bmc
depth 20
[engines]
smtbmc yices
[script]
read_verilog -formal -sv design.sv
prep -top cg
[files]
design.svRun the AND model
Run as it is: BMC PASS to depth 20. The request and the pulse are in the same cycle.
Put the latch in
Replace the
gclkline with the latch model: FAIL at reported step 4. Readenandgclkaround the failing step.Check the pulse width
Go back to the AND model and assert that no pulse starts or stops at tick 1: FAIL at reported step 3.
Fix the design
Load
enat tick 2, in the low phase, and sample the request there too. With the latch model: 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
Common Mistakes
Wrong Reading "multiple conflicting drivers" as a harmless warning.
The model ties the drivers together, so the proof assumes that they always agree.
Fix Fail the run on that warning, for example with check -assert in the Yosys script.
Wrong Modelling a cell by its logic function when the real cell has state.
A latch or a flop inside the cell changes when an input takes effect, and the simple model drops that.
Fix Model the state element, or prove the input timing that makes the simple model valid.
// clock gate
assign gclk = clk && en;// clock gate: latch, open while clk is low
always_latch if (!clk) en_lat = en;
assign gclk = clk && en_lat;Wrong Waiving every unreached cover as dead code.
A cover can be unreached because a bench setting closed the path, not because the logic is unused.
Fix Free the setting and rerun the cover before you waive it.
Remember
- A verdict stands on models, tool defaults and bench settings as well as on the files you wrote.
- A cell model that drops a latch can hide an input that arrives at the wrong time.
- Two drivers on a net: plain Yosys ties them together, and a simulator shows
x. - Unreachable under a bench setting is out of scope, not dead.
- List the bottom row on the sign-off page and review the tool scripts.