FVO — Formal Verification Online
Lesson 13.3 · Auxiliary Code and Modelling

Symbolic (oracle) variables

Suppose a design has 16 transaction IDs and every ID must follow the same rules. You could write the rules 16 times in a generate loop. A cheaper and more general trick is a symbolic variable: an extra input the tool may set to any value at the start, and which then never changes.

symbolic ID
// a symbolic ID: any value, chosen once, constant for the whole trace
input logic [3:0] sym_id;                          // free input of the formal wrapper
am_sym_stable: assume property ($stable(sym_id));

// track only the transaction with that ID
logic sym_busy;
always_ff @(posedge clk)
  if (rst) sym_busy <= 1'b0;
  else if (req_fire && req_id == sym_id) sym_busy <= 1'b1;
  else if (rsp_fire && rsp_id == sym_id) sym_busy <= 1'b0;

a_no_dup_id:   assert property (req_fire && req_id == sym_id |-> !sym_busy);  // ID not reused while busy
a_rsp_matches: assert property (rsp_fire && rsp_id == sym_id |-> sym_busy);   // response only for a busy ID

Why does this check every ID? The tool is free to choose sym_id. If any ID could break the rule, the tool would pick that ID and show the counterexample. A proof therefore holds for all 16 values — with the state of only one tracker instead of sixteen.

ApproachState addedScales to
generate one tracker per IDN trackerssmall N
Symbolic ID + one tracker1 tracker + the ID registerlarge N (64, 256…)

Constant-but-free in different tools

  • Portable: a free wrapper input plus assume property ($stable(x)), as above.
  • Yosys / SymbiYosys: the attribute (* anyconst *) logic [3:0] sym_id; declares a value that is arbitrary but constant — no assumption needed.
  • Commercial tools: similar "constant free variable" commands exist; check your tool's manual.

Pitfall: the symbolic value must reach every case

If the symbol's width is narrower than the real ID, some IDs are never checked. If an assumption accidentally restricts it (say, sym_id != 0 to avoid a failure), you have over-constrained the proof. Cover a few distinct values to be sure:

cover the symbol
c_sym_0:   cover property (sym_id == 0  && sym_busy);
c_sym_max: cover property (sym_id == 15 && sym_busy);

Discussion

No comments yet.

Was this page helpful?

Tip: select any text on the page before clicking Report and it will be quoted in your report.