Algorithm Search⌘K

Definitioncore

Product machine

Also called product FSM.

The machine that runs two FSMs side by side on the same inputs and flags a mismatch of outputs; two designs are equivalent if no mismatch state is reachable.

The product machine of two finite state machines with the same inputs and outputs runs both machines in lockstep on one input stream. Its state is a pair of states, one of each machine, and its only output is 1 when the two machines give different outputs. Two designs that start in their initial states are sequentially equivalent exactly when no state with a possible output 1 is reachable in the product. So the product turns sequential equivalence checking into a reachability problem, or an invariant check, on one machine. For circuits, the product is the miter of the two circuits with both sets of latches kept.

Definition

A deterministic Mealy machine is M=(X,Y,S,s0,δ,λ)M = (X, Y, S, s^0, \delta, \lambda) with input alphabet XX, output alphabet YY, finite state set SS, initial state s0s^0, next-state function δ:S×X→S\delta : S \times X \to S and output function λ:S×X→Y\lambda : S \times X \to Y. For a circuit, S={0,1}LS = \{0, 1\}^L for LL latches, X={0,1}nX = \{0, 1\}^n and Y={0,1}mY = \{0, 1\}^m. Here "transition" means one step of δ\delta on one input, a clock cycle.

Let M1M_1 and M2M_2 be such machines with the same XX and YY. Their product machine is

M1×M2=(X, {0,1}, S1×S2, (s10,s20), δ, λ),M_1 \times M_2 = \big(X,\ \{0, 1\},\ S_1 \times S_2,\ (s_1^0, s_2^0),\ \delta,\ \lambda\big),
δ((p,q),x)=(δ1(p,x),δ2(q,x)),λ((p,q),x)=[λ1(p,x)≠λ2(q,x)].\delta((p, q), x) = (\delta_1(p, x), \delta_2(q, x)), \qquad \lambda((p, q), x) = [\lambda_1(p, x) \ne \lambda_2(q, x)].

A state (p,q)(p, q) is bad if λ((p,q),x)=1\lambda((p, q), x) = 1 for some input xx. For Moore machines the outputs do not depend on xx, and a bad state is one with λ1(p)≠λ2(q)\lambda_1(p) \ne \lambda_2(q).

M1M_1 and M2M_2 are sequentially equivalent if, for every input sequence x0x1⋯xtx^0 x^1 \cdots x^t, the two machines started in s10s_1^0 and s20s_2^0 give the same output sequence.

Proposition (the product reduces equivalence to reachability). M1M_1 and M2M_2 are sequentially equivalent if and only if no bad state is reachable from (s10,s20)(s_1^0, s_2^0) in M1×M2M_1 \times M_2.

Proof. For an input sequence w=x0⋯xtw = x^0 \cdots x^t, let pip^i and qiq^i be the states of M1M_1 and M2M_2 before step ii. By the definition of δ\delta, (pi,qi)(p^i, q^i) is the state of the product after the prefix x0⋯xi−1x^0 \cdots x^{i-1}, so it is reachable. Every reachable state arises in this way.

(If) Suppose the outputs differ on ww, first at step ii. Then λ1(pi,xi)≠λ2(qi,xi)\lambda_1(p^i, x^i) \ne \lambda_2(q^i, x^i), so the reachable state (pi,qi)(p^i, q^i) is bad.

(Only if) Suppose (p,q)(p, q) is bad with witness xx and is reached by x0⋯xi−1x^0 \cdots x^{i-1}. Then on the input sequence x0⋯xi−1xx^0 \cdots x^{i-1} x, the machines give different outputs at the last step. □\square

The product of circuits with L1L_1 and L2L_2 latches has L1+L2L_1 + L_2 latches and is built in linear size, but its state space has 2L1+L22^{L_1 + L_2} states, the state explosion problem in its plainest form.

Examples and non-examples

Two encodings of a parity bit. M1M_1 has one latch pp, initial value 0, next state p⊕xp \oplus x and output pp. M2M_2 has two latches q1q2q_1 q_2 with initial value 1010, swaps them when x=1x = 1, keeps them when x=0x = 0, and outputs q2q_2. So M2M_2 is a one-hot encoding of the same bit. The product has 8 states (p,q1q2)(p, q_1 q_2).

state reachable bad
(0,10)(0, 10) yes, initial no
(1,01)(1, 01) yes, after x=1x = 1 no
(0,01)(0, 01), (1,10)(1, 10) no yes
(1,00)(1, 00), (0,11)(0, 11) no yes
(0,00)(0, 00), (1,11)(1, 11) no no

The reachable states are (0,10)(0, 10) and (1,01)(1, 01), and neither is bad, so the machines are equivalent. Four bad states exist, but none is reachable. A check of the miter of the combinational parts alone, with latch values as free inputs, would report a difference at (0,01)(0, 01).

A difference. Give M2M_2 the initial value 0101. Then the initial state (0,01)(0, 01) is bad, and the empty prefix with any input xx separates the machines.

Non-example: different input sets. If one design has an input that the other lacks, the product is not defined until the inputs are matched or the extra input is fixed. The product compares behaviour for one shared input stream.

Non-example: no initial state. The proposition uses the pair of initial states. For designs without a reset, the question is about all power-up states, and reachability from one pair does not answer it; see safe replaceability.

  • Equivalence checking for labelled transition systems compares possibly nondeterministic systems by bisimulation, trace equivalence and other behavioural relations, with no inputs and outputs in the sense above. For deterministic machines with inputs and outputs, as here, these notions agree, and the product reduces the question to reachability.
  • The product construction of finite automata is the same pairing of states, and DFA equivalence uses it with "accepting in exactly one automaton" as the bad states.
  • The miter is the product with no latches; reachability is then trivial, and the question is satisfiability.
  • Signal correspondence proves that no bad state is reachable by an inductive invariant of the product, and image computation computes its reachable states with BDDs.

References

  1. O. Coudert, C. Berthet and J. C. Madre, Verification of synchronous sequential machines based on symbolic execution, LNCS 407, Springer, 1989, the comparison of two machines by a symbolic traversal of the states of the machine that runs both
  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 section on sequential equivalence checking, the product machine and 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)
WritingW4 complete
  • a review of the text: no review record reviews/0MGAEA/text.yaml