Skip to content

Verilog: create the transition relation from the RTL representation - #2119

Open
kroening wants to merge 2 commits into
diffblue:mainfrom
kroening:kroening/verilog-transition-relation
Open

Verilog: create the transition relation from the RTL representation#2119
kroening wants to merge 2 commits into
diffblue:mainfrom
kroening:kroening/verilog-transition-relation

Conversation

@kroening

Copy link
Copy Markdown
Collaborator

Stacked on #2117; only the top commit ("Verilog: create the transition relation from the RTL representation") is new relative to that PR.

Summary

This adds a new component, verilog_transition_relation (src/verilog/verilog_transition_relation.{h,cpp}), which replaces verilog_synthesis in the EBMC flow. It takes the register-transfer level (RTL) representation introduced in #2117 as input — which includes module instances recursively — and produces the transition relation for the design:

  • State-holding slices become next-state equalities in the transition constraints, and wire slices become equalities in the state constraints. Slices are composed into whole-symbol values; unassigned fragments hold their value (registers) or remain unconstrained (wires). Variables that are only assigned combinationally become wires, as do variables forced by port connections.
  • Declared variables without a next-state definition hold their value.
  • The initial values yield the initial state constraints; reads of state-holding variables are replaced by their non-deterministic pre-initial value, and unused non-determinism is removed. --ignore-initial and --initial-zero are handled here.
  • Constraints from port connections and primitive gates are added to the state constraints.
  • Properties are wrapped as in synthesis (implicit always, assume/cover marking, sequence semantics) and set as the values of the property symbols.
  • Expressions are lowered, and remaining system function calls, e.g. $past, are rewritten as in synthesis.

Unlike synthesis, the conversion does not introduce auxiliary wires (x_aux0 etc.); four regression test expectations are updated accordingly. verilog_synthesis remains in use by the hw-cbmc flow.

The RTL gaps found while making all tests pass were fixed in #2117 (module instances, initial values, declared-variable and forced-wire tracking, function call inlining with side effects, hierarchical identifiers, constant folding of type-dependent system functions, case pattern folding, and more).

Testing

With the new pipeline, all suites pass:

  • unit (356 assertions in 62 test cases)
  • regression/verilog (SAT and Z3)
  • regression/ebmc (SAT and Z3)
  • regression/smv (SAT and Z3)
  • regression/vlindex

@kroening
kroening force-pushed the kroening/verilog-transition-relation branch 3 times, most recently from 18a7fb9 to a6c94e3 Compare August 27, 2026 19:17
@kroening
kroening force-pushed the kroening/verilog-transition-relation branch 2 times, most recently from ad89c2e to ea474a0 Compare August 30, 2026 16:03
This adds a new IR layer to the Verilog frontend that follows type
checking and precedes synthesis. The register-transfer level (RTL)
representation is a map from identifiers to a map of slices (lower
and higher bit index) to the definition of the slice, which indicates
whether the slice is state-holding or a wire, and gives the defining
expression: the next-state value for state-holding slices, and the
current-state value for wires.

The new command-line option --show-rtl shows the representation.
This adds verilog_transition_relation, which replaces
verilog_synthesis in the EBMC flow. It takes the register-transfer
level (RTL) representation as input, which includes module instances
recursively, and produces the transition relation for the design:

* State-holding slices become next-state equalities in the
  transition constraints, and wire slices become equalities in the
  state constraints; slices are composed into whole-symbol values,
  with unassigned fragments holding their value (registers) or
  remaining unconstrained (wires). Variables that are only assigned
  combinationally become wires, as do variables that are forced by
  port connections.
* Declared variables without a next-state definition hold their
  value.
* The initial values yield the initial state constraints; reads of
  state-holding variables are replaced by their non-deterministic
  pre-initial value, and unused non-determinism is removed.
  --ignore-initial and --initial-zero are handled here.
* The constraints, e.g. from port connections and primitive gates,
  are added to the state constraints.
* The properties are wrapped as in synthesis (implicit always,
  assume/cover marking, sequence semantics) and set as the values of
  the property symbols.
* Expressions are lowered, and the remaining system function calls,
  e.g. $past, are rewritten as in synthesis.

Unlike synthesis, the conversion does not introduce auxiliary
wires; four regression test expectations are updated accordingly.
verilog_synthesis remains in use by the hw-cbmc flow.

All unit and regression suites pass with the new pipeline.
@kroening
kroening force-pushed the kroening/verilog-transition-relation branch from ea474a0 to 2160574 Compare August 30, 2026 16:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant