190 likes | 214 Views
Lecture 15 — CS 2603 Applied Logic for Hardware and Software. Circuit Minimization using Karnaugh maps. Boolean Functions new name for same old animal. Boolean function — a special kind of predicate Domain of discourse: tuples of {True, False} values Boolean functions truth tables
E N D
Lecture 15 — CS 2603Applied Logic for Hardware and Software Circuit Minimization using Karnaugh maps CS2603 Applied Logic for Hardware and Software Rex Page – University of Oklahoma
Boolean Functionsnew name for same old animal • Boolean function — a special kind of predicate • Domain of discourse: tuples of {True, False} values • Boolean functions truth tables • F(a, b) — two-variable Boolean function • Domain of discourse: pairs of Boolean values • Specifies a Boolean output for each pair of Boolean inputs • Representations we’ve already seen for 2-var Boolean functions • Truth table with four rows (unique: one per Boolean function) • Propositional WFF with two variables (not a unique rep'n) • Combinational circuit with two input lines, one output line • F(a, b, c) — three-variable Boolean function • Domain of discourse: triples of Boolean values • 8-row truth table, 3-variable WFF, 3-input/1-output circuit • F(x1, x2, … xn) — n-variable Boolean function • Domain of discourse: n-tuples of Boolean values • 2n-line truth table, n-variable WFF, n-input/1-output circuit CS2603 Applied Logic for Hardware and Software Rex Page – University of Oklahoma
Exampletruth-table for 3-variable Boolean function x y z F(x,y,z) 0 0 0 0 0 0 1 1 0 1 0 1 0 1 1 0 1 0 0 0 1 0 1 1 1 1 0 0 1 1 1 1 CS2603 Applied Logic for Hardware and Software Rex Page – University of Oklahoma
known as a “minterm” • Minterms are usually written in EE notation • For example: x1 x2 x3, when b1=1, b2=0, b3=1 sum of products Sum-of-Products Representationconstructing a WFF for Boolean function F(x1, x2, … xn) • Focus on places in truth-table where F is True • Boolean tuple (b1, b2, … bn), with F(b1, b2, … bn) =True • That is, (k. (xk= bk)) (F(x1, x2, … xn) = True) • Find a propositional WFF whose value is (k. (xk= bk)) • WFF w, variables x1, x2, … xn , value of w =(k. (xk= bk)) That is, w =True if (k. (xk= bk)) =True w = False if (k. (xk= bk)) = False • w = (y1 y2 … yn) =(k. (xk= bk)) yk = xk if bk= True yk = xk if bk= False • A WFF for F(x1, x2, … xn) • F(x1, x2, … xn) = w1 + w2 + wm— each wk is a minterm • m = number of 1’s in last column of truth table CS2603 Applied Logic for Hardware and Software Rex Page – University of Oklahoma
x y z F(x,y,z) minterm 0 0 0 0 0 0 1 1 0 1 0 1 0 1 1 0 1 0 0 0 1 0 1 1 1 1 0 0 1 1 1 1 Examplesum-of-products representation for 3-variable function Truth table representation of a Boolean function F Example copied from Shaaban: http://meseec.ce.rit.edu/eecc341-winter2001/ CS2603 Applied Logic for Hardware and Software Rex Page – University of Oklahoma
x y z F(x,y,z) minterm 0 0 0 0 0 0 1 1 x y z 0 1 0 1 0 1 1 0 1 0 0 0 1 0 1 1 1 1 0 0 1 1 1 1 Examplesum-of-products representation for 3-variable function Truth table representation of a Boolean function F Example copied from Shaaban: http://meseec.ce.rit.edu/eecc341-winter2001/ CS2603 Applied Logic for Hardware and Software Rex Page – University of Oklahoma
x y z F(x,y,z) minterm 0 0 0 0 0 0 1 1 x y z 0 1 0 1 x y z 0 1 1 0 1 0 0 0 1 0 1 1 1 1 0 0 1 1 1 1 Examplesum-of-products representation for 3-variable function Truth table representation of a Boolean function F Example copied from Shaaban: http://meseec.ce.rit.edu/eecc341-winter2001/ CS2603 Applied Logic for Hardware and Software Rex Page – University of Oklahoma
x y z F(x,y,z) minterm 0 0 0 0 0 0 1 1 x y z 0 1 0 1 x y z 0 1 1 0 1 0 0 0 1 0 1 1 x y z 1 1 0 0 1 1 1 1 Examplesum-of-products representation for 3-variable function Truth table representation of a Boolean function F Example copied from Shaaban: http://meseec.ce.rit.edu/eecc341-winter2001/ CS2603 Applied Logic for Hardware and Software Rex Page – University of Oklahoma
x y z F(x,y,z) minterm 0 0 0 0 0 0 1 1 x y z 0 1 0 1 x y z 0 1 1 0 1 0 0 0 1 0 1 1 x y z 1 1 0 0 1 1 1 1 x y z Examplesum-of-products representation for 3-variable function sum-of-products representation of F Truth table representation of a Boolean function F Example copied from Shaaban: http://meseec.ce.rit.edu/eecc341-winter2001/ CS2603 Applied Logic for Hardware and Software Rex Page – University of Oklahoma
x y z F(x,y,z) minterm 0 0 0 0 F(x,y,z) = x y z + x y z + x y z + x y z 0 0 1 1 x y z 0 1 0 1 x y z 0 1 1 0 1 0 0 0 1 0 1 1 x y z 1 1 0 0 1 1 1 1 x y z Examplesum-of-products representation for 3-variable function sum-of-products representation of F Truth table representation of a Boolean function F Example copied from Shaaban: http://meseec.ce.rit.edu/eecc341-winter2001/ CS2603 Applied Logic for Hardware and Software Rex Page – University of Oklahoma
x y z F(x,y,z) minterm 0 0 0 0 F(x,y,z) = x y z + x y z + x y z + x y z 0 0 1 1 x y z 0 1 0 1 x y z 0 1 1 0 1 0 0 0 1 0 1 1 x y z 1 1 0 0 1 1 1 1 x y z 3-Variable Karnaugh Mapanother representation for 3-variable function sum-of-products representation of F Truth table representation of a Boolean function F Karnaugh-map representation of F Example copied from Shaaban: http://meseec.ce.rit.edu/eecc341-winter2001/ table-based form of truth table CS2603 Applied Logic for Hardware and Software Rex Page – University of Oklahoma
x y z F(x,y,z) minterm 0 0 0 0 F(x,y,z) = x y z + x y z + x y z + x y z 0 0 1 1 x y z 0 1 0 1 x y z x = 1 xy 0 1 1 0 00 01 11 10 z 1 0 1 1 0 0 0 1 z = 1 1 1 1 0 1 1 x y z y = 1 1 1 0 0 1 1 1 1 x y z Gray-code arrangement 3-Variable Karnaugh Mapanother representation for 3-variable function sum-of-products representation of F Truth table representation of a Boolean function F Karnaugh-map representation of F Example copied from Shaaban: http://meseec.ce.rit.edu/eecc341-winter2001/ CS2603 Applied Logic for Hardware and Software Rex Page – University of Oklahoma
x y z F(x,y,z) = x y z + x y z + x y z + x y z = x y z + x z + y z minimized x y z + x y z = y z (x + x) = y z wrap-around x y z + x y z = x z x = 1 xy 00 01 11 10 z 1 0 1 • Gray-code ordering arranges it so that (n – k) variables have identical form throughout the group (xj in all terms of group or xj in all of them) 1 z = 1 1 1 y = 1 • Use the distributive law to factor the 2k minterms into this form: w = (v1 + v1)(v2 + v2) … (vk + vk) vk+1 vk+2 …vn Karnaugh-Map Minimization Method3-variable example sum-of-products representation of F Karnaugh-map representation of F Example copied from Shaaban: http://meseec.ce.rit.edu/eecc341-winter2001/ Karnaugh-map minimization method • Group together the maximal, contiguous, rectangular regions with 2k adjacent cells containing True (1) values • There is one minterm per cell, so 2k minterms in all for the group = vk+1 vk+2 …vn • Possible because Gray-code ordering puts the other k variables through all possible combinations CS2603 Applied Logic for Hardware and Software Rex Page – University of Oklahoma
d = 1 d c b a 00 01 11 10 F(a,b,c,d) = a b c d + a b c d + a b c d + a b c d + a b c d + a b c d + a b c d = a d 00 01 11 10 • Group together the maximal, contiguous, rectangular regions with 2k adjacentcells containing True (1) values 1 1 1 a = 1 1 1 1 • There is one minterm per cell, so 2k minterms in all for group + a b c b=1 • Gray-code ordering arranges it so that (n – k) variables have identical form throughout the group(xj in all terms of group or xj in all of them) 1 + b c d + a b c c = 1 • Use the distributive law to factor the 2k minterms into this form: w = (v1 + v1)(v2 + v2) … (vk + vk) vk+1 vk+2 …vn • Possible because Gray-code ordering puts the other k variables through all possible combinations 4-Variable Karnaugh-Map Example Example copied from Shaaban: http://meseec.ce.rit.edu/eecc341-winter2001/ wrap-around CS2603 Applied Logic for Hardware and Software Rex Page – University of Oklahoma
d = 1 d c b a 00 01 11 10 F(a,b,c,d) = a b c d + a b c d + a b c d + a b c d + a b c d + a b c d + a b c d + a b c d = a d 00 01 11 10 • Group together the maximal, contiguous, rectangular regions with 2k adjacentcells containing True (1) values 1 1 1 1 a = 1 + a c 1 1 1 • There is one minterm per cell, so 2k minterms in all for group + a b b=1 • Gray-code ordering arranges it so that (n – k) variables have identical form throughout the group(xj in all terms of group or xj in all of them) 1 + b c d • Use the distributive law to factor the 2k minterms into this form: w = (v1 + v1)(v2 + v2) … (vk + vk) vk+1 vk+2 …vn c = 1 • Possible because Gray-code ordering puts the other k variables through all possible combinations Another 4-Variable Example wrap-around CS2603 Applied Logic for Hardware and Software Rex Page – University of Oklahoma
d = 1 d c b a 00 01 11 10 F(a,b,c,d) = a b c d + a b c d + a b c d + a b c d + a b c d + a b c d = b d either 1 or 0 ok 1 00 01 11 10 + a d + a b • Group together the maximal, contiguous, rectangular regions with 2k adjacentcells containing True (1) values a = 1 1 1 • There is one minterm per cell, so 2k minterms in all for group b=1 • Gray-code ordering arranges it so that (n – k) variables have identical form throughout the group(xj in all terms of group or xj in all of them) 1 1 1 • Use the distributive law to factor the 2k minterms into this form: w = (v1 + v1)(v2 + v2) … (vk + vk) vk+1 vk+2 …vn c = 1 • Possible because Gray-code ordering puts the other k variables through all possible combinations Don’t Cares • Use don’t-cares to make groups bigger • reduces number of minterms and/or literals • Leave isolated don’t-cares alone • no point in adding minterms unnecessarily CS2603 Applied Logic for Hardware and Software Rex Page – University of Oklahoma
F(a,b) = a b + a b + a b a = 1 a 0 1 b 0 1 1 1 b = 1 1 • Gray-code ordering arranges it so that (n – k) variables have identical form throughout the group (xj in all terms of group or xj in all of them) • Use the distributive law to factor the 2k minterms into this form: w = (v1 + v1)(v2 + v2) … (vk + vk) vk+1 vk+2 …vn 2-Variable Karnaugh-Map Example operation = a + b Example copied from Shaaban: http://meseec.ce.rit.edu/eecc341-winter2001/ Karnaugh-map minimization method • Group together the maximal, contiguous, rectangular regions with 2k adjacent cells containing True (1) values • There is one minterm per cell, so 2k minterms in all for the group • Possible because Gray-code ordering puts the other k variables through all possible combinations CS2603 Applied Logic for Hardware and Software Rex Page – University of Oklahoma
Karnaugh-Map Minimizationsome observations • Each disjoint group containing 2k cells • Reduces number of minterms by 2k - 1 • Reduces number of literals in those minterms to n – k • Overlapping group • Reduces number of literals in some minterms • But not necessarily the the number of minterms • Method produces "minimal" circuit if • Minimum number of maximal groups covers 1s in diagram • Then: minimum number of minterms • And: minimum number of literals in minterms • Not unique … could be several ways to choose groups • Karnaugh maps mostly used for learning • Designing small digital circuits • Circuit design tools do minimization for large circuits • Quine-McClusky algorithm implements Karnaugh method Invented by Maurice Karnaugh at Bell Labs in early 1950s CS2603 Applied Logic for Hardware and Software Rex Page – University of Oklahoma
The End CS2603 Applied Logic for Hardware and Software Rex Page – University of Oklahoma