Problemcore
Sequential equivalence checking
Also called sequential equivalence.
Decide whether two sequential circuits with possibly different state encodings produce the same outputs for every input sequence from their initial states.
Sequential equivalence checking asks whether two circuits with registers, each started in its initial state, give the same output sequence for every input sequence. The circuits can have different numbers of latches and different state encodings, so their states cannot be compared bit by bit. The product machine reduces the problem to the reachability of a state where the outputs can differ. For circuits given as netlists the problem is PSPACE-complete, against coNP-complete for combinational equivalence. This page is the problem and its complexity. Signal correspondence is one algorithm for it, sound but not complete.
In plain words
Two chips have the same pins. Each has memory inside, and each starts from a fixed reset value. You feed both chips the same stream of inputs, one value per clock tick, and watch the outputs. The chips are equivalent if their outputs agree on every tick for every stream you could feed them. The memories can be organized in different ways, for example a counter in binary in one chip and in a one-hot code in the other. So you cannot just compare memory bits. You must show that no stream of inputs ever leads the two chips to a point where they disagree.
Definition
Input. Two synchronous circuits and with the same primary inputs and the same outputs, matched by name. Circuit has latches with initial values , a next-state function and an output function , all given as gates. Here a transition is one clock cycle: one step of on one input vector.
Output. Yes if for every input sequence the two output sequences from and are equal, and no otherwise. A useful checker gives a counterexample for no: an input sequence after which the outputs differ.
By the proposition on the product machine page, the answer is yes exactly when no state with for some is reachable from .
Variants
- Bounded equivalence. Equal outputs for all sequences of length at most . With given in unary this is coNP-complete: unroll both circuits times into one combinational miter, and the case with no latches is combinational equivalence. Bounded model checking solves it.
- Equivalence with a register correspondence. If the latches are paired one to one and paired latches always hold equal values, a combinational check of the next-state and output functions is enough. Finding the pairing is latch mapping.
- No known initial state. Designs without a reset power up in any state. Pixley (1992) asks for equivalence after an aligning input sequence; Singhal and Pixley ask that every state of the new design behave like some state of the old one, which is safe replaceability. Neither is a reachability question from one state pair.
- Sets of initial states, and don't care outputs. The question can be asked for a set of initial states, or with outputs that need to agree only when a valid signal is 1.
- Explicit machines. For machines given by state tables, the question is DFA equivalence in disguise, with output symbols in place of acceptance.
Examples
Different encodings. A parity bit kept in one latch and the same bit kept as a one-hot pair of latches are equivalent. The product machine page lists the 8 product states: 4 of them are bad, and none of the bad ones is reachable.
A retimed register. has one latch with initial value 0, next value and output . has two latches with initial values , next values and , and output . At clock 0 both outputs are 0, and at clock both are . The circuits are equivalent, but they have 1 and 2 latches, so no one-to-one latch pairing exists, and the check needs more than combinational equivalence. Retiming produces such pairs.
A wrong initial value. Give and the initial values . The outputs at clock 0 are 0 and 1, so the empty prefix already separates the circuits. The combinational parts are the same as before, so only the initial states differ.
Known algorithms
All exact methods work on the product machine. They differ in how they prove that no bad state is reachable.
| method | answer | note |
|---|---|---|
| explicit search of the product | exact | only for small state spaces; see explicit-state model checking |
| BDD reachability of the product | exact, with a shortest counterexample | symbolic reachability, with image computation or a partitioned transition relation |
| latch mapping, then a combinational check | sound; complete only when the mapping is right | latch mapping, cutpoint equivalence checking |
| signal correspondence | sound, not complete | an inductive proof of equal signals, no reachable states |
| bounded model checking | counterexamples up to a bound | bug finding |
| k-induction | exact for a large enough when made complete with simple paths | often with signal correspondence as a strengthening |
| IC3 | exact | builds an inductive invariant of the product |
In practice, checkers first merge equal signals with simulation and SAT sweeping, prove what they can by induction, and give the rest to a model checker.
| Algorithm | Time | Space | Properties | Code |
|---|---|---|---|---|
| Signal correspondence | O(V^2 4^(L + 2I)) worst | O(V^2 4^(L + 2I)) extra | not completedeterministicnot exactrecursive | 1 language |
Bounds
Theorem. Sequential equivalence of circuits given as netlists is PSPACE-complete.
Proof. Let be the total size of the two circuits and .
In PSPACE. We show that non-equivalence is in NPSPACE. A nondeterministic machine keeps the product state in bits and a counter in bits, starting from and . At each step it guesses an input and evaluates both circuits on and in space . If the outputs differ, it accepts. Otherwise it sets and , and it rejects when reaches . If the circuits differ, a bad product state is reachable, and a shortest path to it visits no state twice, so it has fewer than steps; some run accepts. If they are equivalent, no run accepts. The space is , so non-equivalence is in NPSPACE, which is PSPACE by Savitch's theorem (Sipser, Section 8.1). PSPACE is a deterministic class, so it is closed under complement, and equivalence is in PSPACE too.
PSPACE-hard. Let be any language in PSPACE. Its complement is also in PSPACE, so it is decided by a deterministic Turing machine in space on inputs of length . Change so that its accepting and rejecting states loop on themselves. For an input , build a circuit with no primary inputs. Its latches hold a configuration of : cells, each with a tape symbol and a marker for the head and the control state. Their initial values are the initial configuration on , and the next-state logic makes one step of , cell by cell from the cells , and . This is the circuit of the PSPACE-hardness proof on the reachability problem page, of size . The output of is 1 when the control state is accepting. Compare with , a circuit with no latches and the constant 0 as output. The output sequence of is all 0 exactly when never accepts , so and are equivalent exactly when , that is, . The map is computed in polynomial time, so it is a polynomial-time reduction from .
The hard instances have no inputs at all, so the hardness comes from the state encoded in latches, not from the inputs. The combinational case, with no latches, is coNP-complete, as the miter page proves. For machines given by explicit state tables, a search of the product takes time linear in its size, and Hopcroft and Karp's method is near-linear in the sum of the sizes. We know of no single primary paper for the theorem; the proof above uses the standard tools in Sipser, Chapter 8.
Reductions
- To reachability and invariant checking. The product machine reduces non-equivalence to the reachability of a bad state in linear time, and equivalence to invariant checking of "the outputs agree".
- From combinational equivalence. Circuits with no latches are a special case.
- From reachability. The hardness proof turns a space-bounded machine into a circuit; in the same way, reachability of a target in a circuit reduces to equivalence with a circuit whose output is constant 0.
- To combinational equivalence, under a latch mapping. If the latches are paired and the pairing is an invariant, equivalence of the next-state and output functions as combinational circuits implies sequential equivalence. The converse fails, because the combinational check also looks at unreachable states.
Applications
- Retiming and sequential synthesis. Retiming, re-encoding of states by state assignment, and the removal of redundant latches change the latches, so a combinational check cannot verify them.
- RTL against a netlist. When synthesis changes the register structure, for example by pipelining or by clock gating, the RTL model and the gate netlist are compared sequentially.
- Engineering change orders. A late change to a netlist is checked against the version before the change.
References
- Michael Sipser, Introduction to the Theory of Computation, third edition, Cengage Learning, 2013, Chapter 8, Section 8.1 (Savitch's theorem, NPSPACE = PSPACE) and Section 8.3 (PSPACE-completeness and the encoding of configurations of a space-bounded machine)
- A. Kuehlmann and C. A. J. van Eijk, Combinational and sequential equivalence checking, in S. Hassoun and T. Sasao (editors), Logic Synthesis and Verification, Kluwer, 2002, 343 to 372, the definition of sequential equivalence, the product machine, and the survey of methods based on reachability, register correspondence and induction
- C. Pixley, A theory and implementation of sequential hardware equivalence, IEEE TCAD 11(12), 1469 to 1478, 1992, equivalence of designs without a known initial state, aligning sequences, and the BDD-based decision procedure
- C. A. J. van Eijk, Sequential equivalence checking based on structural similarities, IEEE TCAD 19(7), 814 to 819, 2000, the inductive proof of equal signals of the product machine without computing its reachable states
Where this leads
About this page
The build computes these levels from the evidence in the repository. Each row says what the next level needs. Read what the levels mean.
| Ladder | Level | What the next level needs |
|---|---|---|
| Human proof | H0 no proof |
|
| Lean | L0 no Lean part |
|
| Visual | V0 none |
|
| Writing | W2 basic |
|
Tag FEMWRD Edit this page History Report an error Markdown