Algorithm Search⌘K

Problemcore

Latch mapping

Also called register matching, register correspondence for equivalence checking.

Pair the registers of two sequential designs so that combinational equivalence checking can compare their next-state and output functions.

Latch mapping pairs each latch of one sequential design with a latch of the other, so that two designs with the same register structure can be compared by a combinational check. Once each latch output and its partner are the same free variable, the next-state function of each latch and the output functions become combinational functions of the inputs and the latch values, and a miter compares them. On this page "mapping" means this correspondence between latches, not technology mapping. If the paired functions are equal and the initial values agree, the designs are sequentially equivalent. The converse fails: designs changed by retiming or by state re-encoding have no such pairing, and then a sequential method is needed. Burch and Singhal (1998) made latch mapping robust to the loss of names in synthesis.

In plain words

Two versions of a chip should do the same thing. The memory cells of one usually have partners in the other, but synthesis tools rename cells, so you cannot match them by name. If you can find the right partner for every cell, you can cut the chips open at the memory cells and check the logic between them, one cell at a time, as if there were no memory at all. That check is much easier. The hard part is to find the partners, and to notice when there are none.

Definition

Input. Two synchronous circuits C1C_1 and C2C_2 with the same primary inputs xx and outputs. C1C_1 has latches r1,…,rLr_1, \ldots, r_L with next-state functions δi\delta_i and initial values aia_i, and C2C_2 has latches r1′,…,rL′r'_1, \ldots, r'_L with δj′\delta'_j and aj′a'_j. The output functions are λ\lambda and λ′\lambda'. All are functions of the inputs and the latch outputs.

Mapping. A bijection φ:{1,…,L}→{1,…,L}\varphi : \{1, \ldots, L\} \to \{1, \ldots, L\}, with an optional polarity σi∈{0,1}\sigma_i \in \{0, 1\} for latches that store an inverted value. Under φ\varphi, the latch output rφ(i)′r'_{\varphi(i)} is replaced by the variable ri⊕σir_i \oplus \sigma_i, so that all functions are over xx and rr.

Output. A mapping that is valid:

  • δφ(i)′(x,r)=δi(x,r)⊕σi\delta'_{\varphi(i)}(x, r) = \delta_i(x, r) \oplus \sigma_i for every ii and every (x,r)(x, r);
  • λ′(x,r)=λ(x,r)\lambda'(x, r) = \lambda(x, r) for every (x,r)(x, r);

or the answer that none exists. The initial values are checked apart: aφ(i)′=ai⊕σia'_{\varphi(i)} = a_i \oplus \sigma_i.

Proposition (soundness). If φ\varphi is valid and the initial values agree, then C1C_1 and C2C_2 are sequentially equivalent.

Proof. Let ρ(r)\rho(r) be the state of C2C_2 with rφ(i)′=ri⊕σir'_{\varphi(i)} = r_i \oplus \sigma_i. We show by induction on tt that after any tt inputs, C2C_2 is in ρ(s)\rho(s) when C1C_1 is in ss. At t=0t = 0 this is the agreement of the initial values. If it holds at tt with input xx, then latch φ(i)\varphi(i) of C2C_2 gets δφ(i)′\delta'_{\varphi(i)} at ρ(s)\rho(s), which is δi(x,s)⊕σi\delta_i(x, s) \oplus \sigma_i by validity, so the next state is ρ(δ(s,x))\rho(\delta(s, x)). The output functions agree at every (x,s)(x, s), so the outputs agree at every step. □\square

Variants

  • Many to one. Synthesis can duplicate a latch, or remove one that is constant or that copies another. Then the mapping pairs classes of latches, not single latches, and constant latches are mapped to constants.
  • Unequal latch counts. After retiming, the counts differ, and no mapping exists. Methods then check the retimed circuit against the original with the retiming lags, or fall back on sequential equivalence.
  • Register correspondence by induction. Ask only that paired latches hold equal values in every reachable state, not that the next-state functions be equal everywhere. This weaker notion is the latch part of signal correspondence; its combinational check is relative to the assumption that the pairs are equal.
  • Partial mapping. Map what is clear, cut the rest as free inputs, and accept the risk of false negatives.

Examples

Swapped latches. C1C_1 has latches p,qp, q with p+=ap^+ = a, q+=p∧bq^+ = p \wedge b and output qq. C2C_2 has latches u,vu, v with u+=v∧bu^+ = v \wedge b, v+=av^+ = a and output uu. The mapping p↦vp \mapsto v, q↦uq \mapsto u is valid: v+=a=p+v^+ = a = p^+, u+=v∧bu^+ = v \wedge b becomes p∧b=q+p \wedge b = q^+, and the outputs are uu and qq. The mapping p↦up \mapsto u, q↦vq \mapsto v is not: it would need u+=v∧bu^+ = v \wedge b, which becomes q∧bq \wedge b, to equal p+=ap^+ = a.

An inverted latch. If C2C_2 stores ¬p\neg p in a latch ww with w+=¬aw^+ = \neg a and uses ¬w\neg w where C1C_1 uses pp, the mapping p↦wp \mapsto w with polarity 1 is valid.

Equivalent, but no valid mapping. C1C_1 has latches p,qp, q, both with next value p⊕xp \oplus x and initial value 0, and output p∧qp \wedge q. C2C_2 has latches u,wu, w, both with next value u⊕xu \oplus x and initial value 0, and output uu. In C1C_1 the invariant p=qp = q holds, so the output is pp, and the circuits are equivalent. The mapping p↦up \mapsto u, q↦wq \mapsto w fails at the output: p∧q≠pp \wedge q \ne p at the unreachable state p=1,q=0p = 1, q = 0. The other mapping fails at w+=u⊕xw^+ = u \oplus x, which becomes q⊕xq \oplus x, against p+=p⊕xp^+ = p \oplus x. Register correspondence by induction proves this pair, because it assumes p=qp = q.

Retiming. The example on the sequential equivalence page has 1 latch against 2, so no mapping exists.

Known algorithms

  • By name. Match the latch names, with rules for the renaming of the synthesis tool. Fast, but it breaks when names are lost.
  • By structure. Compare the fanin cones of the latches, as a graph isomorphism problem on the two netlists. Gemini does this kind of netlist comparison by iterative labelling of vertices.
  • By function. Burch and Singhal (1998) map latches by their functions, not their names: a latch and its partner must have equal next-state functions once their fanin latches are mapped. A natural way to find partners is partition refinement of the latches of both designs: give the latches of one class the same random value, simulate, and split a class when the next-state values of its members differ, until no class splits. We describe this scheme only in outline; the exact procedure of Burch and Singhal is in their paper.
  • The check after the mapping. Any combinational method works; see cutpoint equivalence checking and SAT sweeping.
  • By induction. Signal correspondence restricted to latches computes the coarsest register correspondence that is inductive. It also covers the invariant case above.

Bounds

The problem of deciding whether a valid mapping exists is coNP-hard and in Σ2p\Sigma_2^p.

Proof. coNP-hard. With no latches, the only mapping is the empty one, and it is valid exactly when the output functions are equal. That is combinational equivalence, which is coNP-complete. In Σ2p\Sigma_2^p. Guess φ\varphi and σ\sigma, then check validity, which is the statement that a combinational miter has no satisfying input, a coNP question. □\square

We do not know a tighter bound; the search over the L!L! bijections is the part that heuristics attack. In practice signatures from simulation leave few candidates, and each candidate costs one combinational check.

Reductions

  • To combinational equivalence. A fixed mapping turns the check into combinational equivalence of L+mL + m pairs of functions, by the proposition above.
  • From sequential equivalence, as a sound step. A valid mapping proves sequential equivalence. No mapping proves nothing, as the examples show.
  • To signal correspondence. Register correspondence by induction is signal correspondence with only latches in the classes.

Applications

  • Combinational equivalence checking of netlists. Commercial checkers compare RTL with gates, or gates before and after optimization, by mapping latches first and then running a combinational check on each cone.
  • Engineering change orders. After a small change to a netlist, most latches keep their partners, and the mapping is quick.
  • Diagnosis. A latch with no partner, or a mapped pair whose functions differ, points at the location of a bug.

References

  1. J. R. Burch and V. Singhal, Robust latch mapping for combinational equivalence checking, ICCAD 1998, 563 to 569, the latch mapping problem, the functional method that does not rely on names, and its results on industrial designs
  2. J. R. Burch and V. Singhal, Tight integration of combinational verification methods, ICCAD 1998, 570 to 576, the combinational check that runs after the latches are mapped
  3. 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 reduction of sequential equivalence to combinational equivalence by a register correspondence, and register correspondence by induction

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 known algorithm
  • a contract.yaml