This paper was converted on www.awesomepapers.org from LaTeX by an anonymous user.
Want to know more? Visit the Converter page.

Equivalence Checking and Simulation By Computing Range Reduction

Eugene Goldberg eu.goldberg@gmail.com
Abstract

We introduce new methods of equivalence checking and simulation based on Computing Range Reduction (CRR). Given a combinational circuit NN, the CRR problem is to compute the set of outputs that disappear from the range of NN if a set of inputs of NN is excluded from consideration. Importantly, in many cases, range reduction can be efficiently found even if computing the entire range of NN is infeasible.

Solving equivalence checking by CRR facilitates generation of proofs of equivalence that mimic a “cut propagation” approach. A limited version of such an approach has been successfully used by commercial tools. Functional verification of a circuit NN by simulation can be viewed as a way to reduce the complexity of computing the range of NN. Instead of finding the entire range of NN and checking if it contains a bad output, such a range is computed only for one input. Simulation by CRR offers an alternative way of coping with the complexity of range computation. The idea is to exclude a subset of inputs of NN and compute the range reduction caused by such an exclusion. If the set of disappeared outputs contains a bad one, then NN is buggy.

I Introduction

The objective of this paper is to emphasize the importance of developing efficient algorithms for Computing Range Reduction (CRR). Earlier we showed that CRR can be used for model checking [5]. Adding equivalence checking and simulation to the list of problems that can be handled by CRR makes the need for developing efficient CRR algorithms more obvious.

I-A The CRR problem

Let N(X,Y,Z)N(X,Y,Z) be a combinational circuit where X,Y,ZX,Y,Z are the sets of input, intermediate and output variables of NN respectively (see Figure 1). We will refer to the set of all outputs produced by NN as the range of NN. By an “output” here we mean a complete assignment of values to the variables of ZZ. We will also use term “input” to denote a complete assignment to the variables of XX.

Refer to caption
Figure 1: Combinational circuit NN

Suppose that one excludes a set KK of complete assignments to XX from the set of available inputs to NN. If an output 𝒛z is produced only by inputs that are in KK, excluding the inputs of KK from consideration leads to disappearance of 𝒛z from the range of NN. The CRR problem is to compute the outputs of NN that are excluded from the range of NN if the inputs of a set KK are excluded from consideration.

I-B Equivalence checking by CRR

Equivalence Checking can be a hard problem even for combinational circuits. This is especially true when the circuits to be compared have few functionally equivalent internal points. Our motivation here is that, as we argue in Section IV, equivalence checking by CRR facilitates construction of “natural” proofs. Such proofs are generated by industrial equivalence checkers when the circuits to be compared have a lot of internal points that are functionally equivalent.

Refer to caption
Figure 2: MM is a two-output circuit composed of independent circuits NN^{\prime} and N′′N^{\prime\prime}

Application of CRR to equivalence checking is based on the following observation. Let NN^{\prime} and N′′N^{\prime\prime} be single-output combinational circuits to be checked for equivalence. (The expression “a single-output circuit” means that this circuit has only one output variable. Whether we use term “output” to refer to an “output variable” or “output assignment” should be clear from the context.) Let MM be a two-output circuit composed of NN^{\prime} and N′′N^{\prime\prime} as shown in Figure 2. Note that the sets XX^{\prime} and X′′X^{\prime\prime} of input variables of NN^{\prime} and N′′N^{\prime\prime} are independent of each other. Then, if NN^{\prime} and N′′N^{\prime\prime} are not constants, the range of circuit MM consists of all four assignments to the output variables zz^{\prime},z′′z^{\prime\prime} of NN^{\prime} and N′′N^{\prime\prime}.

Let (𝒙x^{\prime},𝒙′′x^{\prime\prime}) denote an assignment to variables XX′′X^{\prime}\cup X^{\prime\prime}. Suppose that one excludes from consideration all assignments (𝒙x^{\prime},𝒙′′x^{\prime\prime}) where 𝒙𝒙′′{\mbox{\boldmath$x^{\prime}$}}\neq{\mbox{\boldmath$x^{\prime\prime}$}}. Then if NN^{\prime} and N′′N^{\prime\prime} are functionally equivalent, such constraint on inputs of MM should lead to disappearing assignments (z=0,z′′=1)(z^{\prime}=0,z^{\prime\prime}=1) and (z=1,z′′=0)(z^{\prime}=1,z^{\prime\prime}=0) from the range of MM. If this is not the case, then there is an input (𝒙x^{\prime},𝒙′′x^{\prime\prime}) of MM where 𝒙x^{\prime}=𝒙′′x^{\prime\prime} for which NN^{\prime} and N′′N^{\prime\prime} evaluate to different values i.e. NN^{\prime} and N′′N^{\prime\prime} are inequivalent.

I-C Simulation by CRR

Functional verification of a combinational circuit NN comes down to checking if the range of NN contains an erroneous output. The straightforward approach of computing the range of NN is extremely inefficient. Simulation can be viewed as a way to simplify the range computation problem by reducing the set of inputs of NN to only one (regular simulation) or to a subset of inputs (symbolic simulation [2]). In this paper, we consider a different way to cope with complexity of range computation called simulation-by-exclusion. It is based on the idea of computing the reduction of range of NN caused by excluding some inputs from consideration rather than the entire range of NN.

Suppose that one needs to check if an erroneous output 𝒛z is produced by NN. Assume that a set of inputs KK is excluded from consideration. Let QQ be the set of outputs that disappear from the range of NN due to exclusion of inputs from KK. One can have only the following two cases. The first case is 𝒛Q{\mbox{\boldmath$z$}}\not\in Q. This means that either 𝒛z is not in the range of NN i.e. NN is correct or NN is buggy but there is an input 𝒙K{\mbox{\boldmath$x$}}\not\in K producing 𝒛z. So exclusion of the inputs of KK does not make 𝒛z disappear from the range of NN. Then one can safely remove the inputs of KK from further consideration because if NN is buggy, the set of available inputs still contains a counterexample. The second case is 𝒛Q{\mbox{\boldmath$z$}}\in Q. Then NN is buggy because 𝒛z is in its range.

In this paper, we describe the basic algorithm of simulation-by-exclusion and a few of its modifications.

I-D CRR by partial quantifier elimination

In [5], we showed that the CRR problem comes down to Partial Quantifier Elimination (PQE). The difference between partial and complete elimination is that, in PQE, only a part of the formula is taken out of the scope of quantifiers. Let us explain the relation between CRR and PQE in the context of equivalence checking. Let 𝐸𝑄(X,X′′)\mathit{EQ}(X^{\prime},X^{\prime\prime}) denote a propositional formula such that 𝐸𝑄(𝒙,𝒙′′)=1\mathit{EQ}({\mbox{\boldmath$x^{\prime}$}},{\mbox{\boldmath$x^{\prime\prime}$}})=1 iff 𝒙x^{\prime} = 𝒙′′x^{\prime\prime}. Equivalence checking by CRR comes down to taking 𝐸𝑄\mathit{EQ} out of the scope of quantifiers in formula W[𝐸𝑄FF′′]\exists{W}[\mathit{EQ}\wedge F^{\prime}\wedge F^{\prime\prime}]. Here formulas FF^{\prime} and F′′F^{\prime\prime} specify circuits NN^{\prime} and N′′N^{\prime\prime} of Figure 2 and W=XX′′YY′′W=X^{\prime}\cup X^{\prime\prime}\cup Y^{\prime}\cup Y^{\prime\prime}.

Taking 𝐸𝑄\mathit{EQ} out of the scope of quantifiers means finding a quantifier-free formula H(z,z′′)H(z^{\prime},z^{\prime\prime}) such that W[𝐸𝑄FF′′]HW[FF′′]\mbox{$\exists{W}[\mathit{EQ}\wedge F^{\prime}\wedge F^{\prime\prime}]$}\equiv H\wedge\mbox{$\exists{W}[F^{\prime}\wedge F^{\prime\prime}]$}. If an output of circuit MM of Figure 2 disappears from its range after excluding inputs falsifying 𝐸𝑄\mathit{EQ}, this output falsifies HH. So if H(0,1)=H(1,0)=0H(0,1)=H(1,0)=0, circuits NN^{\prime} and N′′N^{\prime\prime} are equivalent.

Let us explain the benefits of solving PQE. We assume here and henceforth that all formulas are represented in the Conjunctive Normal Form (CNF). The appeal of PQE is that it allows one to focus on deriving implications that matter. Namely, formula HH can be built solely from clauses that are implied by formula 𝐸𝑄FF′′\mathit{EQ}\wedge F^{\prime}\wedge F^{\prime\prime} and are not implied by formula FF′′F^{\prime}\wedge F^{\prime\prime}. This means that a PQE solver can ignore the resolvents obtained only from clauses of FF′′F^{\prime}\wedge F^{\prime\prime} focusing on resolvents that are descendants of clauses of 𝐸𝑄\mathit{EQ}. Such zooming in on the “right” resolvents can make building formula HH much more efficient.

I-E Difference in CRR for equivalence checking and simulation

Our methods of using CRR for equivalence checking and simulation are different in one important aspect. In equivalence checking, one builds a circuit MM of Figure 2 and eliminates the spurious behaviors where 𝒙𝒙′′{\mbox{\boldmath$x^{\prime}$}}\neq{\mbox{\boldmath$x^{\prime\prime}$}}. The presence of a bug corresponds to the situation when an erroneous output is not excluded from the range of MM under the input constraints. Conversely, simulation-by-exclusion is based on elimination of valid inputs. Then, the presence of a bug corresponds to the situation where an erroneous output is excluded from the range of the circuit under test.

The difference above is important for the following reason. When describing application of CRR to equivalence checking and simulation in Subsections  I-B and I-C we assumed that range reduction is computed precisely. However, a PQE solver computes a superset of the set of excluded outputs  [5] that may include outputs that are not in the range (see Subsection III-D.) We will refer to such outputs as noise. Adding noise to the set of excluded outputs in equivalence checking by CRR cannot trigger false alarms. (As we mentioned above the situation of concern here is when a bad output of MM is not excluded under input constraints. ) Conversely, in simulation-by-exclusion, adding noise can set off a false alarm. This happens when a bad output 𝒛z is in the set of excluded outputs computed by a PQE solver but, in reality, 𝒛z is not in the range of the circuit.

I-F Structure of the paper

This paper is structured as follows. Section II formally defines the CRR problem. Solving this problem by PQE is discussed in Section III. In Section IV, we introduce a method of equivalence checking by CRR. Simulation-by-exclusion is discussed in Sections V and  VI. Some background and conclusions are given in Section VII and Section VIII respectively.

II Problem Of Computing Range Reduction

Let N(X,Y,Z)N(X,Y,Z) be a combinational circuit where X,Y,ZX,Y,Z are input, intermediate and output variables respectively. Let NN evaluate to output 𝒛z (i.e. a complete assignment to ZZ) under an input 𝒙x (i.e. a complete assignment to XX). We will say that 𝒛z is produced by NN.

Let A(X)A(X) be a set of inputs of NN. Denote by 𝑹𝒏𝒈(𝑵,𝑨)\mathit{Rng}(N,A) the range of NN under inputs of AA. That is an output 𝒛z is in 𝑅𝑛𝑔(N,A)\mathit{Rng}(N,A) iff 𝒛z is produced by NN for some input 𝒙A{\mbox{\boldmath$x$}}\in A. If AA consists of all 2|X|2^{|X|} inputs of NN, then 𝑅𝑛𝑔(N,A)\mathit{Rng}(N,A) specifies the entire range of NN. From the definition of 𝑅𝑛𝑔(N,A)\mathit{Rng}(N,A) it follows that 𝑅𝑛𝑔(N,AB)𝑅𝑛𝑔(N,A)\mbox{$\mathit{Rng}(N,A\setminus B)$}\subseteq\mbox{$\mathit{Rng}(N,A)$} where BB is a set of inputs of NN.

Definition 1

Let AA and BB be sets of inputs of circuit NN such that ABA\cap B\neq\emptyset. The CRR problem is to find the set 𝑅𝑛𝑔(N,A)𝑅𝑛𝑔(N,AB)\mbox{$\mathit{Rng}(N,A)$}\setminus\mbox{$\mathit{Rng}(N,A\setminus B)$}. If an output 𝐳z is in 𝑅𝑛𝑔(N,A)𝑅𝑛𝑔(N,AB)\mbox{$\mathit{Rng}(N,A)$}\setminus\mbox{$\mathit{Rng}(N,A\setminus B)$}, we will say that 𝐳z is excluded from 𝑅𝑛𝑔(N,A)\mathit{Rng}(N,A) due to excluding inputs of BB.

Below, we give definition of an approximate solution to the CRR problem. The reason is that, as we showed in [5], algorithms for partial quantifier elimination provide only approximate solutions to the CRR problem (see Subsection III-D).

Definition 2

Let QQ denote 𝑅𝑛𝑔(N,A)𝑅𝑛𝑔(N,AB)\mbox{$\mathit{Rng}(N,A)$}\setminus\mbox{$\mathit{Rng}(N,A\setminus B)$} from Definition 1. Let QQ^{*} be a superset of QQ. We will say that QQ^{*} is an approximate solution of the CRR problem if for every 𝐳QQ{\mbox{\boldmath$z$}}\in Q^{*}\setminus Q it is true that 𝐳𝑅𝑛𝑔(N,A){\mbox{\boldmath$z$}}\not\in\mbox{$\mathit{Rng}(N,A)$}. In other words, an approximate solution of the CRR problem is the precise solution modulo outputs that are not in 𝑅𝑛𝑔(N,A)\mathit{Rng}(N,A). We will refer to such outputs as noise.

III Computing Range Reduction By Partial Quantifier Elimination

In this section, we relate range computation with quantifier elimination and range reduction computation with partial quantifier elimination. Besides, we recall our previous results on complete and partial quantifier elimination.

III-A Complete and partial quantifier elimination

Given a quantified CNF formula W[F(V,W)]\exists{W}[F(V,W)], the problem of Quantifier Elimination (QE) is to find a quantifier-free formula H(V)H(V) such that HW[F]H\equiv\mbox{$\exists{W}[F]$}.

Given a quantified CNF formula W[G(V,W)F(V,W)]\exists{W}[G(V,W)\wedge F(V,W)], the problem of Partial Quantifier Elimination (PQE) is to find a quantifier-free CNF formula G(V)G^{*}(V) such that GW[F]W[GF]G^{*}\wedge\mbox{$\exists{W}[F]$}\equiv\mbox{$\exists{W}[G\wedge F]$}. We will say that formula GG^{*} is obtained by taking 𝑮G out of the scope of quantifiers in W[GF]\exists{W}[G\wedge F]. The term “partial” emphasizes the fact that, in contrast to QE, only a part of the quantified formula is taken out of the scope of quantifiers.

In this paper, we do not discuss algorithms for solving the PQE problem. In Subsection IV-B, we only explain how a PQE algorithm implements a cut advancement strategy. More information can be found in  [6].

III-B Computing range by QE and range reduction by PQE

Let F(X,Y,Z)F(X,Y,Z) be a CNF formula specifying circuit N(X,Y,Z)N(X,Y,Z). That is every consistent assignment of Boolean values to variables of NN is a satisfying assignment for FF and vice versa. Let H(Z)H(Z) be a CNF formula such that HXY[F]H\equiv\mbox{$\exists{X}\exists{Y}[F]$}. Then the outputs of NN satisfying HH specify the range of NN. So computing the range of NN comes down to solving the QE problem. Assume that only inputs satisfying formula G(X)G(X) are considered. Then a CNF formula H(Z)H(Z) equivalent to XY[GF]\exists{X}\exists{Y}[G\wedge F] specifies the range of NN under inputs satisfying GG.

Suppose that we are interested only in finding how the range of NN reduces if the inputs falsifying GG are excluded i.e. only inputs satisfying GG are considered. As we showed in  [5], this problem comes down to finding CNF formula G(Z)G^{*}(Z) such that GW[F]W[GF]G^{*}\wedge\mbox{$\exists{W}[F]$}\equiv\mbox{$\exists{W}[G\wedge F]$} where W=XYW=X\cup Y. Here GG^{*} specifies an approximate solution to the CRR problem (see Definition 2) i.e.

  • the outputs falsifying GG^{*} specify a superset of the set of outputs disappearing from the range of NN due to excluding inputs falsifying GG

  • every output 𝒛z falsifying GG^{*} either disappeared from the range of NN due to excluding inputs falsifying GG or is not in the range of NN

III-C Complexity of computing range and range reduction

As we mentioned above, computing the range of NN reduces to QE whereas finding range reduction comes down to PQE. So the complexity of computing range and range reduction is directly related to that of QE and PQE.

The difference between QE and PQE can be expressed in terms of computing clause redundancy [4, 6]. For the sake of simplicity, in descriptions of algorithms of  [4] and  [6] given below we omitted the fact that they use branching. (First the problem is solved in subspaces. Then the results of branches are merged to produce a solution that holds for the entire search space.)

As we showed in [3, 4], to eliminate quantifiers from W[F(X,Y,Z)]\exists{W}[F(X,Y,Z)] where W=XYW=X\cup Y one needs to find a CNF formula H(Z)H(Z) implied by FF that makes all the clauses of FF with quantified variables redundant in W[FH]\exists{W}[F\wedge H]. Then formula HH is logically equivalent to W[F]\exists{W}[F]. We will refer to clauses containing variables of WW (i.e. quantified variables) as 𝑾W-clauses.

Clauses of HH are built from FF by adding resolvent clauses. If a resolvent is a WW-clause, its redundancy has to be proved along with the original WW-clauses of FF. Eventually, a sufficient number of clauses depending only on free variables (i.e. those of ZZ) is added to make the new and old WW-clauses of FF redundant.

Now, let us consider the PQE problem of taking formula G(X)G(X) out of the scope of quantifiers in W[GF]\exists{W}[G\wedge F]. As we showed in [6], this problem comes down to finding formula G(Z)G^{*}(Z) implied by GFG\wedge F that makes redundant the clauses of GG in W[GGF]\exists{W}[G^{*}\wedge G\wedge F]. The clauses of GG^{*} are built by resolving clauses of GFG\wedge F. If a resolvent is a WW-clause and is a descendant of a clause of GG, its redundancy needs to be proved as well. On the other hand, WW-resolvents produced solely from clauses of FF do not need to be proved redundant. This can make PQE drastically simpler than QE if GG is much smaller than FF.

III-D Quality of PQE-solving

In this subsection, we clarify the relation between the quality of a PQE-algorithm and that of an approximate solution to the CRR problem. As in the previous subsection, we assume that formula G(Z)G^{*}(Z) is obtained by taking formula G(X)G(X) out of the scope of quantifiers in W[GF]\exists{W}[G\wedge F]. Here W=XYW=X\cup Y and FF specifies circuit N(X,Y,Z)N(X,Y,Z).

The definitions below are based on the following observation. If GG^{*} is a solution to the PQE problem above, a formula obtained by adding to GG^{*} a clause C(Z)C(Z) implied by FF is also a solution to the PQE problem. One can view CC as “noise”. Such a clause is falsified only by outputs that are not in the range of NN. In general, the set of outputs falsifying a clause of GG^{*} can contain outputs that are in the range of NN and those that are not.

Definition 3

Let CC be a clause of GG^{*}. We will say that CC is noise-free if every output falsifying CC is in the range of NN. Otherwise, clause CC is called noisy. Formula GG^{*} is called a noisy solution to the PQE problem if it contains a noisy clause. Otherwise, GG^{*} is called noise-free.

IV Equivalence Checking By Computing Range Reduction

In this section, we describe equivalence checking by CRR. In Subsection IV-A, we give the main proposition on which our method is based. Subsection IV-B compares equivalence checking by CRR and SAT-solving.

IV-A Main proposition

The intuition behind applying CRR to equivalence checking was described in the introduction. In this subsection, we substantiate this intuition in a formal proposition.

Let N(X,Y,z)N^{\prime}(X^{\prime},Y^{\prime},z^{\prime}) and N′′(X′′,Y′′,z′′)N^{\prime\prime}(X^{\prime\prime},Y^{\prime\prime},z^{\prime\prime}) be single-output combinational circuits to be checked for equivalence. Let M(X,X′′,Y,Y′′,z,z′′)M(X^{\prime},X^{\prime\prime},Y^{\prime},Y^{\prime\prime},z^{\prime},z^{\prime\prime}) be the circuit composed of NN^{\prime} and N′′N^{\prime\prime} as shown in Figure 2. Let F(X,Y,z)F^{\prime}(X^{\prime},Y^{\prime},z^{\prime}) and F′′(X′′,Y′′,z′′)F^{\prime\prime}(X^{\prime\prime},Y^{\prime\prime},z^{\prime\prime}) be CNF formulas specifying NN^{\prime} and N′′N^{\prime\prime} respectively. Assume that X={x1,,xk}X^{\prime}=\mbox{$\{x^{\prime}_{1},\dots,x^{\prime}_{k}\}$} and X′′={x1′′,,xk′′}X^{\prime\prime}=\mbox{$\{x^{\prime\prime}_{1},\dots,x^{\prime\prime}_{k}\}$}. Denote by 𝐸𝑄(X,X′′)\mathit{EQ}(X^{\prime},X^{\prime\prime}) formula (x1x1′′)(xkxk′′)(x^{\prime}_{1}\equiv x^{\prime\prime}_{1})\wedge\dots\wedge(x^{\prime}_{k}\equiv x^{\prime\prime}_{k}) that is satisfied by inputs 𝒙x^{\prime} and 𝒙′′x^{\prime\prime} to NN^{\prime} and N′′N^{\prime\prime} iff 𝒙x^{\prime} = 𝒙′′x^{\prime\prime}.

Proposition 1

Let H(z,z′′)H(z^{\prime},z^{\prime\prime}) be a CNF formula obtained by taking 𝐸𝑄(X,X′′)\mathit{EQ}(X^{\prime},X^{\prime\prime}) out of the scope of quantifiers from the formula W[𝐸𝑄FF′′]\exists{W}[\mathit{EQ}\wedge F^{\prime}\wedge F^{\prime\prime}] where W=XX′′YY′′W=X^{\prime}\cup X^{\prime\prime}\cup Y^{\prime}\cup Y^{\prime\prime}. Circuits NN^{\prime} and N′′N^{\prime\prime} are functionally equivalent iff one of the two conditions below hold:

  1. 1.

    H(0,1)=H(1,0)=0H(0,1)=H(1,0)=0

  2. 2.

    Circuits NN^{\prime} and N′′N^{\prime\prime} are identical constants (i.e. NN′′0N^{\prime}\equiv N^{\prime\prime}\equiv 0 or NN′′1N^{\prime}\equiv N^{\prime\prime}\equiv 1.).

Proof:

The if part. Assume that H(0,1)=H(1,0)=0H(0,1)=H(1,0)=0. Since H(z,z′′)H(z^{\prime},z^{\prime\prime}) is a solution to the PQE problem, it is implied by formula 𝐸𝑄FF′′\mathit{EQ}\wedge F^{\prime}\wedge F^{\prime\prime}. This means that for any consistent assignments (𝒙,𝒚,z)({\mbox{\boldmath$x^{\prime}$}},{\mbox{\boldmath$y^{\prime}$}},z^{\prime}) and (𝒙′′,𝒚′′,z′′)({\mbox{\boldmath$x^{\prime\prime}$}},{\mbox{\boldmath$y^{\prime\prime}$}},z^{\prime\prime}) to NN^{\prime} and N′′N^{\prime\prime} such that 𝒙x^{\prime}=𝒙′′x^{\prime\prime} the values of zz^{\prime} and z′′z^{\prime\prime} are equal to each other. Thus NN^{\prime} and N′′N^{\prime\prime} are functionally equivalent. If the second condition holds i.e. NN^{\prime} and N′′N^{\prime\prime} are identical constants, then N,N′′N^{\prime},N^{\prime\prime} are obviously equivalent.

The only if part. Assume that NN^{\prime} and N′′N^{\prime\prime} are functionally equivalent. We need to prove that one of the conditions above holds. Assume the contrary i.e. that H(0,1)=H(1,0)=0H(0,1)=H(1,0)=0 does not hold and NN^{\prime}, N′′N^{\prime\prime} are not identical constants.

Let us assume, for the sake of clarity, that H(0,1)=1H(0,1)=1. (The case when H(1,0)=1H(1,0)=1 can be considered in a similar manner.) This means that formula HH does not contain a clause C(z,z′′)C(z^{\prime},z^{\prime\prime}) falsified by an assignment z=0,z′′=1z^{\prime}=0,z^{\prime\prime}=1. Let us consider the following two reasons for that.

First, CC is not implied by 𝐸𝑄FF′′\mathit{EQ}\wedge F^{\prime}\wedge F^{\prime\prime}. This means that there is an assignment 𝒙x^{\prime}=𝒙′′x^{\prime\prime} to NN^{\prime} and N′′N^{\prime\prime} for which NN^{\prime} evaluates to 0 and N′′N^{\prime\prime} evaluates to 1. Hence NN^{\prime} and N′′N^{\prime\prime} are inequivalent and we have a contradiction.

Second, CC is implied by both 𝐸𝑄FF′′\mathit{EQ}\wedge F^{\prime}\wedge F^{\prime\prime} and FF′′F^{\prime}\wedge F^{\prime\prime} and one does not need to add clause CC to make formula 𝐸𝑄\mathit{EQ} redundant. Since FF^{\prime} and F′′F^{\prime\prime} do not share variables, the fact that FF′′F^{\prime}\wedge F^{\prime\prime} implies CC means that the circuit MM does not produce output z=0,z′′=1z^{\prime}=0,z^{\prime\prime}=1 even when inputs of MM are not constrained by EQEQ. This is possible only if at least one of the circuits NN^{\prime},N′′N^{\prime\prime} is a constant. Let us consider the following three cases.

  • NN^{\prime} and N′′N^{\prime\prime} are identical constants. Contradiction.

  • NN^{\prime} is a constant 1 and N′′N^{\prime\prime} is either a constant 0 or a non-constant circuit. Hence NN′′N^{\prime}\not\equiv N^{\prime\prime} . Contradiction.

  • N′′N^{\prime\prime} is a constant 0 and NN^{\prime} is either a constant 1 or a non-constant circuit. So NN′′N^{\prime}\not\equiv N^{\prime\prime}. Contradiction.

IV-B Equivalence checking by regular SAT-solving and CRR

In this subsection, we compare equivalence checking by a SAT-solver with Conflict Driven Clause Learning (CDCL) and by CRR.

Refer to caption
Figure 3: Equivalence checking by cut advancement

The equivalence checking of circuits N(X,Y,z)N^{\prime}(X^{\prime},Y^{\prime},z^{\prime}) and N′′(X′′,Y′′,z′′)N^{\prime\prime}(X^{\prime\prime},Y^{\prime\prime},z^{\prime\prime}) can be performed by checking the satisfiability of formula FF equal to F(X,Y,z)F′′(X,Y′′,z′′)(zz′′)F^{\prime}(X,Y^{\prime},z^{\prime})\wedge F^{\prime\prime}(X,Y^{\prime\prime},z^{\prime\prime})\wedge(z^{\prime}\neq z^{\prime\prime}). Indeed, the existence of an assignment 𝒙,𝒚,𝒚′′,z,z′′{\mbox{\boldmath$x$}},{\mbox{\boldmath$y^{\prime}$}},{\mbox{\boldmath$y^{\prime\prime}$}},z^{\prime},z^{\prime\prime} satisfying FF means that NN^{\prime} and N′′N^{\prime\prime} produce different output values for the same input 𝒙x. We will refer to the method of equivalence checking by a SAT solver based on CDCL solver as EC_CDCL. Here EC stands for Equivalence Checking.

Proposition 1 justifies the following method of equivalence checking by CRR. We will refer to this method as EC_CRR. This method solves the PQE problem specified by formula FF equal to W[𝐸𝑄(X,X′′)F(X,Y,z)F′′(X′′,Y′′,z′′)]\exists{W}[\mbox{$\mathit{EQ}(X^{\prime},X^{\prime\prime})$}\wedge F^{\prime}(X^{\prime},Y^{\prime},z^{\prime})\wedge F^{\prime\prime}(X^{\prime\prime},Y^{\prime\prime},z^{\prime\prime})] where W=XX′′YY′′W=X^{\prime}\cup X^{\prime\prime}\cup Y^{\prime}\cup Y^{\prime\prime}. Namely, EC_CRR computes formula H(z,z′′)H(z^{\prime},z^{\prime\prime}) obtained by taking 𝐸𝑄\mathit{EQ} out of the scope of quantifiers in W[EQFF′′]\exists{W}[EQ\wedge F^{\prime}\wedge F^{\prime\prime}]. If H(0,1)=H(1,0)=0H(0,1)=H(1,0)=0, then NN^{\prime} and N′′N^{\prime\prime} are equivalent. Otherwise, one needs to check if NN^{\prime} and N′′N^{\prime\prime} are identical constants. If so, then NN^{\prime} and N′′N^{\prime\prime} are equivalent, otherwise they are not. Theoretically, proving NN^{\prime} and N′′N^{\prime\prime} inequivalent does not require generation of a counterexample. The very fact that H(0,1)=1H(0,1)=1 or H(1,0)=1H(1,0)=1 and N,N′′N^{\prime},N^{\prime\prime} are not constants guarantees that NN^{\prime} and N′′N^{\prime\prime} are not equivalent. However, in a practical implementation of EC_CRR, a counterexample may be generated before computation of formula HH is completed.

To distinguish the formulas FF solved by EC_CDCL and EC_CRR, we will refer to them as F𝑐𝑑𝑐𝑙F^{\mathit{cdcl}} and F𝑐𝑟𝑟F^{\mathit{crr}} respectively. The SAT problem can be viewed as a special case of QE where all variables of the formula are existentially quantified. Since EC_CRR  is actually a PQE algorithm, one can compare EC_CRR  and EC_CDCL  in terms of computing clause redundancy as we did Subsection III-C. In those terms, the objective of deriving an empty clause by a SAT-solver is to make redundant all clauses with quantified variables (i.e. all clauses containing literals). So the difference between EC_CDCL  and EC_CRR  is that the former is aimed at making redundant all clauses of F𝑐𝑑𝑐𝑙F^{\mathit{cdcl}} while the goal of the latter is to make redundant only a small subset of clauses of F𝑐𝑟𝑟F^{\mathit{crr}} (namely those of 𝐸𝑄\mathit{EQ}).

The fact that EC_CRR  needs to prove redundancy of a smaller set of clauses than EC_CDCL  does not necessarily imply greater efficiency of EC_CRR. What matters, though, is that solving the PQE problem specified by F𝑐𝑟𝑟F^{\mathit{crr}} facilitates generation of proofs based on the cut advancement strategy shown in Figure 3. Such proofs are natural for structurally similar circuits. Here is a naive version of how this works. To make clauses of 𝐸𝑄\mathit{EQ} redundant one just needs to produce new clauses obtained by resolving 𝐸𝑄\mathit{EQ} with those of FF′′F^{\prime}\wedge F^{\prime\prime}. Note that a PQE solver has to make redundant a new resolvent (depending on a quantified variable) only if it is a descendant of a clause from 𝐸𝑄\mathit{EQ}. In general, such a clause will contain variables of both FF^{\prime} and F′′F^{\prime\prime} relating variables of NN^{\prime} and N′′N^{\prime\prime}. The set G1G_{1} of new resolvents that made the clauses of 𝑄𝐸\mathit{QE} redundant specify a new “cut” that consists of the variables present in G1G_{1}. After that a set G2G_{2} of descendants of G1G_{1} that make the clauses of G1G_{1} redundant is built. This goes on until the cut consisting of variables zz^{\prime} and z′′z^{\prime\prime} is reached.

A cut advancement strategy has been successfully used by industrial equivalence checkers. However, it is applied only when NN^{\prime} and N′′N^{\prime\prime} are so structurally similar that one can build a cut consisting of internal points of NN^{\prime} and N′′N^{\prime\prime} that are functionally equivalent. So this version of cut advancement is very limited. On the other hand, EC_CRR can arguably extend the cut advancement strategy to a much more general class of equivalence checking problems.

V Two Ways To Handle Complexity Of Range Computation

Function verification of a combinational circuit N(X,Y,Z)N(X,Y,Z) comes down to checking if there is an input for which NN produces an erroneous output. We assume that the erroneous outputs are specified by the user as a set EE. A straightforward way to verify NN is to find the range of NN and check if it overlaps with EE. As we mentioned in Subsection III-B, finding the range of NN comes down to solving the QE problem. Although, in general, the latter is very hard, in some cases, it can be efficiently solved for real-life circuits. For example, if NN is a single-output circuit, computing its range comes down to Circuit-SAT that, in many practical cases, can be solved by state-of-the-art SAT-solvers. In Sections V and VI, we assume that functional verification of NN is too hard for a SAT-solver.

In this section, we consider two methods for reducing the complexity of computing range of NN. One method is to compute range of NN for a subset of inputs. This method is used in traditional simulation. We introduce another method based on the following idea: compute range reduction caused by excluding some inputs of NN rather than the entire range.

V-A Simulation as range computation111 Traditionally, given a combinational circuit N(X,Y,Z)N(X,Y,Z), simulation is a deterministic procedure for computing the output 𝒛z produced by NN when an input 𝒙x is applied. Unfortunately, this procedure does not have a trivial extension to the case when two or more inputs are applied at once. For that reason, we use a semantic notion of simulation as a computation of the range of NN for a subset of inputs, omitting a detailed description of this computation.

Let F(X,Y,Z)F(X,Y,Z) be a CNF formula specifying circuit NN. Computing the range of NN comes down to finding formula H(Z)H(Z) logically equivalent to W[F]\exists{W}[F] where W=XYW=X\cup Y. Simulation can be viewed as a way to decrease the complexity of finding H(Z)H(Z) by shrinking the set of allowed inputs to only one. Let S(X)S(X) be a CNF formula satisfied by only one input 𝒙x. Then computing the output produced by NN comes down to solving the QE problem W[SF]\exists{W}[S\wedge F]. Formula SS can be represented as a set of |X||X| unit clauses satisfied only by 𝒙x. (A clause is called unit if it contains exactly one literal.) A solution H(Z)H(Z) for this QE problem can be represented as a set of |Z||Z| unit clauses satisfied only by the output of NN for input 𝒙x.

An obvious flaw of traditional simulation is that it provides information about the value of NN only for one input out of 2|X|2^{|X|}. One can address this issue by using formulas SS with many satisfying assignments, Then solving the QE problem specified by W[SF]\exists{W}[S\wedge F] finds the range of NN where all inputs satisfying SS are processed together. Unfortunately, the complexity of QE grows very fast as the number of inputs satisfying SS increases. One way to reduce the complexity of QE when SS allows many inputs is employed in symbolic simulation [2]. The idea is to pick formulas SS for which all inputs satisfying SS have the same execution trace.

V-B Simulation-by-exclusion

We described the main idea of simulation-by-exclusion in Subsection I-C. Given constraints excluding some inputs, compute only reduction of range of NN caused by this exclusion rather than the entire range of NN under allowed inputs. Here we continue explanation describing how simulation-by-exclusion is implemented by PQE. Let the complete assignments to XX falsifying CNF formula Q(X)Q(X) specify the inputs excluded from consideration. Let CNF formula Q(Z)Q^{*}(Z) be obtained by taking Q(X)Q(X) out of the scope of quantifiers in W[QF]\exists{W}[Q\wedge F] where W=XYW=X\cup Y. Then the outputs falsifying QQ^{*} specify the range reduction of NN due to exclusion of inputs falsifying QQ.

Suppose that no output falsifying QQ^{*} is in the set EE of erroneous outputs of NN. This implies that either NN is correct or there is an input 𝒙x producing an output from EE (a counterexample) that is not excluded i.e. 𝒙x satisfies QQ. This means that removing all inputs falsifying QQ from consideration is safe because it cannot remove all counterexamples (if any).

As we mentioned earlier, a PQE solver provides only an approximate solution to the CRR problem. This means that even if an output 𝒛z falsifying QQ^{*} is in EE, one still needs to check if 𝒛z is in the range of NN. A trivial way to do it is to check if formula C𝒛¯F\overline{\mbox{$C_{\boldsymbol{z}}$}}\wedge F is satisfiable where C𝒛C_{\boldsymbol{z}} is the longest clause falsified by 𝒛z. If so, clause C𝒛C_{\boldsymbol{z}} is not implied by FF and 𝒛z is in the range of NN.

Checking the satisfiability of C𝒛¯F\overline{\mbox{$C_{\boldsymbol{z}}$}}\wedge F may be expensive. However, in the algorithm of simulation-by-exclusion we introduce in Section VI, formula FF is constantly updated by adding clauses excluding inputs of NN. This may drastically simplify the SAT-check above. Besides, there are at least two techniques to make this SAT-check even simpler. The first technique is based on the fact that all inputs producing 𝒛z (if any) falsify QQ. So checking if 𝒛z is in the range of NN reduces to testing the satisfiability Q¯C𝒛¯F\overline{Q}\wedge\overline{\mbox{$C_{\boldsymbol{z}}$}}\wedge F.

The second technique is based on the following observation. Let RR be a resolution derivation of a clause CC of QQ^{*} falsified by 𝒛z. Then if 𝒛z is in the range of NN, every cut 𝐶𝑢𝑡(R)\mathit{Cut}(R) of proof RR has to include at least one clause AA that is implied by QFQ\wedge F but not FF. (We assume here that RR is a directed graph nodes of which correspond to original clauses of QFQ\wedge F or resolvents.) If every clause of 𝐶𝑢𝑡(R)\mathit{Cut}(R) is implied by FF then the clause CC derived by RR is implied by FF too and so 𝒛z is not in the range of NN. So to find out if 𝒛z is in the range of NN it is sufficient to check if formula A¯Q¯C𝒛¯F\overline{A}\wedge\overline{Q}\wedge\overline{\mbox{$C_{\boldsymbol{z}}$}}\wedge F is satisfiable for every clause AA of 𝐶𝑢𝑡(R)\mathit{Cut}(R). The longer clause AA is the simpler this SAT-check. If all such formulas are unsatisfiable for 𝐶𝑢𝑡(R)\mathit{Cut}(R) then 𝒛z is not in the range of NN. Otherwise, an input of NN producing 𝒛z can be extracted from an assignment satisfying formula A¯Q¯C𝒛¯F\overline{A}\wedge\overline{Q}\wedge\overline{\mbox{$C_{\boldsymbol{z}}$}}\wedge F.

V-C Simulation-by-exclusion versus regular simulation

In this subsection, term “regular simulation” refers to finding a solution H(Z)H(Z) to the QE problem specified by W[QF]\exists{W}[Q\wedge F] that we introduced in Subsection V-A (see also Footnote 1).

The main difference between regular simulation and simulation-by-exclusion is as follows. In regular simulation, to get a result one needs to perform a computation that goes all the way from inputs to outputs. If only one input 𝒙x is allowed by QQ, this computation produces an execution trace consisting of values assigned to variables of NN when applying input 𝒙x. On the other hand, simulation-by-exclusion can get a valuable result even by a local computation that does not reach the outputs of NN.

Refer to caption
Figure 4: An example illustrating simulation-by-exclusion

Let us consider the example of Figure 4 showing a circuit NN. Suppose that lines x1,x2x_{1},x_{2} feed only gates G1G_{1} and G2G_{2} and lines y1,y2y_{1},y_{2} feed only gate G3G_{3}. Note that the output of G3G_{3} specified by y3y_{3} implements function x1x2x_{1}\equiv x_{2} i.e. y3=1y_{3}=1 iff values of x1x_{1} and x2x_{2} are equal. Let CC denote clause x1x2x_{1}\vee x_{2}. It is not hard to show that CC is redundant in formula W[CF]\exists{W}[C\wedge F] i.e. W[CF]W[F]\mbox{$\exists{W}[C\wedge F]$}\equiv\mbox{$\exists{W}[F]$}. The redundancy of CC means that one can exclude the inputs falsifying CC (i.e. all the inputs for which x1=0,x2=0x_{1}=0,x_{2}=0) from consideration because such exclusion does not change the range of NN. Indeed, since x1,x2,y1,y2x_{1},x_{2},y_{1},y_{2} feed only gates G1,G2,G3G_{1},G_{2},G_{3}, circuit NN produces the same output for two inputs that are different only in the values of x1x_{1} and/or x2x_{2} if these inputs produce the same assignment to y3y_{3}. Since, even after excluding assignment x1=0,x2=0x_{1}=0,x_{2}=0, both values of y3y_{3} can still be produced, the set of outputs circuit NN can generate remains intact.

Importantly, the fact that clause CC can be safely used to exclude inputs of NN is derived locally without any knowledge of the rest of the circuit NN. Such a result cannot be reproduced efficiently by regular simulation. To exclude the inputs falsified by CC from consideration one would need to solve the QE problem specified by W[C¯F]\exists{W}[\overline{C}\wedge F]. The complexity of such QE can be very high if the size of circuit NN is large. Of course, if regular simulation succeeds in performing QE, it might find a bug. However, if no bug is found, the result is the same as for simulation-by-exclusion: the inputs falsifying CC can be excluded. However the price of this result in regular simulation can be dramatically higher than in simulation-by-exclusion.

VI A Few Algorithms Implementing Simulation-By-Exclusion

In this section, we describe a few algorithms implementing simulation-by-exclusion. The basic algorithm is shown in Figure 5 and described in Subsections VI-A and VI-B. Two modifications of this algorithm are given in Subsection VI-C. For the sake of clarity, we will assume that one needs to verify a single-output circuit NN. We will assume that if NN is correct it always evaluates to 0. An input for which NN evaluates to 1 is a counterexample showing that NN is buggy. The extension of algorithms of this section to multi-output circuits is straightforward.

VI-A Algorithm description

The algorithm of simulation-by-exclusion called SimByExl consists of three parts separated in Figure 5 by the dotted lines. In the first part (lines 1-6), an input 𝒙^\hat{x} is generated for which NN evaluates to 0 (lines 2-4). This input is never excluded and serves two purposes. First, it guarantees that NN is not a constant 1. Second, keeping 𝒙^\hat{x} allowed prevents SimByExcl  from excluding all inputs for which NN evaluates to 0. SimByExcl also builds formula FF specifying NN (line 1) and generates C𝒙^C_{\boldsymbol{\hat{x}}}, the longest clause falsified by 𝒙^\hat{x} (line 5). Finally, SimByExcl initializes formula GG that accumulates the clauses excluding inputs of NN (line 6).

The second part of SimByExcl  (lines 7-14) consists of a while loop. In every iteration of this loop, a new clause C(X)C(X) is generated (line 10). Clause CC excludes at least one new input 𝒙x of NN constructed as an assignment satisfying formula GC𝒙^G\wedge\mbox{$C_{\boldsymbol{\hat{x}}}$} (line 8). If SimByExcl fails to find such 𝒙x, all inputs of NN but 𝒙^\hat{x} have been excluded. Then NN is correct since, for the excluded inputs, it takes the same value as for 𝒙^\hat{x} i.e. 0.

// N(X,Y,z)N(X,Y,z) is a single-output circuit
// XX is the set of input variables
// YY is the set of internal variables
// zz specifies the output variable
// 𝑆𝑖𝑚𝐵𝑦𝐸𝑥𝑐𝑙\mathit{SimByExcl} returns a counterexample
//      or nil if no counterexample exists
//
𝑆𝑖𝑚𝐵𝑦𝐸𝑥𝑐𝑙(N)\mathit{SimByExcl}(N){
1 F(X,Y,z):=𝐺𝑒𝑛𝐶𝑛𝑓𝐹𝑜𝑟𝑚(N)F(X,Y,z):=\mathit{GenCnfForm}(N);
2 𝒙^:=𝐺𝑒𝑛𝐼𝑛𝑝(X){\mbox{\boldmath$\hat{x}$}}:=\mathit{GenInp}(X);
3 𝑣𝑎𝑙(z):=𝑆𝑖𝑚𝑢𝑙𝑎𝑡𝑒(N,𝒙^);\mathit{val}(z):=\mathit{Simulate}(N,{\mbox{\boldmath$\hat{x}$}});
4 if (𝑣𝑎𝑙(z)=1\mathit{val}(z)=1) return(𝒙^\hat{x});
5 C𝒙^:=𝐿𝑜𝑛𝑔𝑒𝑠𝑡𝐹𝑎𝑙𝑠𝑖𝑓𝐶𝑙𝑎𝑢𝑠𝑒(𝒙^)\mbox{$C_{\boldsymbol{\hat{x}}}$}:=\mathit{LongestFalsifClause}({\mbox{\boldmath$\hat{x}$}});
6 G:=G:=\emptyset;
----------------
7 while (true) {
8 𝒙:=𝐹𝑖𝑛𝑑𝑆𝑎𝑡𝐴𝑠𝑠𝑔𝑛(GC𝒙^){\mbox{\boldmath$x$}}:=\mathit{FindSatAssgn}(G\wedge\mbox{$C_{\boldsymbol{\hat{x}}}$});
9 if (𝒙=𝑛𝑖𝑙{\mbox{\boldmath$x$}}=\mathit{nil}) return(𝑛𝑖𝑙\mathit{nil});
10 C:=𝐺𝑒𝑛𝐹𝑎𝑙𝑠𝑖𝑓𝐶𝑙𝑎𝑢𝑠𝑒(𝒙,𝒙^)C:=\mathit{GenFalsifClause}({\mbox{\boldmath$x$}},{\mbox{\boldmath$\hat{x}$}});
11 C:=𝑆𝑜𝑙𝑣𝑒𝑃𝑄𝐸(W[CF])C^{*}:=\mathit{SolvePQE}(\mbox{$\exists{W}[C\wedge F]$}); // W=XYW=X\cup Y
12 if (C=z¯C^{*}=\overline{z}) break;
13 F:=FCF:=F\wedge C;
14 G:=GCG:=G\wedge C; }
----------------
15 if ((C¯Fz)𝑓𝑎𝑙𝑠𝑒)((\overline{C}\wedge F\wedge z)\equiv\mathit{false}) return(𝑛𝑖𝑙\mathit{nil});
16 (𝒙,𝒚,z):=𝑆𝑎𝑡𝐴𝑠𝑠𝑔𝑛(C¯Fz)({\mbox{\boldmath$x$}},{\mbox{\boldmath$y$}},z):=\mathit{SatAssgn}(\overline{C}\wedge F\wedge z);
17 return(𝒙x); }
Figure 5: The basic algorithm of simulation-by-exclusion

After generating clause CC, SimByExcl computes CNF formula C(z)C^{*}(z) (line 11). It is obtained by taking CC out of the scope of quantifiers in W[CF]\exists{W}[C\wedge F] where W=XYW=X\cup Y. Formula CC^{*} can only consist of clause z¯\overline{z} or be empty (no clauses) in which case CC^{*} is always true. Note that formula CC^{*} cannot consist of unit clause zz because SimByExcl never excludes all inputs for which NN evaluates to 0. Hence clause zz is not implied by CFC\wedge F. If CC^{*} is empty, then the inputs falsifying CC can be safely excluded from consideration. So clause CC is added to FF (line 13) and to GG (line 14).

If CC^{*} is not empty and hence equal to z¯\overline{z}, SimByExcl breaks the loop (line 12) and executes the third part of the algorithm (lines 15-17). In this part, SimByExcl checks whether the derived clause z¯\overline{z} is pure noise or CC excludes a counterexample. If no counterexample is excluded by CC, then clause z¯\overline{z} is just noise, i.e. Fz¯F\rightarrow\overline{z} and so NN is correct. Otherwise, SimByExcl extracts a counterexample from an assignment satisfying C¯Fz\overline{C}\wedge F\wedge z.

Note that one can just check whether NN is constant 0 by running the SAT-check on FzF\wedge z where FF is the original formula specifying NN. SAT-checking of FzC¯F\wedge z\wedge\overline{C} can be much simpler for the following two reasons. First, FF is constantly updated by SimByExcl  by adding clauses excluding inputs. As we explain in Subsection VI-C such clauses are obtained by non-resolution derivation and so are very valuable for a resolution-based SAT-solver. Second, the negation of clause CC consists of unit clauses that can additionally simplify the SAT-check. One more way to simplify this SAT-check that we described in Subsection V-B is to exploit the resolution derivation of clause z¯\overline{z}. For the sake of simplicity this possibility is not mentioned in Figure 5.

VI-B Completeness and soundness of SimByExcl

SimByExcl produces an answer for every circuit NN and so it is complete. Indeed, in every iteration of the while loop, SimByExcl excludes at least one new input of NN that has not been excluded so far. So the set of allowed inputs monotonically decreases. Eventually, SimByExcl either excludes all inputs but 𝒙^\hat{x} or derives a clause z¯\overline{z}. In either case, SimByExcl terminates returning a result.

SimByExcl is sound. It reports that NN is correct in two cases. First, when a clause z¯\overline{z} is generated and SimByExcl proves that Fz¯F\rightarrow\overline{z}. Then FzF\wedge z is unsatisfiable and hence no counterexample exists. Second, SimByExcl reports that NN is correct when all inputs of NN but 𝒙^\hat{x} are excluded by added clauses. Since SimByExcl  guarantees that a new clause cannot remove all counterexamples and NN evaluates to 0 at 𝒙^\hat{x}, this means that NN evaluates to 0 for all inputs. SimByExcl reports that NN is buggy when an assignment satisfying FzF\wedge z is found. This assignment specifies an input for which NN evaluates to 1.

VI-C Two modifications of the algorithm

In this subsection, we consider two modifications of SimByExcl  that can be used to improve its efficiency. The first modification is given in Figure 6. The high-lighted part shows the lines added to the code of SimByExcl of Figure 5.

𝑆𝑖𝑚𝐵𝑦𝐸𝑥𝑐𝑙(N)\mathit{SimByExcl}(N){
~~~~~\ldots
6 G:=G:=\emptyset;
6.1 𝑁𝑢𝑚𝑁𝑒𝑤𝐶𝑙𝑎𝑢𝑠𝑒𝑠:=0\mathit{NumNewClauses:=0};
7 while (true) {
~~~~~\ldots
12 if (C=z¯C^{*}=\overline{z}) break;
13 F:=FCF:=F\wedge C;
14 G:=GCG:=G\wedge C;
14.1 𝑁𝑢𝑚𝑁𝑒𝑤𝐶𝑙𝑎𝑢𝑠𝑒𝑠:=𝑁𝑢𝑚𝑁𝑒𝑤𝐶𝑙𝑎𝑢𝑠𝑒𝑠+1\mathit{NumNewClauses}:=\mathit{NumNewClauses}+1;
14.2 if (𝑁𝑢𝑚𝑁𝑒𝑤𝐶𝑙𝑎𝑢𝑠𝑒𝑠>#threshold)(\mathit{NumNewClauses}>\#threshold) {
14.3 𝑁𝑢𝑚𝑁𝑒𝑤𝐶𝑙𝑎𝑢𝑠𝑒𝑠:=\mathit{NumNewClauses}:=\emptyset;
14.4 𝑎𝑛𝑠𝑤𝑒𝑟:=𝑆𝑎𝑡𝐶ℎ𝑒𝑐𝑘(Fz,#𝑏𝑎𝑐𝑘𝑡𝑟𝑎𝑐𝑘𝑠)\mathit{answer}:=\mathit{SatCheck}(F\wedge z,\#\mathit{backtracks});
14.5 if (𝑎𝑛𝑠𝑤𝑒𝑟𝑢𝑛𝑓𝑖𝑛𝑖𝑠ℎ𝑒𝑑\mathit{answer}\neq\mathit{unfinished}) return(𝑎𝑛𝑠𝑤𝑒𝑟\mathit{answer});}}
~~~~~\ldots
Figure 6: Modification of the algorithm shown in Figure 5

The main idea here is to occasionally run a light SAT-check on formula FzF\wedge z. We assume that the effort of the SAT-solver is limited by some parameter specifying e.g. the maximum number of backtracks. Such a SAT-check is invoked when the number of new clauses added to FF exceeds a threshold. Such a strategy makes sense because clauses added to FF by SimByExcl are not derived by resolution. Deriving such clauses by resolution may be dramatically more complex, which makes them quite valuable for a resolution based SAT-solver.

Consider for instance, derivation of clause C=x1x2C=x_{1}\vee x_{2} for circuit NN shown in Figure 4 (see discussion of Subsection V-C). Assume that circuit NN has only one output specified by variable zz. Suppose that formula FzF\wedge z is satisfiable (i.e. NN is buggy) and CC excludes at least one counterexample. Then CC is not even implied by FzF\wedge z and thus cannot be derived by resolution. However, even if CC is implied by FzF\wedge z, its resolution derivation may be very hard and involve many clauses of FF. On the other hand, a PQE-solver is capable of concluding that CC can be safely added to FF just by examining the clauses specifying gates G1G_{1},G2G_{2},G3G_{3} and using the fact that variables x1,x2,y1,y2x_{1},x_{2},y_{1},y_{2} do not feed any other gates.

𝑆𝑖𝑚𝐵𝑦𝐸𝑥𝑐𝑙(N)\mathit{SimByExcl}(N){
~~~~~\ldots
6 G:=G:=\emptyset;
6.1 𝑁𝑢𝑚𝑁𝑒𝑤𝐶𝑙𝑎𝑢𝑠𝑒𝑠:=0\mathit{NumNewClauses:=0};
7 while (true) {
~~~~~\ldots
12 if (C=z¯C^{*}=\overline{z}) break;
13 F:=FCF:=F\wedge C;
14 G:=GCG:=G\wedge C;
14.1 𝑁𝑢𝑚𝑁𝑒𝑤𝐶𝑙𝑎𝑢𝑠𝑒𝑠:=𝑁𝑢𝑚𝑁𝑒𝑤𝐶𝑙𝑎𝑢𝑠𝑒𝑠+1\mathit{NumNewClauses}:=\mathit{NumNewClauses}+1;
14.2 if (𝑁𝑢𝑚𝑁𝑒𝑤𝐶𝑙𝑎𝑢𝑠𝑒𝑠>#threshold)(\mathit{NumNewClauses}>\#threshold) {
14.3 𝑁𝑢𝑚𝑁𝑒𝑤𝐶𝑙𝑎𝑢𝑠𝑒𝑠:=\mathit{NumNewClauses}:=\emptyset;
14.4 𝐶𝑒𝑥:=𝑅𝑢𝑛𝑆𝑖𝑚(N,G,#tries)\mathit{Cex}:=\mathit{RunSim}(N,G,\#tries);
14.5 if (𝐶𝑒𝑥𝑛𝑖𝑙\mathit{Cex}\neq\mathit{nil}) return(𝐶𝑒𝑥\mathit{Cex});}}
~~~~~\ldots
Figure 7: Another modification of the algorithm of Figure 5

The second modification is shown in Figure 7. In this modification one occasionally runs regular simulation. We assume that only tests that have not been excluded yet are generated. These are the tests satisfying formula GG. A simulation run is performed when the number of new clauses added to GG exceeds a threshold. We assume that the number of tests generated in a simulation run is limited by parameter #tries. Performing occasional simulation runs makes sense because adding new clauses reduces the search space and hence increases the probability of generating a counterexample.

VII Background

The existing methods for checking equivalence of combinational circuits NN^{\prime} and N′′N^{\prime\prime} can be roughly partitioned into two groups. The first group consists of methods that do not try to exploit the structural similarity of NN^{\prime} and N′′N^{\prime\prime}. An example of an equivalence checker of this group is an algorithm that builds separate BDDs [1] of NN^{\prime} and N′′N^{\prime\prime} and then checks that these BDDs are identical. One more example, is an equivalence checker constructing a CNF formula that is satisfiable only if NN^{\prime} and NN” are not equivalent. (In Subsection IV-B we explained how such a formula is generated.) This equivalence checker runs a SAT-solver [10, 11] to test the satisfiability of this formula. Unfortunately, the algorithms of this group do not scale well with the size of N,N′′N^{\prime},N^{\prime\prime}.

Methods of the other group try to take into account the similarity of N,N′′N^{\prime},N^{\prime\prime} [9, 7]. These methods work well even for quite large circuits N,N′′N^{\prime},N^{\prime\prime} if they are very similar structurally. A flaw of such methods is that they do not scale well as N,N′′N^{\prime},N^{\prime\prime} become more dissimilar. As we mentioned earlier, the method based on CRR that we introduced in this paper can be arguably used to design an equivalence checker that take the best of both worlds. That is it scales better than the methods of the first group in terms of circuit size and improves on the scalability of the methods of the second group in terms of circuit dissimilarity.

Simulation is still the main workhorse of verification. So a lot of research has been done to improve its efficiency and effectiveness. For example, symbolic simulation [2] is used to run many tests at once. Constrained random simulation generates tests aimed at achieving a particular goal e.g. better coverage with respect to a metric [8]. However, all these methods are based on the paradigm of decreasing the complexity of range computation by reducing the number of inputs to be considered at once. To the best of our knowledge none of existing methods exploits the idea of computing range reduction introduced in [5]. There we explored this idea in the context of model checking. In the current paper, we contrast simulation based on computing range reduction with traditional simulation.

VIII Conclusions

We described new methods of equivalence checking and simulation based on Computing Range Reduction (CRR). Our interest in these methods is twofold. First, they allow one to take into account subtle structural properties of the design. For instance, equivalence checking based on CRR allows can employ a “cut advancement” strategy. A limited version of this strategy has been very successful in equivalence checking of industrial designs. Second, one can argue that CRR can be efficiently performed using a technique called partial quantifier elimination that we are working on.

Acknowledgment

This research was supported in part by NSF grants CCF-1117184 and CCF-1319580.

References

  • [1] R. Bryant. Graph-based algorithms for Boolean function manipulation. IEEE Transactions on Computers, C-35(8):677–691, August 1986.
  • [2] R. Bryant. Symbolic simulation—techniques and applications. In DAC-90, pages 517–521, 1990.
  • [3] E.Goldberg and P.Manolios. Quantifier elimination by dependency sequents. In FMCAD-12, pages 34–44, 2012.
  • [4] E.Goldberg and P.Manolios. Quantifier elimination via clause redundancy. In FMCAD-13, pages 85–92, 2013.
  • [5] E.Goldberg and P.Manolios. Bug hunting by computing range reduction. Technical Report arXiv:1408.7039 [cs.LO], 2014.
  • [6] E. Goldberg and P. Manolios. Partial quantifier elimination. In Proc. of HVC-14, pages 148–164. Springer-Verlag, 2014.
  • [7] E. Goldberg, M. Prasad, and R. Brayton. Using SAT for combinational equivalence checking. In DATE, pages 114–121, 2001.
  • [8] O. Guzey and L.C. Wang. Coverage-directed test generation through automatic constraint extraction. In HLDVT.
  • [9] A. Kuehlmann and F. Krohm. Equivalence Checking Using Cuts And Heaps. DAC, pages 263–268, 1997.
  • [10] J. Marques-Silva and K. Sakallah. Grasp – a new search algorithm for satisfiability. In ICCAD-96, pages 220–227, 1996.
  • [11] M. Moskewicz, C. Madigan, Y. Zhao, L. Zhang, and S. Malik. Chaff: engineering an efficient sat solver. In DAC-01, pages 530–535, New York, NY, USA, 2001.