Assume, dist and Inside

State what a block may expect from its neighbours with assume property. Read what simulation and formal do with it, and write it with inside and dist.

You Will Be Able To

  • Predict what an assume property does in simulation and in formal.
  • Split a rule into a guarantee on one block and an assumption on the next.
  • Write input sets with inside, and know that dist checks as inside.
  • Catch an over-constraining assumption with a cover.
Lesson
A9.1
Time
30 min
Runs on
Verilator
Check
5 questions

A two-input arbiter registers its requests straight into its grants. Formal reports two grants at once within two steps. The arbiter is not wrong: it was built for requesters that never ask together. The proof needs that promise, written as an assumption.

One Rule, Two RolesThe requester guarantees a rule on its outputs. The arbiter assumes the same rule on its inputs. Each block is then checked alone.
  • Manager
  • Property
  • DUT
  • Assumption
  • Data
  • Structure
data: where the transaction goesconnect() linkcall: who calls whom
One rule, two rolesThe requester guarantees a rule on its outputs. The arbiter assumes the same rule on its inputs. Each block is then checked alone. manager requester drives req0, req1 property assert !(req0&& req1) its guarantee dut arbiter drives gnt0, gnt1 assumption assume !(req0&& req1) its environment property assert !(gnt0&& gnt1) its own guarantee req0, req1the same rulemakes it provable
  1. manager requesterdrives req0, req1
    • req0, req1 → arbiter
  2. property assert !(req0 && req1)its guarantee
    • the same rule → assume !(req0 && req1)
  3. assumption assume !(req0 && req1)its environment
    • makes it provable → assert !(gnt0 && gnt1)
  4. dut arbiterdrives gnt0, gnt1
  5. property assert !(gnt0 && gnt1)its own guarantee
  1. The guarantee

    Formal proves on the requester alone that it never asks twice at once.

  2. The assumption

    On the arbiter alone, the same rule becomes an assumption: the solver may not drive both requests.

  3. The proof

    With that assumption, the arbiter's grant rule is proved.

Read the diagram as text
  • requester: drives req0, req1
  • assert !(req0 && req1): its guarantee
  • arbiter: drives gnt0, gnt1
  • assume !(req0 && req1): its environment
  • assert !(gnt0 && gnt1): its own guarantee
  • requester → arbiter: req0, req1
  • assert !(req0 && req1) → assume !(req0 && req1): the same rule
  • assume !(req0 && req1) → assert !(gnt0 && gnt1): makes it provable

IEEE 1800-2023 16.14.2: an assumption states what the environment does; formal tools use it to restrict the inputs, simulators check it.

Assume Property in Simulation

In simulation an assume property is checked like an assertion. When it fails, its else action runs. The difference is whom it blames: the bench, not the design.

Assume Property in Formal

In formal the solver drives every input. An assumption removes the input sequences that break it; the assertions are then checked on what is left.

Assume-Guarantee Between Blocks

An assumption is a debt. It is paid by proving the same rule as an assertion on the block that drives those inputs. Then each block is proved alone, and the pair is safe together.

dist in an Assumption Acts as Inside

dist gives weights to values for random generation. In an assumption or assertion the weights play no part: x dist {0 := 1, [1:3] := 9} is checked as x inside {0, [1:3]}.

Inside Sets

inside tests membership in a list of values and ranges. It states a legal input set in one line.

Over-Constraining, and Covers as Witnesses

An assumption that is too strong removes legal behaviour, and the assertions then pass for free. A cover on something that must stay possible shows it: it becomes unreachable.

Try It

In one simulation the same rule is checked twice: as the requester's guarantee and as the arbiter's assumption. Neither reports anything, and the grants alternate.

Change assign req1 = want && tok; to assign req1 = want; and predict which two rules report first, and at which edge.

RUNVerilator · simulator service
Edit the code, then run it
Expected: g0=3 g1=2

Check Yourself

Predict the outputPredict the output.
module tb;
  logic clk = 0;
  always #5 clk = ~clk;                        // rising edges at 5, 15, 25, 35, 45
  logic [2:0] len = 3'd0;
  int fails = 0;
  len_mix: assume property (@(posedge clk) len dist {3'd0 :/ 1, [3'd1:3'd5] :/ 4}) else fails++;
  initial begin
    #12 len = 3'd6;                            // edge 15
    #10 len = 3'd5;                            // edge 25
    #10 len = 3'd7;                            // edge 35
    #10 len = 3'd0;                            // edge 45
    #8  $display("fails=%0d", fails);
    $finish;
  end
endmodule
Spot the bugThe bench may send opcodes 0 to 3 and 7. Which assumption also flags a legal opcode?
ConceptIn a formal run, what does assume property (@(posedge clk) !(req0 && req1)) do?
ConceptA proof passes. A cover on a basic event, such as gnt0, is unreached. What is the most likely cause?
ConceptHow is a rule assumed on a block's inputs made safe?

Common Mistakes

Wrong Write a rule about the design's outputs as an assumption.

The solver then hides every design behaviour that breaks it, and the bug disappears from the proof.

Fix Assume only what the environment drives; assert what the design drives.

Wrong Expect dist weights to matter in an assumption checked by a simulator.

In a check, dist is a membership test; weights only steer random generation.

Fix Read x dist {...} in an assertion or assumption as x inside {...}.

Wrong Trust a passing proof without a cover.

An assumption that is too strong also makes the proof pass.

Fix Add covers for the normal events and check that each one is reached.

Remember

  • Simulators check assume property like an assertion; formal tools use it to restrict inputs.
  • Assume only inputs, and prove each assumption as an assertion on the neighbour that drives them.
  • dist in a check is inside; inside lists legal values and ranges.
  • A cover that becomes unreachable exposes an over-constraining assumption.

Practice

Report a problem with this page