Logic Synthesis an Verification Two-Level Logic Minimization (/2) Jie-Hong Rolan Jiang 江介宏 Department of Electrical Engineering National Taiwan University Fall 24 Reaing: Logic Synthesis in a Nutshell Section 3 ( 3.- 3.2) most of the following slies are by courtesy of Anreas Kuehlmann 2 Quine-McCluskey Proceure Complexity Given G an D (covers for = (f,,r) an, respectively), fin a minimum cover G* of primes where: f G* f+ (G* is a prime cover of ) Q-M Proceure:. Generate all primes of, {P j } (i.e. primes of (f+) = G+D) 2. Generate all minterms {m i } of f = G D 3. Buil Boolean matrix B where B ij = if m i P j = otherwise 4. Solve the minimum column covering problem for B (unate covering problem) ~2 n minterms; ~3 n /n primes minterms 2 n primes 3 n /n There are O(2 n ) rows an (3 n /n ) columns. Moreover, minimum covering problem is NP-complete. (Hence the complexity can probably be ouble exponential in size of input, i.e. ifficulty is O(2 3n )) 3 4
Two-Level Logic Minimization x z x y xy xy x y z w zw zw z w Karnaugh map F xyzw xyzw xyzw xyzw D yz xyw xyzw xyw xyzw Primes: y + w + x z Solution: {,2} y + w is a minimum prime cover (also w + x z) w y (cover of ) (cover of ) x y z w x y z w x y z w x y z w y w x z 5 Minterms of f x y z w xy zw x y zw xyzw y w x z Definition. An essential prime is a prime that covers an onset minterm of f not covere by any other primes. Essential prime Primes of f+ Row singleton (essential minterm) 6 Row Equality Row equality: In practice, many rows in a covering table are ientical. That is, there exist minterms that are containe in the same set of primes. m m 2 Row an Column Dominance Row ominance: A row i whose set of primes is containe in the set of primes of row i 2 is sai to ominate i 2. i i 2 i ominates i 2 Can remove row i 2 because have to choose a prime to cover i, an any such prime also covers i 2. So i 2 is automatically covere. 7 8
Row an Column Dominance Column ominance: A column j whose rows are a superset of another column j 2 is sai to ominate j 2. j j 2 j ominates j 2 We can remove column j 2 since j covers all those rows an more. We woul never choose j 2 in a minimum cover since it can always be replace by j. Table Reuction. Remove all rows covere by essential primes (columns in row singletons). Put these primes in the cover G. 2. Group ientical rows together an remove ominate rows. 3. Remove ominate columns. For equal columns, keep one prime to represent them. 4. Newly forme row singletons efine inuce essential primes. 5. Go to if covering table ecrease. The resulting reuce covering table is calle the cyclic core. This has to be solve (unate covering problem). A minimum solution is ae to G. The resulting G is a minimum cover. 9 Table Reuction Solving Cyclic Core cyclic core 456 essential prime P (remove rows an 2) an column ominance (col. 2 ominate by 3) G = P row ominance 34567 456 inuce essential prime P3 (remove rows an 2) an column ominance (col. 7 ominate by 4) G = P + P3 Best known metho (for unate covering) is branch an boun with some clever bouning heuristics Inepenent Set Heuristic: Fin a maximum set I of inepenent rows. Two rows B i,b i2 are inepenent if not j such that B i j = B i 2 j =. (They have no column in common.) A covering matrix B rearrange with inepenent sets first B= A C Inepenent set I of rows 2
Solving Cyclic Core Solving Cyclic Core Lemma: Solution of Covering I m must be covere by one of the three columns m m 2 m 3 A C Heuristic algorithm: Let I = {I, I 2,, I k } be the inepenent set of rows. choose j I i such that column j covers the most rows of A. Put Pj in G 2. eliminate all rows covere by column j 3. I I \{I i } 4. go to if I 5. If B is empty, then one (in this case achieve minimum solution because of the lower boun of previous lemma attaine - IMPORTANT) 6. If B is not empty, choose an inepenent set of B an go to A C 3 4 Prime Generation for Single-Output Function Prime Generation for Multi-Output Function Tabular metho (base on consensus operation, or ): Start with minterm canonical form of F Group pairs of ajacent minterms into cubes Repeat merging cubes until no more merging possible; mark ( ) + remove all covere cubes. Result: set of primes of f. Example F= x y + w x y + x y z + w y z F = x y + w x y + x y z + w y z w x y z w x y z w x y z w x y z w x y z w x y z w x y z w x y z w x y z w x y w x z x y z x y z x y z w x y w x z w y z w y z w x y w x z Courtesy: Maciej Ciesielski, UMASS x y x z 5 Similar to single-output function, except that we shoul inclue also the primes of the proucts of iniviual functions x y z f f 2 f f 2 z y x Can also represent it as: x y z f f 2 6
Prime Generation Moification from single-output case: When two ajacent implicants are merge, the output parts are intersecte f x y z f f 2 f 2 There are five primes for this two-output function - What is the min cover? Minimize Multi-Output Cover. List multiple-output primes 2. Create a covering table 3. Solve p = p 2 = p 3 = p 4 = p 5 = Min cover has 3 primes: F = { p, p 2, p 5 } f liste twice f2 p p 2 p 3 p 4 p 5 7 8 Prime Generation Using Unate Recursive Paragim Apply unate recursive paraigm with the following merge step (Assume we have just generate all primes of f xi an f xi ) Theorem. p is a prime of f iff p is maximal (in terms of containment) among the set consisting of P = x i q, q is a prime of f xi, q f x i P = x i r, r is a prime of f xi, r f xi P = q r, q is a prime of f xi, r is a prime of f xi Prime Generation Using Unate Recursive Paraigm Assume q = abc is a prime of f xi. Form p = x i abc. Suppose r = ab is a prime of f xi. Then x i ab is an implicant of f. f = x i abc + x i ab + abc + Thus abc an x i ab are implicants, so x i abc is not prime. Note: abc is prime because if not, ab f (or ac, or bc) contraicting abc prime of f xi. Note: x i ab is prime, since if not then either ab f, x i a f, x i b f. The first contraicts abc prime of f xi an the secon an thir contraict ab prime of f xi. 9 2
Summary Quine-McCluskey Metho:. Generate cover of all primes G = p + p 2 + +p 3 n /n 2. Make G irreunant (in optimum way) Q-M is exact, i.e., it gives an exact minimum Heuristic Methos:. Generate (somehow) a cover of using some of the primes G = p i + p i2 + + p ik 2. Make G irreunant (maybe not optimally) 3. Keep best result - try again (i.e. go to ) 2