Algorithm Search⌘K

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 C1C_1 and C2C_2 with the same primary inputs x∈{0,1}nx \in \{0, 1\}^n and the same outputs, matched by name. Circuit CiC_i has LiL_i latches with initial values si0s_i^0, a next-state function δi(s,x)\delta_i(s, x) and an output function λi(s,x)\lambda_i(s, x), all given as gates. Here a transition is one clock cycle: one step of δi\delta_i on one input vector.

Output. Yes if for every input sequence x0x1⋯xtx^0 x^1 \cdots x^t the two output sequences from s10s_1^0 and s20s_2^0 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 (p,q)(p, q) with λ1(p,x)≠λ2(q,x)\lambda_1(p, x) \ne \lambda_2(q, x) for some xx is reachable from (s10,s20)(s_1^0, s_2^0).

Variants

  • Bounded equivalence. Equal outputs for all sequences of length at most kk. With kk given in unary this is coNP-complete: unroll both circuits kk times into one combinational miter, and the case k=1k = 1 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. C1C_1 has one latch rr with initial value 0, next value a∧ba \wedge b and output rr. C2C_2 has two latches u,vu, v with initial values 0,00, 0, next values aa and bb, and output u∧vu \wedge v. At clock 0 both outputs are 0, and at clock t≥1t \ge 1 both are at−1∧bt−1a^{t-1} \wedge b^{t-1}. 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 uu and vv the initial values 1,11, 1. 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 kk 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.

AlgorithmTimeSpacePropertiesCode
Signal correspondenceO(V^2 4^(L + 2I)) worstO(V^2 4^(L + 2I)) extranot completedeterministicnot exactrecursive1 language

Bounds

Theorem. Sequential equivalence of circuits given as netlists is PSPACE-complete.

Proof. Let NN be the total size of the two circuits and L=L1+L2L = L_1 + L_2.

In PSPACE. We show that non-equivalence is in NPSPACE. A nondeterministic machine keeps the product state (p,q)(p, q) in LL bits and a counter cc in LL bits, starting from (s10,s20)(s_1^0, s_2^0) and c=0c = 0. At each step it guesses an input xx and evaluates both circuits on (p,x)(p, x) and (q,x)(q, x) in space O(N)O(N). If the outputs differ, it accepts. Otherwise it sets (p,q)←(δ1(p,x),δ2(q,x))(p, q) \leftarrow (\delta_1(p, x), \delta_2(q, x)) and c←c+1c \leftarrow c + 1, and it rejects when cc reaches 2L2^L. 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 2L2^L steps; some run accepts. If they are equivalent, no run accepts. The space is O(N+L)O(N + L), 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 L′L' be any language in PSPACE. Its complement is also in PSPACE, so it is decided by a deterministic Turing machine DD in space p(m)p(m) on inputs of length mm. Change DD so that its accepting and rejecting states loop on themselves. For an input ww, build a circuit CwC_w with no primary inputs. Its latches hold a configuration of DD: p(m)p(m) cells, each with a tape symbol and a marker for the head and the control state. Their initial values are the initial configuration on ww, and the next-state logic makes one step of DD, cell by cell from the cells j−1j - 1, jj and j+1j + 1. This is the circuit of the PSPACE-hardness proof on the reachability problem page, of size O(p(m))O(p(m)). The output of CwC_w is 1 when the control state is accepting. Compare CwC_w with C0C_0, a circuit with no latches and the constant 0 as output. The output sequence of CwC_w is all 0 exactly when DD never accepts ww, so CwC_w and C0C_0 are equivalent exactly when w∉L′‾w \notin \overline{L'}, that is, w∈L′w \in L'. The map w↦(Cw,C0)w \mapsto (C_w, C_0) is computed in polynomial time, so it is a polynomial-time reduction from L′L'. ■\blacksquare

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

  1. 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)
  2. 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
  3. 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
  4. 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.

LadderLevelWhat the next level needs
Human proofH0 no proof
  • add a proof in proofs/ (06.5)
LeanL0 no Lean part
  • name a Lean module in the lean field (07)
VisualV0 none
  • add viz/scene.ts or a figure (10)
WritingW2 basic
  • a contract.yaml