# Patent

## Title
Systems, methods, and apparatus to perform logic synthesis preserving high-level specification

## Abstract

A method and an apparatus to perform logic synthesis preserving high-level specification and to check that a common specification (CS) of two circuits is correct have been disclosed. In one embodiment, the method includes building a circuit N2 that preserves a predefined specification of a circuit N1. In some embodiments, the method includes verifying that N2 and N1 indeed implement the same specification and so they are functionally equivalent.

## Background
FIELD OF INVENTION 
The present invention relates to logic synthesis and verification, and more particularly, to performing logic synthesis preserving high-level specification and verifying that two circuits implement the same specification.
BACKGROUND
In electronic design automation processes, logic synthesis generally refers to the conversion of a high-level specification of a circuit design into a gate-level netlist, which typically describes the components to be used to implement the design and the connections between these components. One example of a high-level specification of the circuit design is a description of the functionality of the design in the register transfer level (RTL), such as description of how data is moved between registers and memory, how data is manipulated (e.g., by adding, by comparing, etc.), where data is stored (e.g., in some registers or memory locations), etc. In general, the RTL description may be written in a hardware description language (HDL). The HDL may handle several levels of abstraction, such as behavioral level, register transfer level, and gate levels. One example of the HDL is Verilog.
The netlist generated by logic synthesis may be written in various formats, such as in graphical format or in textual format, to represent the circuit that implements the high-level specification. Some conventional synthesis tools further optimize different portions of a design for a variety of attributes, such as area, speed, etc. For example, one conventional logic synthesis tool may optimize a portion of a design for area by using the smallest amount of area on a silicon chip while another conventional synthesis tool may optimize a portion of a design for speed by adding or removing some logic gates in the netlist. As a result, multiple netlists to achieve the same functionality described by the high-level specification may be generated for different kinds of optimization.
Furthermore, as new technologies in electronic device processing areb being developed to build smaller, faster, and better integrated circuits, netlists of alternative implementations may be generated by logic synthesis based on different fabrication processing technologies. These alternative implementations of the design may take advantage of some or all of these new technologies. The netlists may use different combinations of logic gates, electronic components, wire, etc. to achieve the same functionality as described in the high-level specification.
To ensure the accuracy of the logic synthesis performed, there is a need to verify that the different netlists indeed achieve the same functionality as specified. In other words, it is desired to have an efficient and accurate methodology to verify that a logic synthesis tool indeed preserves the high-level specification in an alternative implementation of the design.
Currently, a sequential circuit is a network of combinational sub-circuits implementing some next-state functions. If a combinational sub-circuit is large enough, it usually can be further partitioned into smaller sub-circuits. It was shown in Equivalence checking of dissimilar circuits. E. Goldberg, Y. Novikov, International Workshop on Logic and Synthesis, May 28-30, 2003, USA that the knowledge of a high-level level structure of a circuit is crucial for efficient Equivalence Checking (EC). Namely, it was shown that if two combinational circuits N1,N2 have a Common Specification (CS), then there exists an efficient procedure for checking their equivalence.
A common specification S of N1 and N2 is typically defined as a circuit of multi-valued gates (which may also be referred to as blocks) such that N1 and N2 are different implementations of S. An example of a CS is given in FIG. 1. Circuits N1 1001 and N2 1002 have a 3-block CS 1000 shown on the left. Sub-circuits N1i, N2i (where i=1, 2, or 3) are different implementations of the multi-valued block, Gi of S. Circuit Nmi (m=1, 2) implements a multi-output Boolean function whose truth table is obtained from that of Gi by replacing values of multi-valued variables with their binary codes. So the difference between N1i and N2i is in the choice of binary encodings for the variables of S.
In general, equivalence checking of circuits N1, N2 with a common specification S is typically infeasible if the common specification S is unknown. However, if the common specification S is known, then there may exist an efficient procedure for performing the equivalence checking of circuits N1, N2. This equivalence checking procedure can be used to design a new class of logic synthesis procedures. In general, a logic synthesis procedure has to verify that the original circuit N1 and a changed circuit N2 are functionally equivalent, i.e., to verify the change made from circuits N1 to N2. The more powerful this verification procedure is, the richer set of synthesis transformations can be used. So any progress in equivalence checking entails introducing a new class of synthesis transformations.
SUMMARY
The present invention includes a method and an apparatus to perform logic synthesis preserving high-level specification and to check that a common specification (CS) of two circuits is correct. In one embodiment, the method includes building a circuit N2 that preserves a predefined specification of a circuit N1, and then verifying that N2 and N1 indeed implement the same specification and so they are functionally equivalent. However, the logic synthesis procedure preserving high-level specification and the verification procedure checking if two circuits have the same CS can be used separately.
In some embodiments, building the circuit N2 comprises deriving a plurality of sub-circuits, each of which is toggle equivalent to the corresponding sub-circuit of the circuit N1. In another embodiment, verifying that N1 and N2 have the same specification and hence are functionally equivalent comprises computing in topological order correlation functions relating the outputs of corresponding sub-circuits of N1 and N2.
Other features of the present invention will be apparent from the accompanying drawings and from the detailed description that follows.



BRIEF DESCRIPTION OF THE DRAWINGS
The present invention is illustrated by way of example and not limitation in the figures of the accompanying drawings, in which like reference indicate similar elements and in which:
FIG. 1 illustrates embodiments of circuits having an exemplary common specification of three blocks;
FIG. 2 illustrates a flow diagram of one embodiment of a process to perform logic synthesis;
FIG. 3 illustrates Definition 13;
FIGS. 4A and 4B illustrate an example of two circuits partitioned into toggle equivalent sub-circuits;
FIG. 5 illustrates a flow diagram of one embodiment of a process to verify a common specification of two given circuits;
FIG. 6 illustrates a flow diagram of one embodiment of a process to build a circuit preserving a predefined specification of a given circuit;
FIG. 7 illustrates an exemplary embodiment of a computing system usable with one embodiment of the present invention; and
FIG. 8 illustrates an exemplary embodiment of a logic synthesis tool usable with one embodiment of the present invention.



DETAILED DESCRIPTION 
A method and an apparatus to perform logic synthesis preserving high-level specification and to verify that two circuits implement the same high-level specification are described. In the following description, numerous specific details are set forth. However, it is understood that embodiments of the invention may be practiced without these specific details. In other instances, well-known components, structures, and techniques have not been shown in detail in order not to obscure the understanding of this description.
Reference in the patent description to “one embodiment” or “an embodiment” means that a particular feature, structure, or characteristic described in connection with the embodiment is included in at least one embodiment of the invention. The appearances of the phrase “in one embodiment” in various places in the patent description do not necessarily all refer to the same embodiment.
FIG. 2 shows a flow diagram of one embodiment of a process to perform logic synthesis and to check that the synthesized and initial circuits implement the same specification. The process is performed by processing logic that may comprise hardware (e.g., circuitry, dedicated logic, etc.), software (such as an EDA tool, operable to run on a general-purpose computer system or a dedicated machine), or a combination of both.
Initially, processing logic builds a circuit N2 implementing the same specification as initial circuit N1 (processing block 210). The specification of circuit N1 is represented as a partitioning of circuit N1 into sub-circuits. Then processing logic verifies that circuits N1 and N2 indeed implement the same specification, and hence, circuits N1 and N2 are functionally equivalent (processing block 220). Details of each of the processing blocks 210 and 220 are further discussed below with reference to FIGS. 5 and 6.
However, before going into the details of each of the processing blocks 210 and 220, an overview of the concept of Toggle Equivalence and the relation between toggle equivalence and the notion of CS is now discussed.
Toggle Equivalence of Boolean Functions
In this section, the notion of toggle equivalence is introduced. Toggle equivalent Boolean functions can be considered as different implementations of the same multi-valued function.
Toggle Equivalence of Functions with Identical Sets of Variables
Let f1:{0,1}n→{0,1}m and f2: {0,1}n→{0,1}k be m-output and k-output Boolean functions of the same set of variables. Functions f1 and f2 are toggle equivalent if f1(x)≠f1(x′)<=>f2(x)≠f2(x′). Circuits N1 and N2 implementing the toggle equivalent functions f1 and f2 are called toggle equivalent circuits. This is hereinafter referred to as Definition 1. In other words, the functions f1 and f2 are toggle equivalent if for any pair of input vectors x, x′ for which at least one output of f1 changes (toggles), the same is true for f2, and vice versa.
Let f be a multi-output Boolean function of n variables. The partition of the set {0,1}n (denoted by Part(f)) consists of the disjoint subsets B1, . . . , Bk, such that f(x)=f(x′) if and only if x, x′ are in the same subset Bi. This is hereinafter referred to as Definition 2.
If f1 and f2 are toggle equivalent, there cannot be a pair of vectors x, x′ such that x, x′ are in the same subset of one partition and in different subsets of the other partition. Since f1 and f2 are toggle equivalent it is generally impossible that one function produces two identical output assignments while the other function toggles. Consequently, if two Boolean functions f1 and f2 are toggle equivalent, then Part(f1)=Part(f2). (The equality of partitions means that for each element Bi of the partition Part(f1), there is an element B′j of the partition Part(f2) such that Bi=B′j and vice versa). Similarly, if Part(f1)=Part(f2), the f1, f2 are toggle equivalent. This proposition is hereinafter referred to as Proposition 1.
Let f1 and f2 be toggle equivalent single output Boolean functions. From Proposition 1, it follows that Part(f1)=Part(f2). Since f1, f2 are single output Boolean functions, Part(f1) and Part(f2) each includes two elements. So f1=f2 or f1= ̃f2, where “ ̃” means negation. This is hereinafter referred to as Proposition 2.
A multi-output Boolean function f is called an implementation of a multi-valued function F if the truth table of f can be obtained from that of F in the following two steps: (1) Replace the values of multi-valued variables of F with their codes (we assume that different values of a variable are assigned different codes); and (2) fill in the empty rows (if any) of the truth table with arbitrary Boolean vectors. There if hereinafter referred to as Definition 3.
Suppose f1 and f2 are toggle equivalent. According to Proposition 1, Part(f1)=Part(f2). Furthermore, suppose Part(f1), Part(f2) each includes k elements. Then f1 and f2 are implementations of the function F: {0,1}n→{1, . . . , k}, where F(x)=m, if and only if x is in the m-th element of the partition Part(f1). From Definition 3, it follows that f1 and f2 are two different implementations of the same multi-valued function of Boolean variables. This in hereinafter referred to as Proposition 3.
Proposition 3 is of great importance because it shows how one can reencode multi-valued variables implicitly. Suppose, a multi-output circuit N1 implements a multi-valued function F whose output is described by a multi-valued variable Y. Suppose one needs to reencode the values Y to get a better implementation of F. Proposition 3 shows that by synthesizing a circuit N2 that is toggle equivalent to N1, one can obtain a new implementation of F. That is the values of the variable Y are reencoded implicitly without even knowing the binary encodings used to encode the values of Y to obtain N1 and N2 from F.
Toggle Equivalence of Functions with Different Sets of Variables
In this subsection, the notion of toggle equivalence is extended to the case of Boolean functions with different sets of variables that are related by constraint functions.
Let X and Y be two disjoint sets of Boolean variables, where the number of variables in X and Y may be different. A Boolean function is denoted by Cf(X,Y} if this function satisfies the following two conditions: (1) There are no three vectors x, x′, y (where x, x′ are assignments to variables X and y is an assignment to variables Y) such that x≠x′ and Cf(x, y)=Cf(x′, y)=1; and (2) there are no three vectors x, y, y′ such that y≠y′ and Cf(x, y)=Cf(x, y′)=1. This is hereinafter referred to as Definition 4. The function Cf may be referred to as a correlation function.
A correlation function specifies a mapping between two different encodings of the same multi-valued variable. Suppose V={x1, . . . , xp} is the set of all assignments to the variable of X such that Cf(xi, y)=1 for some y. Let W={y1, . . . , ym} be the set of all assignments to variable of Y such that Cf(x, yi)=1 for some x. From the above definition of the correlation function, it follows that |W|=|V| (and so m=p) and there exists a natural bijective mapping between V and W that relates a vector xi of V and the vector yj of W for which Cf(xi, yj)=1. The vectors xi and yi can be considered as the codes of the same value of a p-valued variable. This is hereinafter referred to as Remark 1.
Furthermore, let Cf(X,Y) be a Boolean function and X,Y be two sets of Boolean variables. Checking if Cf is a correlation function may include two satisfiability checks. First, checking the condition (1) in the definition of Cf may include testing the satisfiability of the expression, Cf(X,Y)^Cf(X′,Y′)^Neq(X,X′)^Eq(Y,Y′). Here, Cf(X′,Y′) is a copy of Cf(X,Y), where variables of X′,Y′ are independent of those of X,Y. Neq(x, x′) is equal to 1 if and only if x≠x′. The function Eq(Y,Y′) is the negation of Neq(Y,Y′). Second, checking the condition (2) in the definition of Cf may include testing the satisfiability of Cf(X,Y)^Cf(X′,Y′)^Eq(X,X′)^Neq(Y,Y′). If both expressions are constant 0, then Cf is a correlation function. This is hereinafter referred to as Remark 2.
Let f1:{0,1}n→{0,1}m and f2:{0,1}p→{0,1}k be m-output and k-output Boolean functions and X, Y specify their sets of Boolean variables, where |X|=n and |Y|=p. Further suppose that Dinp(X,Y) is a Boolean function. The functions f1 and f2 are called toggle equivalent under the constraint function Dinp(X,Y) if (f1(x)≠f1(x′)^(Dinp(x,y)=Dinp(x′, y′)=1))=>(f2(y)≠f2(y′), and vice versa, i.e., (f2(y)≠f2(y′)^ (Dinp(x,y)=Dinp(x′, y′)=1))=>f1(x)≠f1(x′). This definition is hereinafter referred to as Definition 5.
Let X,Y be two sets of Boolean variables and {X1, . . . , Xs} and {Y1, . . . , Ys} be the partitions of X and Y, respectively. Let Cf(X1, Y1), . . . , Cf(Xs, Ys) be correlation functions. Suppose f1(X) and f2(Y) are toggle equivalent under the constraint function Dinp(X,Y)=Cf(X1,Y1)^ . . . ^Cf(Xs,Ys). As discussed above (see Proposition 3), the two toggle equivalent functions, f1 and f2, are two different implementations of the same multi-valued function of Boolean variables. Furthermore, taking into account of Remark 1 above, it follows that f1 and f2 are implementations of the same multi-valued function of s multi-valued variables. This proposition is hereinafter referred to as Proposition 4.
Testing Toggle Equivalence
Suppose N is a Boolean circuit. The set denoted by v(N) consists of the Boolean variables each of which is associated with either the output of a gate or a primary input of N. The Boolean function denoted by Sat(v(N)) satisfies the condition that Sat(z)=1 if and only if the assignment z to the variables v(N) is possible, i.e., consistent. For example, if circuit N consists of just one AND gate described by y=x1^x2, then v(N)={y, x1, x2} and Sat(v(N))=( ̃x1 ̃x2y)^(x1 ̃y)^(x2 ̃y). This is hereinafter referred to as Definition 6.
Furthermore, suppose f is a Boolean function. The function f* is obtained from f by existentially quantifying away the variable x if f*=f( . . . , x=0, . . . )f( . . . , x=1, . . . ). This is hereinafter referred to as Definition 7.
Let N1 and N2 be Boolean circuits whose inputs are specified by sets of variables X and Y respectivley. Let Dinp(X,Y) be a constraint Boolean function that is also a correlation function. A Boolean function is denoted by Dout(N1,N2) if it is obtained from the function H, where H=Sat(v(N1))^Sat(v(N2))^Dinp(X,Y), by existentailly quantifying away all the variables of H but the output variables of N1 and N2. This is hereinafter referred to as Definition 8.
Let N1 and N2 be circuits that are toggle equivalent under a constraint Boolean function Dinp(X,Y) that is also a correlation function. Let Dout(N1, N2) be the function obtained from H=Sat(v(N1))^Sat(v(N2))^Dinp(X,Y) as described in Definition 8 above. Then Dout(N1,N2) satisfies either condition of Definition 4 and hence it is a correlation function. For example, there cannot exist Boolean vectors z, z′ and h (where z≠z′ and z, z′ are output assignments of N1 and h is an output assignment of N2) such that Dout(z,h)=Dout(z′,h)=1. Indeed, it would mean that there exist pairs of vectors x, y and x′, y′ such that a) z=N1(x), z′=N2(x′) and h=N2(y)=N2(y′);b) Dinp(x, y)=1 and Dinp(x′,y′)=1; c) x≠x′ and y≠y′; d) N1(x)≠N1(x′) while N2(y)=N2(y′). But this is impossible since N1 and N2 are toggle equivalent. In the same way, it can be shown that if one replaces the assumption that N1 and N2 are toggle equivalent with the assumption that Dout is a correlation function, then N1 and N2 can be proven to be toggle equivalent. In other words, circuits N1, N2 whose inputs are constrained by a correlation function Dout(N1, N2) are toggle equivalent if and only if the function Dout(N1, N2) is a correlation function. This is hereinafter referred to as Proposition 5.
Common Specification and Toggle Equivalence
The existence of a CS for the combinational circuits N1 and N2 implies that N1, N2 can be partitioned into toggle equivalent sub-circuits that are coupled in N1 and N2 in the same way. Although the technique described in the current document is illustrated with a specification of a circuit N that is represented as a partition, one should appreciate that the technique may also be applied to specifications that are represented as coverings. The difference between a partition and a covering is that in the case of a partition, a logic gate may be included in only one of the sub-circuits, whereas in the case of a covering, a logic gate may be shared by more than one sub-circuit. For example, suppose that a specification Spec(N) of a circuit N is given by the sub-circuits N1, . . . , Nk and Spec(N) satisfies the following properties: (1) each gate of N is in at least one sub-circuit Ni; and (2) two different sub-circuits Ni, Nj may share only internal gates (see Definition 10 below), then Spec(N) here is represented as a covering.
Let N=(V,E) be a Directed Acyclic Graph (DAG) representing a Boolean circuit, where V, E are sets of nodes and edges of N respectively. A subgraph N*=(V*,E*) of N is called a sub-circuit if the following two conditions are met: (a) If g1,g2 are in V* and there is a path from g1 and g2 in N, then all the nodes of N on that path are in V*; and (b) if g1,g2 of V* are coupled by an edge in N, then they are also coupled by an edge in N*. This definition is hereinafter referred to as Definition 9.
Let N* be a sub-circuit of N. An input of a gate g of N* is called an input of N* if it is not coupled to the output of some other gate of N*. A gate g of N* is called an internal gate if all the gates of N whose inputs are fed by the output of g are in N*. Otherwise, g is called an external gate. The output of an external gate is called an output of circuit N*. This definition is hereinafter referred to as Definition 10.
Let a Boolean circuit N be partitioned into k sub-circuits N1, . . . , Nk. Let T be a directed graph of k nodes such that nodes Gi and Gj of T are connected by a directed edge (from ni to nj) if and only if an output of Ni is connected to an input of Nk in N. T is called the communication specification corresponding to the partition N1, . . . , Nk. The partition N1, . . . , Nk is called topological if T is a DAG (i.e., if T does not contain cycles). This definition is hereinafter referred to as Definition 11.
Let T be the communication specification of the circuit N with respect to the topological partition N1, . . . , Nk. Let Gi be the node of T corresponding to the sub-circuit Ni. The length of the longest path from an input of T to Gi is called the level of Gi and Ni (denoted by level(Gi) and level(Ni) respectively). This definition is hereinafter referred to as Definition 12.
Let N11, . . . , N1k and N21, . . . , N2k be the topological partitions of two single output Boolean circuits N1, N2, respectively. Let the communication specifications of N1 and N2 with respect to the partitions N11, . . . , N1k and N21, . . . , N2k be identical. Dout(N1m,N2m), where m=1, . . . , k, are functions computed by induction in topological levels. This definition is hereinafter referred to as Definition 13. Namely, the functions Dout for the sub-circuits on level 1 are first computed, then for those on level 2 are computed, and so on. The function Dout(N1m,N2m) may be obtained from the function H=Sat(v(N1m))^Sat(v(N2m))^Dinpu(N1m,N2m) by existentially quantifying away all the variables except the output variables of N1m, N2m. The function Dinp(N1m,N2m) may be equal to Dout(N1i1,N1i1)^ . . . ^Dout(N1is,N2is)^Eq(xi1,yi1)^ . . . ^Eq(xir,yir). Note that N1i1, . . . , N1is, . . . , N2i1, . . . , N2is are the s sub-circuits (if any) whose outputs are coupled to the inputs of N1m,N2m, respectively. (FIG. 3 shows circuits N1m, N2m and the subcircuits and primary inputs connected to inputs of N1m, N2m.) Variables xi1, . . . , xir, yi1, . . . , yir are the r primary input variables of N1 and N2 (if any) that feed N1m and N2m, respectively. The function, Eq(xit,yit), where 1≦t≦r, is equal to 1 if and only if xit is equal to yit.
Let N1, N2 be two functionally equivalent single output circuits. Let T be a DAG of k nodes. Circuits N1 and N2 are implementations of a specification S (represented as a partitioning of N1 and N2) whose topology is given by T if and only if there is a partitioning, Spec(N1)={N11, . . . , N1k} of N1 and a partitioning Spec(N2)={N21, . . . , N2k} of N2 into k sub-circuits such that (1) the communication specifications T1, T2 of N1 and N2 with respect to the partitionings, Spec(N1), Spec(N2) are equal to T; and (2) each pair of the sub-circuits N1m, N2m is toggle equivalent under the constraint function Dinp(N1m,N2m) specified above. This proposition is hereinafter referred to as Proposition 6.
Proposition 6 may be proven by induction (in levels) using Propositions 4 and 5. Furthermore, the “only if” part may be proven by induction using the fact that two Boolean functions implementing the same multi-valued function are toggle equivalent.
An example of circuits with a CS of three blocks is shown in FIGS. 4A and 4B. Circuit N1 401 (at the top) and N2 402 (at the bottom) have the same communication specification 1000 (shown in FIG. 1 on the left side). Sub-circuits N11, N12 (outlined by the dotted lines 4011 and 4012, respectively) are toggle equivalent to sub-circuits N21, N22 (outlined by the dotted lines 4021 and 4022, respectively) respectively in terms of their inputs related by the constraint functions Dinp(N11, N21)=Eq(x1, y1)^Eq(x2, y2)^Eq(x3, y3) and Dinp(N12, N22)=Eq(x3, y3)^Eq(x4, y4)^Eq(x5, y5) respectively. Sub-circuits N13 and N23 (outlined by the dotted lines 4013 and 4023, respectively) are toggle equivalent in terms of their local inputs related by the constraint function Dinp(N13, N23)=Dout(N11, N21)^Dout(N12, N22). The functions Dout(N11, N21), Dout(N12, N22) are obtained as described in Definition 13. In other words, when the same set of inputs is provided to both circuits N1 401 and N2 402, their corresponding outputs Z1 and Z2 are the same.
With the concept of toggle equivalence and common specification in mind, some embodiments of a process to verify a common specification of two circuits and some embodiments of a process to build a circuit to preserve a predefined specification of another circuit are described below.
Common Specification Verification
FIG. 5 shows a flow diagram of one embodiment of a process to verify a common specification of two given circuits, N1 and N2. Note that specifications of N1 and N2 have the same number of sub-circuits. The process is performed by processing logic that may comprise hardware (e.g., circuitry, dedicated logic, etc.), software (such as a logic synthesis tool, operable to run on a general-purpose computer system or a dedicated machine), or a combination of both.
In one embodiment, the process starts with topological partitions, Spec(N1) and Spec(N2), of the two circuits, N1 and N2, respectively. Alternatively, the process may start with the coverings of N1 and N2. Processing logic computes communication specifications, T1 and T2, for N1 and N2, respectively (processing block 102). Then processing logic checks if T1 and T2 are acyclic (processing block 104). If T1 and T2 are cyclic, processing logic transitions to processing block 124 to end the process. Otherwise, processing logic checks if T1 and T2 are identical (processing block 106). If T1 and T2 are not identical, then processing logic transitions to processing block 124 to end the process. Otherwise, processing logic enters into a loop to go through each sub-circuit of Spec(N1) and Spec(N2). Note that Spec(N1) and Spec(N2) have the same number of sub-circuits. The sub-circuits of Spec(N1) and Spec(N2) are assumed to be numbered in topological order. That is, for any two sub-circuits N1i, N1j of Spec(N1), if i<j, then level(N1i)≦level(N1j). And for any two sub-circuits N2i,N2j of Spec(N2), if i<j, then level(N2i)≦level(N2j).
In one embodiment, processing logic initiates the loop by setting an index, i, to 1, where i corresponds to the pair of sub-circuits N1i and N2i being analyzed in circuits N1 and N2 (processing block 108). Then processing logic computes a constraint function Dinp that relates the inputs of the sub-circuits N1i and N2i (processing block 110). Processing logic further computes a function, Dout that relates the outputs of the sub-circuits N1i and N2i (processing block 112). Then processing logic checks if Dout is a correlation function (processing block 114). If Dout is not a correlation function, and hence, N1i and N2i are not toggle equivalent, processing logic transitions to processing block 124 to end the process. Otherwise, processing logic checks whether the index, i, is less then k, where k is the total number of sub-circuits in Spec(N1) and Spec(N2) (processing block 116). If i is less than k, then processing logic increments i by one (processing block 118) and then repeats processing block 110.
If i is not less than k, then the loop has been completed and processing logic checks whether Dout(N1k, N2k) implies equivalence function (processing block 120). If not, processing logic transitions to processing block 124 to end the process and concludes that Spec(N1) and Spec(N2) are not identical. On the other hand, if Dout(N1k, N2k) implies equivalence function, then processing logic has successfully verified that Spec(N1) and Spec(N2) are identical and N1 and N2 are equivalent and the process ends (processing block 122).
The technique described above efficiently checks for equivalence of N1 and N2. As shown above, N1 and N2 share the same common specification (specified as a partitioning) if and only if N1 and N2 can be partitioned into sub-circuits that are connected in the same way and are toggle equivalent. The above technique allows logic synthesis to verify that different netlists generated indeed preserve a predetermined high-level specification. As described above, this is important for logic synthesis because logic synthesis may generate multiple different netlists in a variety of situations, such as in optimization for speed, optimization for area, switching from one fabrication process to another fabrication process, etc.
Let N1, N2 be two functionally equivalent circuits with a CS S represented by the partitions Spec(N1)={N11, . . . , N1k}, and Spec(N2)={N21, . . . , N2k}. The granularity of S is the size (i.e., the number of gates) of the largest sub-circuit N1j, i=1,2, j=1, . . . , k. This is hereinafter referred to as Definition 14.
In some embodiments, the CS verification procedure is exponential in the granularity p of S and linear in the number of blocks of S, i.e., in the number of sub-circuits in Spec(N1), Spec(N2). (The exponentiality in p is due to existential quantification and the procedure to perform the correlation function.) If the value of p is fixed, the CS verification procedure proves the equivalence of specifications represented by Spec(N1) and Spec(N2) (and hence functional equivalence of N1 and N2) in linear time in the circuit size.
Comparison of Equivalence Checking Based on Specification Verification with Existing Equivalence Checkers
Note that the efficiency of the CS verification procedure is due to the fact that a CS specification of N1 and N2 (represented by Spec(N1) and Spec(N2)) is known. On the other hand, one can view state-of-the art equivalence checkers as procedures looking for a CS of N1 of N2 of a special kind. Such procedures try to find pairs of functionally equivalent points of N1, N2 and use them as cutpoints. Then these procedures look for new points of N1, N2 that are functionally equivalent in terms of cutpoints. The reason for looking for cutpoints is that checking functional equivalence of internal points of N1, N2 in terms of cutpoints is much easier than in terms of primary inputs. In general, this approach has the following two problems. The first problem is to find the new potential cutpoints (i.e., to find points of N1, N2 that are functionally equivalent). The second problem is to decide whether two functionally equivalent internal points can be used as cutpoints. Making a wrong decision here leads to the appearance of the so-called false negatives.
One can view the cut advancement approach employed by modern equivalence checkers as a search for a CS of N1, N2 of a special type, where very sub-circuit of Spec(N1) and Spec(N2) has exactly one output. However, if one tries to extend this approach to CSs of the general type (where sub-circuits of Spec(N1) and Spec(N2) may have many outputs), the two problems mentioned above may become virtually unsolvable. In the case of multi-output sub-circuits, functional equivalence is replaced with toggle equivalence. Suppose the granularity p of a CS of N1, N2 is 10. So the sub-circuits of Spec(N1) and Spec(N2) to be considered may have up to 10 outputs. Then the number of candidate sub-circuits in N1 and N2 is proportional to |N1|10 and |N2|10, respectively, where |Nj| is the size of Nj (j=1 or 2). The number of potential pairs of sub-circuits of N1, N2 to examine is proportional to |N1|10*|N2|10. But even if a pair of sub-circuits N1i, N2i of size less or equal to 10 that are toggle equivalent has been found, one still has to decide if the outputs of N1i, N2i can be used as cutpoints. That is, one has to decide whether N1i, N2i are toggle equivalent “by chance” or N1i, N2i are a part of a CS. Since the number of candidates is typically huge, the process is prone to mistakes.
Since finding a CS of N1, N2 in the case Spec(N1) and Spec(N2) contain multi-output sub-circuits is infeasible, in the equivalence checking procedure described in the current document, a CS of N1, N2 is required to be known. This makes this procedure efficient.
Specification Preservation
FIG. 6 illustrates a flow diagram of one embodiment of a process to build a second circuit to preserve a predefined specification of a first circuit. The process may also be referred to as specification preservation (SP). The process is performed by processing logic that may comprise hardware (e.g., circuitry, dedicated logic, etc.), software (such as a logic synthesis tool, operable to run on a general-purpose computer system or a dedicated machine), or a combination of both.
In one embodiment, processing logic starts the process with the first circuit, N1, the topological partition of N1, (Spec(N1)={N11, . . . , N1k}), and the cost function to optimize during synthesis (processing block 410). Spec(N1) has k sub-circuits and processing logic goes through each sub-circuit in a loop. To initiate the loop, processing logic may set an index, i, to be one, where i corresponds to the sub-circuit of Spec(N1) being analyzed (processing block 420). The sub-circuits of Spec(N1) are assumed to be numbered in topological order. That is, for any two sub-circuits N1i, N1j of Spec(N1), if i<j, then level(N1i)≦level(N1j).
In each iteration of the loop, processing logic performs several operations to build a portion of the second circuit, N2. In one embodiment, processing logic builds a constraint function Dinp that relates the inputs of N1i and N2i (processing block 423). Then processing logic may synthesize N2i, which is toggle equivalent to N1i, taking into account of the cost function (processing block 425). Processing logic may further compute a function, Dout that relates the outputs of N1i and N2i based on Dinp (processing block 427). Dout is a correlation function because N1i nad N2i are toggle equivalent. Then processing logic may check whether i is greater than k, where k is the total number of sub-circuits in Spec(N1) (processing block 428). If i is less than k, then processing logic may increment i by one (processing block 429) and repeat processing block 423. Otherwise, processing logic has gone through every sub-circuit of Spec(N1). Thus, processing logic may transition to processing block 430 to end the process by returning N2 and the topological partition of N2 represented by Spec(N2).
The importance of some embodiments of the SP procedure is twofold. First, the complexity of the SP procedure is the same as that of the CS verification procedure. Namely, it is exponential in the granularity p of the CS of N1, N2 represented by Spec(N1), Spec(N2) and linear in the number of sub-circuits in Spec(N1) and Spec(N2), assuming that the synthesis of N2i is exponential in p. This means that if p is fixed, the SP procedure is linear in circuit size, and hence, the SP procedure is scalable.
Second, the SP procedure may allow one to make a trade-off between optimization quality and efficiency. Note that the search space explored by the SP procedure may be limited to the implementation of the specification of N1 represented by Spec(N1). The smaller the granularity p of the specification S of N1 is, the smaller the search space is and the greater the efficiency of the SP procedure is. So, if no good alternative implementation N2 is found for the current specification of N1, one can merge some adjacent sub-circuits of Spec(N1) to get a specification of larger granularity. With a specification of larger granularity, the search space may become larger at the expense of performance of the SP procedure.
Furthermore, even for a specification of small granularity, the space of implementations is very rich. The expression, (2p)!, gives the number of different binary encodings of length p for a 2p-valued variable. Note that the value of (2p)! is huge even for a very small p. This expression may provide a ballpark estimate of the number of functions that are toggle equivalent to a p-output Boolean function.
Note that in the examples described above, combinational circuits are used to illustrate the concepts of toggle equivalence and common specification, however, one should appreciate that these concepts can be applied to the synthesis of sequential circuits as well.
FIG. 7 illustrates a computing system that may be used to perform some or all of the processes according to some embodiments of the invention. In one embodiment, the computing system 500 includes a processor 510 and a memory 520, a removable media drive 530, and a hard disk drive 540. In one embodiment, the processor 510 executes instructions residing on a machine-readable medium, such as the hard disk drive 540, a movable medium (e.g., a compact disk 501, a magnetic tape, etc.), or a combination of both. The instructions may be loaded from the machine-readable medium into the memory 520, which may include Random Access Memory (RAM), dynamic RAM (DRAM), etc. The processor 510 may retrieve the instructions from the memory 520 and execute the instructions to perform operations described above.
Note that any or all of the components and the associated hardware illustrated in FIG. 7 may be used in various embodiments of the system 500. However, it should be appreciated that other configurations of the system 500 may include more or less devices than those shown in FIG. 7.
FIG. 8 illustrates an exemplary embodiment of a logic synthesis tool usable with one embodiment of the present invention. The logic synthesis tool 800 includes several modules, which may be implemented using software, hardware, or a combination of both. The modules shown in FIG. 8 include a logic synthesis module 811, an optimization and timing analysis module 813, and a graphical user interface (GUI) module 815. Note that various embodiments of the logic synthesis tool may include more or fewer modules than those illustrated in FIG. 8. The logic synthesis tool 800 receives a high-level specification of a circuit design, such as the RTL specification 801, as an input. The RTL specification 801 may be written in a hardware description language (HDL), such as Verilog. In addition to the high-level specification, the logic synthesis tool 800 also receives data from a number of libraries 803, such as standard cell libraries, which describes the specific details of some circuit components (e.g., NAND gate, NOR gate, etc.) specific to a predetermined semiconductor fabrication process. The logic synthesis tool 800 outputs a gate-level netlist 820, which may contain description of the circuit components and the connection of the circuit components to implement the RTL specification 801.
In one embodiment, the logic synthesis module 811 performs logic synthesis on the RTL specification 801 to generate the gate-level netlist 820 based on the RTL specification 801 and the data from the libraries 803. The optimization and timing analysis module 813 may further optimize an intermediate gate-level netlist from the logic synthesis module 311 before the netlist 820 is output. In some embodiments, the optimization and timing analysis module 813 performs timing analysis as part of the process to optimize the intermediate gate-level netlist. The GUI module 815 may generate one or more graphical user interface to receive inputs (e.g., constraints, instructions, etc.) from users, where such inputs may be used to control or modify the operations performed by the logic synthesis module 811.
Some portions of the preceding detailed description have been presented in terms of algorithms and symbolic representations of operations on data bits within a computer memory. These algorithmic descriptions and representations are the tools used by those skilled in the data processing arts to most effectively convey the substance of their work to others skilled in the art. An algorithm is here, and generally, conceived to be a self-consistent sequence of operations leading to a desired result. The operations are those requiring physical manipulations of physical quantities. Usually, though not necessarily, these quantities take the form of electrical or magnetic signals capable of being stored, transferred, combined, compared, and otherwise manipulated. It has proven convenient at times, principally for reasons of common usage, to refer to these signals as bits, values, elements, symbols, characters, terms, numbers, or the like.
It should be kept in mind, however, that all of these and similar terms are to be associated with the appropriate physical quantities and are merely convenient labels applied to these quantities. Unless specifically stated otherwise as apparent from the above discussion, it is appreciated that throughout the description, discussions utilizing terms such as “processing” or “computing” or “calculating” or “determining” or “displaying” or the like, refer to the action and processes of a computer system, or similar electronic computing device, that manipulates and transforms data represented as physical (electronic) quantities within the computer system's registers and memories into other data similarly represented as physical quantities within the computer system memories or registers or other such information storage, transmission or display devices.
The present invention also relates to an apparatus for performing the operations described herein. This apparatus may be specially constructed for the required purposes, or it may comprise a general-purpose computer selectively activated or reconfigured by a computer program stored in the computer. Such a computer program may be stored in a computer readable storage medium, such as, but is not limited to, any type of disk including floppy disks, optical disks, CD-ROMs, and magnetic-optical disks, read-only memories (ROMs), random access memories (RAMs), EPROMs, EEPROMs, magnetic or optical cards, or any type of media suitable for storing electronic instructions, and each coupled to a computer system bus.
The processes and displays presented herein are not inherently related to any particular computer or other apparatus. Various general-purpose systems may be used with programs in accordance with the teachings herein, or it may prove convenient to construct a more specialized apparatus to perform the operations described. The required structure for a variety of these systems will appear from the description below. In addition, the present invention is not described with reference to any particular programming language. It will be appreciated that a variety of programming languages may be used to implement the teachings of the invention as described herein.
A machine-readable medium includes any mechanism for storing or transmitting information in a form readable by a machine (e.g., a computer). For example, a machine-readable medium includes read only memory (“ROM”); random access memory (“RAM”); magnetic disk storage media; optical storage media; flash memory devices; electrical, optical, acoustical or other form of propagated signals (e.g., carrier waves, infrared signals, digital signals, etc.); etc.
The foregoing discussion merely describes some exemplary embodiments of the present invention. One skilled in the art will readily recognize from such discussion, the accompanying drawings and the claims that various modifications can be made without departing from the spirit and scope of the invention.

## Claims

1. A method of circuit synthesis for integrated circuit design, the method comprising:
building a first circuit N1 partitioned into a first plurality of sub-circuits corresponding to a specification, wherein the specification specifies the partitioning of the first circuit N1 into sub-circuits and the connectivity of the sub-circuits;
deriving a plurality of toggle equivalent sub-circuits respectively corresponding to the first plurality of sub-circuits of the first circuit N1; and
building a second circuit N2 using the plurality of toggle equivalent sub-circuits in response to the specification, wherein the plurality of toggle equivalent sub-circuits form a partitioning of the second circuit N2 corresponding to the specification and the partitioning of the first circuit N1 into sub-circuits.

2. The method of claim 1, wherein
deriving the plurality of toggle equivalent sub-circuits comprises:
for each of the first plurality of sub-circuits of the first circuit N1:
building a constraint function that relates one or more inputs of the corresponding sub-circuit to one or more inputs of the corresponding toggle equivalent sub-circuit of the second circuit N2;
synthesizing the next toggle equivalent sub-circuit of the second circuit N2 based on the constraint function and a cost function; and
computing a correlation function that relates outputs of the corresponding sub-circuit of the first circuit N1 and outputs of the toggle equivalent sub-circuit of the second circuit N2.

3. The method of claim 2, wherein
the correlation function is computed in response to the constraint function.

4. The method of claim 1, wherein
complexity of the deriving of the plurality of toggle equivalent sub-circuits and building the second circuit N2 is linear in a number of the first plurality of sub-circuits of the first circuit N1.

5. A method to implicitly reencode a multi-valued variable Y representing an output of a multi-valued function F of Boolean variables implemented by a Boolean circuit N1, the method comprising:
receiving a description of the first circuit N1 including a specification of the partitioning of the first circuit into sub-circuits;
replacing the first circuit N1 with a second circuit N2 corresponding to the specification and the partitioning of the first circuit N1, wherein the second circuit N2 implements the multi-valued function F; and
synthesizing the second circuit N2, wherein sub-circuits of the second circuit N2 are respectively toggle equivalent sub-circuits to the sub-circuits of the first circuit N1.

6. The method of claim 5, further comprising:
verifying that the second circuit N2 is toggle equivalent to the first circuit N1.

7. A method to implicitly reencode a multi-valued variable Y representing an output of a multi-valued function F of Boolean variables implemented by a Boolean circuit N1, the method comprising:
receiving a description of the first circuit N1;
replacing the first circuit N1 with a second circuit N2, wherein the second circuit N2 implements the multi-valued function F
synthesizing the second circuit N2, wherein the second circuit N2 is toggle equivalent to the first circuit N1;
verifying that the second circuit N2 is toggle equivalent to the first circuit N1 including
computing a constraint function (Dinp) that relates inputs of the first circuit N1 and the second circuit N2.

8. The method of claim 7, wherein verifying that the second circuit N2 is toggle equivalent to the first circuit N1 further comprises:
computing a function (Dout) that relates outputs of the first circuit N1 and the second circuit N2.

9. The method of claim 8, wherein verifying that the second circuit N2 is toggle equivalent to the first circuit N1 further comprises:
checking whether the function Dout is a correlation function.

10. A machine-readable medium that provides instructions that, when executed, will perform operations for integrated circuit design, the operaitons comprise:
building a first circuit N1 partitioned into a first plurality of sub-circuits corresponding to a specification, wherein the specification specifies the partitioning of the first circuit N1 into sub-circuits and the connectivity of the sub-circuits;
deriving a plurality of toggle equivalent sub-circuits respectively corresponding to the first plurality of sub-circuits of the first circuit N1; and
building a second circuit N2 using the plurality of toggle equivalent sub-circuits in response to the specification, wherein the plurality of toggle equivalent sub-circuits form a partitioning of the second circuit N2 corresponding to the specification and the partitioning of the first circuit N1 into sub-circuits.

11. The machine-readable medium of claim 10, wherein
deriving the plurality of toggle equivalent sub-circuits comprises:
for each of the first plurality of sub-circuits of the first circuit N1:
building a constraint function that relates one or more inputs of the corresponding sub-circuit to one or more inputs of the corresponding toggle equivalent sub-circuit of the second circuit N2;
synthesizing the next toggle equivalent sub-circuit of the second circuit N2 based on the constraint function and a cost function; and
computing a correlation function that relates outputs of the corresponding sub-circuit of the first circuit N1 and outputs of the toggle equivalent sub-circuit of the second circuit N2.

12. The machine-readable medium of claim 11, wherein
the correlation function is computed in response to the constraint function.

13. The machine-readable medium of claim 10, wherein
complexity of the deriving of the plurality of toggle equivalent sub-circuits and building the second circuit N2 is linear in a number of the first plurality of sub-circuits of the first circuit N1.

14. A machine-readable medium that provides instructions that, when executed, will perform operations to implicitly reencode a multi-valued variable Y representing an output of a multi-valued function F of Boolean variables implemented by a first Boolean circuit N1, the operations comprise:
receiving a description of the first circuit N1; and
replacing the first circuit N1 with a second circuit N2 corresponding to the specification and the partitioning of the first circuit N1, wherein the second circuit N2 implements the multi-valued function F; and
synthesizing the second circuit N2, wherein sub-circuits of the second circuit N2 are respectively toggle equivalent sub-circuits to the sub-circuits of the first circuit N1.

15. The machine-readable medium of claim 14, wherein the operations further comprise:
verifying that the second circuit N2 is toggle equivalent to the first circuit N1.

16. A machine-readable medium that provides instructions that, when executed, will perform operations to implicitly reencode a multi-valued variable Y representing an output of a multi-valued function F of Boolean variables implemented by a first Boolean circuit N1, the operations comprise:
receiving a description of the first circuit N1;
replacing the first circuit N1 with a second circuit N2, wherein the second circuit N2 implements the multi-valued function F;
synthesizing the N2, where the second circuit N2 is toggle equivalent to the first circuit N1; and
verifying that the second circuit N2 is toggle equivalent to the first circuit N1 including
computing a constraint function (Dinp) that relates inputs of the first circuit N1 and the second circuit N2.

17. The machine-readable medium of claim 16, wherein verifying that the second circuit N2 is toggle equivalent to the first circuit N1 further comprises:
computing a function (Dout) that relates outputs of the first circuit N1 and the second circuit N2.

18. The machine-readable medium of claim 17, wherein verifying that the second circuit N2 is toggle equivalent to the first circuit N1 further comprises:
checking whether the function Dout is a correlation function.

19. A system comprising:
a machine-readable medium to store instructions; and
a processor, coupled to the machine-readable medium, to retrieve instructions from the machine-readable medium and, in response to the instructions retrieved, to perform operations for integrated circuit design, the operations comprising:
building a first circuit (N1) partitioned into a first plurality of sub-circuits corresponding to a specification, wherein the specification specifies the partitioning of the first circuit N1 into sub-circuits and the connectivity of the sub-circuits;
deriving a plurality of toggle equivalent sub-circuits respectively corresponding to the first plurality of sub-circuits of the first circuit N1; and
building a second circuit N2 using the plurality of toggle equivalent sub-circuits in response to the specification, wherein the plurality of toggle equivalent sub-circuits form a partitioning of the second circuit N2 corresponding to the specification and the partitioning of the first circuit N1 into sub-circuits.

20. The system of claim 19, wherein
deriving the plurality of toggle equivalent sub-circuits comprises:
for each of the first plurality of sub-circuits of the first circuit N1;
building a constraint function that relates one or more inputs of the corresponding sub-circuit to one or more inputs of the corresponding toggle equivalent sub-circuit of the second circuit N2;
synthesizing the next toggle equivalent sub-circuit of the second circuit N2 based on the constraint function and a cost function; and
computing a correlation function that relates outputs of the corresponding sub-circuit of the first circuit N1 and outputs of the toggle equivalent sub-circuit of the second circuit N2.

21. The system of claim 20, wherein
the correlation function is computed in response to the constraint function.

22. The system of claim 19, wherein
complexity of the deriving of the plurality of toggle equivalent sub-circuit and building the second circuit N2 is linear in a number of the first plurality of sub-circuits of the first circuit N1.

23. A system comprising:
a machine-readable medium to store instructions; and
a processor, coupled to the machine-readable medium, to retrieve instructions from the machine-readable medium and, in response to the instructions retrieved, to perform operations to implicitly reencode a multi-valued variable Y representing an output of a multi-valued function F of Boolean variables implemented by a Boolean circuit N1, the operations comprising:
receiving a description of the first circuit N1 including a specification of the partitioning of the first circuit into sub-circuits;
replacing the first circuit N1 with a second circuit N2 corresponding to the specification and the partitioning of the first circuit N1, wherein the second circuit N2 implements the multi-valued function F; and
synthesizing the second circuit N2, wherein sub-circuits of the second circuit N2 are respectively toggle equivalent sub-circuits to the sub-circuits of the first circuit N1.

24. The system of claim 23, wherein the operations further comprise:
verifying that the second circuit N2 is toggle equivalent to the first circuit N1.

25. A system comprising:
a machine-readable medium to store instructions; and
a processor, coupled to the machine-readable medium, to retrieve instructions from the machine-readable medium and, in response to the instructions retrieved, to perform operations to implicitly reencode a multi-valued variable Y representing an output of a multi-valued function F of Boolean variables implemented by a Boolean circuit N1, the operations comprising:
receiving a description of the first circuit N1;
replacing the first circuit N1 with a second circuit N2, wherein the second circuit N2 implements the multi-valued function F;
synthesizing the second circuit N2, where the second circuit N2 is toggle equivalent to the first circuit N1, and
verifying that the second circuit N2 is toggle equivalent to the first circuit N1 including
computing a constraint function (Dinp) that relates inputs of the first circuit N1 and the second circuit N2.

26. The system of claim 25, wherein
verifying that the second circuit N2 is toggle equivalent to the first circuit N1 further comprises:
computing a function (Dout) that relates outputs of the first circuit N1 and the second circuit N2.

27. The system of claim 26, wherein
verifying that the second circuit N2 is toggle equivalent to the first circuit N1 further comprises:
checking whether the function Dout is a correlation function.