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.
// 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 IDWhy 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.
| Approach | State added | Scales to |
|---|---|---|
generate one tracker per ID | N trackers | small N |
| Symbolic ID + one tracker | 1 tracker + the ID register | large 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:
c_sym_0: cover property (sym_id == 0 && sym_busy);
c_sym_max: cover property (sym_id == 15 && sym_busy);