Hence the corresponding set of cubes forms a canon- ical cover. We give a ..... the given signature cube and the nodes corresponding ... Therefore, the rst step.
Minimization of Logic Functions using Essential Signature Sets Patrick McGeer Jagesh Sanghavi Robert Brayton Alberto Sangiovanni Vincentelli University of California at Berkeley, Berkeley, CA 94704
Abstract We present a new algorithm for exact two-level logic optimization. It diers from the classical approach; rather than generating the set of all prime implicants of a function, and then deriving a covering problem, we derive the covering problem directly and implicitly, and then generate only those primes involved in the covering problem. We represent a set of primes by the cube of their intersection. The set of sets of primes which forms the covering problem is unique. Hence the corresponding set of cubes forms a canonical cover. We give a successive reduction algorithm for nding the canonical cover from any initial cover, we then generate only those primes involved in at least one minimal cover. The method is eective; solutions for 10 of the 20 hard examples in the Espresso benchmark set are derived and proved minimum. For 5 of the remaining examples the canonical cover is derived, but the covering problem remains to be solved exactly.
1 Introduction The two level logic synthesis problem can be stated as follows. Given an incompletely speci ed logic function F (x1; x2; : : :; xn) composed of an on-set F(x1; x2; : : :; xn), a don't care-set D(x1 ; x2; : : :; xn), and an o-set R(x1; x2; : : :; xn), the goal of two level minimization is to obtain the cover of the logic function F in the sum of products form such that the number of product terms is minimum. The problem was rst considered by Shannon in 1949 [9]. The seminal contribution from Quine [6] and McCluskey [4] resulted in the exact minimization procedure which forms the basis of all modern exact two level minimization algorithms. The basic steps in the Quine-McCluskey procedure can be outlined as follows. 1. Generate all prime implicants of F . 2. For each minterm m of F , nd the set of primes Pm of F which contain m.
3. Find minimum cardinality set of primes P such that P \ Pm 6= for all Pm . Three problems with this approach are the possibility of large number of points m of F, the potentially large number of primes of F ( many of which appear in no minimal cover of F ), and the complexity of solving the covering problem. The research on the two level exact minimization algorithms has focussed primarily on improving the eciency of each step rather than modifying the basic procedure[8, 3]. The extensive experimental work by Rudell [8] combined the ecient prime generation methods and the formulation of set covering problem with a suite of techniques to solve the set covering problem in the program Espresso-exact. The Espresso-exact was able to nd minimum solution for 114 of 134 benchmark circuits. Out of the 20 examples on which the Espressoexact failed 17 had too many primes to be generated in 10 hours of CPU time on microvax-II. Further, only a small fraction of total primes generated are relevant for obtaining any arbitrary minimal cover of F . The problem is expected to be accentuated in the multilevel synthesis, which has very large don't care set at each node of the boolean network. To make this concrete, consider the incompletelyspeci ed function (which will be used repeatedly as an example in this paper) with onset xyw + xyzw, and oset xyw + xyzw + xyzw; This function has seven primes, and has the following sets of primes P for the minterms of the on-set: Pxyzw = fxy; xw; zwg Pxyzw = fxy; xwg Pxyzw = fyzw; xzwg Observing that Pxyzw Pxyzw , we obtain the minimal sets: Pxyzw = fxy; xwg Pxyzw = fyzw; xzwg
Hence, the only primes involved in any minimal solution are fxy; xw; yzw; xzwg; hence of the seven primes of the function, only four are of interest. A better procedure than the Q-M procedure would generate only those primes in the minimal sets. This is our main focus. The new procedure we propose is: 1. Identify the minimal sets of primes Pm which form the set covering problem for F , 2. Generate the primes of each set Pm . 3. Find minimum cardinality set of primes P such that P \ Pm 6= for all Pm . The basic idea is to generate the set of primes before generating the primes themselves. The set of primes can be uniquely represented by a cube formed by their intersection. This notion was independently used in [5]. For any logic function F , there is a set of essential sets of primes which form the set covering problem for F . The corresponding set of intersection cubes form the canonical cover of F . We have devised an ecient implementation strategy for obtaining the canonical cover starting from an arbitrary cover of F . The basic approach is to identify the cube representing the essential set of primes by translating essentiality condition for set of primes in terms of its cube representation. In the next section, we review the properties of the set of primes and their implicit cube representation. In section 3, we describe the cube tree based algorithm for obtaining the canonical cover. In section 4, we brie y outline the suite of techniques borrowed from the Espresso-exact to nd the minimumcardinality cover given the formulation of the set covering problem. In section 5, we present the results of numerical experimentation on the Espresso-exact benchmark suite and demonstrate the usefulness of the essential signature cube concept by obtaining the exact minimum for 10 problems for which the exact minimum was not known before due to too many primes. In section 6, we make some concluding remarks and give the directions for the future research. A note on notations. A cube c contains a cube d is denoted as c d or d c. A cube c strictly contains a cube d is denoted as c > d or d < c. The containment convention is also extended to functions. We say F covers G, written F G or G F, if and only if each minterm of G is also a minterm of F.
2 Signature Cubes and Signature Sets The purpose of this section is to de ne the signature cube and the signature set concepts and provide the
theoretical foundation to derive the algorithm for obtaining the canonical cover of the logic function. The correspondence between the sets of primes and cubes is key to the covering process hence we begin with the notion of the signature cube to represent the set of primes implicitly, next we state the conditions for the sets of primes to be involved in the set covering problem in terms of their implicit representation as the signature cubes. The details of the proofs can be found in [7] and are omitted here. We begin with the introduction of following de nitions.
De nition 2.1 Let P = fp :::png be any set of 1
primes. Let
C (P) =
\n p :
i=1
i
De nition 2.2 For c F + D, let S (c) = fpjp is a prime of F and p cg De nition 2.3 For any implicant c F + D, let: (c) = C (S (P)) De nition 2.4 Consider a set of primes P and a cube c such that P = S (c) and c = C (P) is We say that c is the signature cube of P , and P is the signature set of c. We introduce below the notion of the essential signature cube and the essential signature set.
De nition 2.5 Let Pj be a set of primes. We say that Pj is an essential signature set of F if and only if 1. there exists a minterm mj 2 C (Pj ) such that Pj = S (mj ) and 2. no P Pj is an essential signature set of F .
mj is called an essential point of Pj . The cube C (Pj ) is called an essential signature cube of F . The following property can be derived immediately. For every m 2 F, there is some essential signature set Q S (m). We now identify the properties of the set of primes involved in the set covering problem and translate them in terms of their equivalent representation - signature cubes.
De nition 2.6 A formulation of the covering problem for F is a collection of sets P = fP ; :::; Png each Pi is a subset of the set of primes of F such that fp ; :::; pkg is a minimal cover of F if and only if fp ; :::; pkg is a minimal set cover of P . A formulation P = fP ; :::; Png is said to be minimal i there is no collection of sets Q P such that Q is a formulation 1
1
1
1
of the covering problem.
In
the
example
above,
fxy; xw; zwg; fxy; xwg; fyzw; xzwg is one formulation of the covering problem whereas fxy; xwg; fyzw; xzwg
is a minimal formulation. The following theorem identi es the necessary and sucient condition for set of sets of primes to be a minimal formulation of the covering problem for F .
Theorem 2.1 Let P1; P2; : : :; Pn be any set of sets of primes such that Pi 6 Pj for all i,j. P1 ; P2; : : :; Pn is a minimal formulation for the covering problem for F if and only if P 1. ni=1 C (Pi) F and 2. for each Pi , 9 a minterm mi 2 C (Pi ) such that Pi = S (mi ). Combining the theorem above with the property of the essential signature sets, we have the following theorem relating the formulation of the covering problem for F and the essential signature sets.
Theorem 2.2 Let P ; P ; : : :; Pn be a minimal formulation of the covering problem for F , and Q ; Q ; : : :; Qt be the enumeration of the essential signature sets of F . Then n = t and Pi = Q i for some 1
1
2
2
permutation of 1; 2; : : :; n.
( )
The above theorem can be restated as follows. For any function F , there is a unique formulation of the covering problem, namely the enumeration of the essential signature set. Given the one-to-one correspondence between the essential signature sets and the essential signature cubes, it follows that the set of essential signature cubes of an incompletely speci ed function F is unique and forms an irredundant cover of F . We de ne the cover formed by the essential signature cubes as the canonical cover of an incompletely speci ed function F . The theorem stated above gives a formal characterization to the set covering problem corresponding to the covering problem of a logic function F : the sets of the covering problem are simply the essential signature sets of F . By the duality of signature sets and
signature cubes, it follows immediately that the image of the essential signature sets are the essential signature cubes; hence, the covering problem is completely given by the canonical cover of F . The new synthesis algorithm proposed herein can thus be re-stated: 1. Find the canonical cover c1 ; :::; cm of F . 2. For each cj , nd its signature set Pj 3. Find the minimum T cardinality set of primes P such that P Pj 6= ; for all 1 j n. Step (1) of this algorithm is the subject of the remainder of this paper. Before we begin, we give an alternative characterization of the essential signature cubes. In the process of accomplishing this task, we will be concerned with nding the smallest signature cube containing a given cube.
Theorem 2.3 c is an essential signature cube of F if and only if 1. 9 a minterm m 2 F such that c = (m); and 2. 6 9 a minterm n 2 F such that c < (n).
The next task is to develop an algorithm which exploits this property to identify the essential signature cubes. This is accomplished in the next section.
3 Algorithm for obtaining the Canonical Cover In this section, we discuss the cube tree based algorithm to obtain the canonical cover of a logic function. We begin by stating the following theorem about the cover of a logic function.
Theorem 3.1 Each cube in an arbitrary irredundant cover of signature cubes will contain at least one essential signature cube. Starting with an arbitrary cover, we obtain a prime and irredundant cover. Since each prime is a signature cube, a prime and irredundant cover can provide the starting point for the canonical cover algorithm. The algorithm for nding the canonical cover is given in gure 1. We start with an arbitrary irredundant cover of signature cubes. The main loop of the algorithm consists of testing each signature cube in the cover for essentiality and returns the set of contained signature cubes if the signature cube is found to be inessential. At each iteration, either an essential signature cube is found or an inessential signature
find canonical cover: Inputs: F on-set D dc-set R off-set Output: ESC cover of essential signature cubes
f
f
E = D; /* E - Extended don't care set */ ESC = ; C = Irredundant signature cube cover of ; while(There is a cube c of C) (COVER,flag) = ess test and reduction(c,E,R); if(flag == ESSENTIAL) E = E + c ; ESC = ESC + c ; C = C c ;
f
f
g
f
f
g f g
F
f
g
else C = C - c + COVER; Make C Irredundant;
g
g
fg
g
ess test and reduction(c,E,R) return ess test and reduction aux(c,c,E,R);
g
ess test and reduction aux(c,d,E,R) Inputs: c signature cube tested for essentiality d cube obtained from c by adding literals during the descent down the cube tree E Extended don't care set R off-set Outputs: COVER Cover of d consisting of signature cube(s) if subtree rooted at d does not contain essential point of c. flag = ESSENTIAL or NOT ESSENTIAL
f
/* Special Cases */ If(d E) return(NIL, NOT ESSENTIAL); If( (d) c) return( (d), NOT ESSENTIAL); If(d is a minterm) return(NIL, ESSENTIAL); select a splitting variable ; COVER = ; for(each element (i) in ) (0) (1) /* , for binary variable, (0) (q ) for multivalued variable */ (COV,flag) = ess test and reduction aux(c, (i),E,R); if(flag == ESSENTIAL) return(NIL,ESSENTIAL);
Figure 1: Find Canonical Cover Algorithm cube is reduced into the set of signature cubes which are strictly smaller. In the worst case, each cube is reduced into set of minterms which are essential signature minterms. This establishes the nite termination property of the procedure. The algorithm for essentiality test and reduction along with the auxiliary procedure is given in gure 2. The ess test and reduction aux is the main recursive procedure which starts with the given signature cube and searches for the corresponding essential point. The recursive procedure can be visualized as descent down a tree with the root corresponding to the given signature cube and the nodes corresponding to the cubes obtained by successively adding literals to the signature cube, hence the name cube tree based algorithm. The essential minterm for a signature cube can be contained neither in the don't care set of the given logic function nor in the partial cover of essential signature cubes found so far. Therefore, the rst step is to remove from consideration the cubes obtained during the descent process which are contained in the
6=
x x x x x ; : : :; x
x
x
xf
f
dx
g
g g
COVER = COVER + COV;
return(COVER, NOT ESSENTIAL);
Figure 2: Essentiality Test and Reduction Algorithm
union of don't care set and the current set of essential signature cubes. The following lemma is important for identifying the essential signature cubes.
Lemma 3.1 For arbitrary cube d F + D and a
signature cube c, if (d) < c and for each d < b < c; (b) = c then d is a signature cube and (d) = d.
For the signature cube at the root to be essential, the above lemma requires that there is path from the root to the leaf in the cube tree such that the signature cube at each node along the path is equal to the signature cube at the root. The next two steps in the ess test and reduction aux procedure verify this condition at each node. The recursive procedure terminates either by nding the essential minterm in which case the given signature cube is essential or by reducing the inessential signature cube to the set of signature cubes strictly contained in it. We have devised a method to compute signature cube (d) of cube d using the blocking function introduced in [1].
De nition 3.1 Given an incompletely speci ed logic function F = (F,D,R) and a cube d F + D the blocking function B d of F is de ned as the sum of cubes Bid ; 1 i jRj Bid = fxj 1 j xj 2 Ri ; xj 2 dg
We denote the prime and irredundant cover of the complement of B d by P d . From the proposition 3.5.2 in [1], there is a one-to-one correspondence between the set of cubes of P d and the set of primes containing d. The signature cube of d is simply the product of all the cubes of P d .
4 Exact Cover for the Set Covering Problem The canonical cover obtained in the previous section can be easily converted in to set of primes using the concept of complementation of the blocking function. Having obtained the set covering problem in a form suitable for the Espresso-exact, we employ the suite of techniques used by the Espresso-exact in the minimization procedure. These include identifying essential columns, using column dominance, Gimpel's reduction step and maximal independent set heuristic. 1x
j
stands for a literal or its complement
5 Experimental Results Initial results for the extended Espresso benchmark suite comprising of 134 examples from Espresso-exact suite and 11 randomly generated PLA's were obtained. The ratio of the number of primes in the essential signature sets (number of columns in the reduced covering table) to the set of all primes is 0.51 for the \easy" problems. We also report results on 20 \hard" examples (ones on which Espresso-exact failed). These examples are noteworthy for having many primes. Indeed, Coudert and Madre[2] report that some have as many as 10,000,000 primes. Despite this, the Essential Signature Set (number of columns of the reduced covering table) for many of these is small. In the table 1, we report the name, number of inputs and outputs, number of terms in the given problem, number of primes (found by [2]), number of essential primes, number of essential signature cubes (number of sets or rows of the nal covering problem), number of primes in some essential signature set (number of columns of the nal covering problem), the ratio of number of columns in the reduced covering table to the number of columns in the original table, the size of the minimum solution where known and the computation time in seconds on a DECstation 5000. The time is the time to nd the minimum solution when found or the time to nd the canonical cover if the minimum solution was not found. We used the standard Espresso-MV routines for the internals of the package, and the Espressoexact table-covering algorithms. We found the canonical cover for 15 of the 20 problems, and the exact solution for 10 of the 20 problems. Of these 10, seven had not been previously solved exactly. Of the seven for which the exact solution is now known, six (jbp, misg, mish, misj, signet and x7dn) had in fact been \solved" by Espresso-II, though it was not known until this writing that the solution was in fact a minimum. On the remaining example, pdc, Espresso-II came within four terms of the minimum 96 terms. We are continuing to improve our code and expect that some of the 5 remaining examples where we have found the canonical cover will be solved. In addition, we still hope to nd the canonical cover by improved techniques for the remaining 5 examples. 1
Exact minimum not previously known
Results for Hard Problems Name In/Out Terms Primes Ess ESC ESS ESS/Primes Minimum Time ex1010 10/10 810 25888 0 1468 25200 0.9734 684 ibm 48/17 173 1047948800 172 173 174 1.66e-7 173 1.5 jbp 36/57 166 2496809 0 5192 37644 0.015 122 49352 1 misg 56/23 75 6699491839 3 134 200 2.98e-8 69 26.71 mish 94/43 91 1.1243e15 3 160 239 2.12e-13 82 87.5 1 misj 35/14 48 139103 13 79 101 7.26e-4 35 2.71 1 pdc 16/40 2406 23231 2 6550 18923 0.8145 96 221191 shift 19/16 100 165133 100 100 100 6.05e-4 100 0.26 signet 39/8 124 78735 104 132 153 1.94e-3 119 41751 test2 11/35 1999 109099 0 7105 106933 0.9801 - 16698 test3 10/35 1003 41344 0 3520 40664 0.9835 5286 ts10 22/16 128 524280 128 128 128 2.44e-4 128 0.3 x2dn 82/56 112 1.1488e16 2 846 2006 1.74e-13 1 x7dn 66/15 622 566698631 378 2602 5966 1.05e-5 538 6479 xparc 41/73 551 - 140 1843 2974 Table 1: Results for Hard Problems
6 Conclusions and future directions In this paper, we have discussed an ecient implementation strategy to obtain the canonical cover of a logic function. The notion of formulation of the set covering problem without explicitly generating the primes in the set is attractive since it reduces the size of the covering table signi cantly. The full import of the essential signature cube techniques will be realized when we move towards the multilevel logic synthesis which has very large don't care set at each node of the boolean network.
References [1] R. Brayton, G. Hachtel, C. McMullen, and A. Sangiovanni-Vincentelli. Logic Minimization Algorithms for VLSI Synthesis. Kluwer Academic Publishers, 1984. [2] O. Coudert and J. C. Madre. Implicit and incremental computation of primes and essential primes of boolean functions. In The Proceedings of Design Automation Conference, 1991. [3] M. Dagenais, V. Agarwal, and N. Rumin. Mcboole: a new procedure for exact logic minimization. IEEE Transactions on Computer-Aided Design, 5(1):229{238, January 1986. [4] E. J. McCluskey. Minimization of boolean functions. Bell System Technical Journal, 1956.
[5] M. Perkowski, P. Wu, and K. Pirkl. Kuai-exact: a new approach for multi-valued logic minimization in VLSI synthesis. In IEEE International Symposium on Circuits and Systems, 1989. [6] W. Quine. The problem of simplifying truth functions. American Mathematical Monthly, 1952. [7] R.Brayton, P. McGeer, J. Sanghavi, and A. Sangiovanni-Vincentelli. A new exact minimizer for two-level logic synthesis. In T. Sasao, editor, Logic Synthesis and Optimization. Kluwer Academic Publishers, 1992. [8] R. L. Rudell. Logic Synthesis for VLSI Design. PhD thesis, Department of Electrical Engineering and Computer Science, University of California at Berkeley, 1989. [9] C. E. Shannon. The synthesis of two-terminal switching function. Bell System Technical Journal, 1949.