CSEE 3827: Fundamentals of Computer Systems Lecture 4 & 5 February 2 & 4, 2009 Martha Kim martha@cs.columbia.edu
Standard forms (redux)
Product and sum terms • Product term: logical AND of literals (e.g., XYZ) • Sum term: logical OR of literals (e.g., A + B + C) CSEE 3827, Spring 2009 Martha Kim 3
Minterms A B C minterm • A product term in which all variables 0 0 0 m0 ABC appear once, either complemented or uncomplemented. 0 0 1 m1 ABC 0 1 0 m2 ABC • Each minterm evaluates to 1 for 0 1 1 m3 ABC exactly one variable assignment, 0 for all others. 1 0 0 m4 ABC 1 0 1 m5 ABC • Denoted by mX where X corresponds 1 1 0 m6 ABC to the variable assignment for which mX = 1. 1 1 1 m7 ABC CSEE 3827, Spring 2009 Martha Kim 4
Sum of minterms form • The logical OR of all minterms for which F = 1. A B C minterm F 0 0 0 m0 ABC 0 0 0 1 m1 ABC 1 F = ABC + ABC + ABC 0 1 0 m2 ABC 1 = m1 + m2 + m3 0 1 1 m3 ABC 1 = ∑ m(1,2,3) 1 0 0 m4 ABC 0 1 0 1 m5 ABC 0 1 1 0 m6 ABC 0 1 1 1 m7 ABC 0 CSEE 3827, Spring 2009 Martha Kim 5
Sum of minterms form (2) • The logical OR of all minterms for which F = 1. A B C minterm F m0 m1 m2 m3 m4 m5 m6 m7 + + 1 0 0 0 0 0 0 0 0 0 0 m0 ABC 0 + + 0 0 1 m1 ABC 1 0 1 0 0 0 0 0 0 + + 0 1 0 m2 ABC 1 0 0 1 0 0 0 0 0 + + 0 1 1 m3 ABC 1 0 0 0 1 0 0 0 0 + + 1 0 0 m4 ABC 0 0 0 0 0 1 0 0 0 + + 1 0 1 m5 ABC 0 0 0 0 0 0 1 0 0 + + 1 1 0 m6 ABC 0 0 0 0 0 0 0 1 0 + + 1 1 1 m7 ABC 0 0 0 0 0 0 0 0 1 CSEE 3827, Spring 2009 Martha Kim 6
Sum of minterms form (3) • What is F in sum of minterms form? A B C minterm F 0 0 0 m0 ABC 0 0 0 1 m1 ABC 1 0 1 0 m2 ABC 1 0 1 1 m3 ABC 1 1 0 0 m4 ABC 0 1 0 1 m5 ABC 0 1 1 0 m6 ABC 0 1 1 1 m7 ABC 0 CSEE 3827, Spring 2009 Martha Kim 7
Sum of minterms form (4) • What is A(B+C) in sum of minterms form? CSEE 3827, Spring 2009 Martha Kim 8
Maxterms A B C maxterm • A sum term in which all variables appear once, either complemented or 0 0 0 M0 A+B+C uncomplemented. 0 0 1 M1 A+B+C 0 1 0 M2 A+B+C • Each maxterm evaluates to 0 for exactly one variable assignment, 1 for 0 1 1 M3 A+B+C all others. 1 0 0 M4 A+B+C 1 0 1 M5 A+B+C • Denoted by MX where X corresponds to the variable assignment for which 1 1 0 M6 A+B+C MX = 0. 1 1 1 M7 A+B+C CSEE 3827, Spring 2009 Martha Kim 9
Relationship between minterms and maxterms • Minterms and maxterms with the same subscripts are complements. mX = MX CSEE 3827, Spring 2009 Martha Kim 10
Product of maxterms form • The logical AND of all maxterms for which F = 0. A B C maxterm F 0 0 0 M0 A+B+C 0 0 0 1 M1 A+B+C 1 F = (A+B+C) (A+B+C) (A+B+C) (A+B+C) (A+B+C) 0 1 0 M2 A+B+C 1 = (M0) (M4) (M5) (M6) (M7) 0 1 1 M3 A+B+C 1 = ∏ M (0,4,5,6,7) 1 0 0 M4 A+B+C 0 1 0 1 M5 A+B+C 0 1 1 0 M6 A+B+C 0 1 1 1 M7 A+B+C 0 CSEE 3827, Spring 2009 Martha Kim 11
Product of maxterms form (2) • The logical AND of all maxterms for which F = 0. A B C maxterm F M0 M1 M2 M3 M4 M5 M6 M7 0 1 1 1 1 1 1 1 0 0 0 M0 A+B+C 0 0 0 1 M1 A+B+C 1 1 0 1 1 1 1 1 1 0 1 0 M2 A+B+C 1 1 1 0 1 1 1 1 1 0 1 1 M3 A+B+C 1 1 1 1 0 1 1 1 1 1 0 0 M4 A+B+C 0 1 1 1 1 0 1 1 1 1 0 1 M5 A+B+C 0 1 1 1 1 1 0 1 1 1 1 0 M6 A+B+C 0 1 1 1 1 1 1 0 1 1 1 1 M7 A+B+C 0 1 1 1 1 1 1 1 0 CSEE 3827, Spring 2009 Martha Kim 12
Product of maxterms form (3) • What is F in product of maxterms form? A B C maxterm F 0 0 0 M0 A+B+C 0 0 0 1 M1 A+B+C 1 0 1 0 M2 A+B+C 1 0 1 1 M3 A+B+C 1 1 0 0 M4 A+B+C 0 1 0 1 M5 A+B+C 0 1 1 0 M6 A+B+C 0 1 1 1 M7 A+B+C 0 CSEE 3827, Spring 2009 Martha Kim 13
Summary of forms F F Sum of minterms ∑ m(F = 1) ∑ m(F = 0) Product of maxterms ∏ M(F = 0) ∏ M(F = 1) CSEE 3827, Spring 2009 Martha Kim 14
POS & SOP • Sum of products (SOP): OR of ANDs e.g., F = Y + XYZ + XY • Product of sums (POS): AND of ORs e.g., G = X(Y + Z)(X + Y + Z) CSEE 3827, Spring 2009 Martha Kim 15
Relations between standard forms sum of products product of sums DeMorgan’s F F sum of minterms product of maxterms all boolean expressions CSEE 3827, Spring 2009 Martha Kim 16
Expression simplification / circuit optimization
Cost criteria • Literal cost: the number of literals in an expression • Gate-input cost: the literal cost + all terms with more than one literal + (optionally) the number of distinct, complemented single literals Roughly proportional to the number of transistors and wires in an AND/OR/NOT circuits. Does not apply, to more complex gates, for example XOR. Literal cost Gate-input cost G = ABCD + ABCD 8 8 + 2 + (4) G = (A+B)(B+C)(C+D)(D+A) 8 8 + 4 + (4) CSEE 3827, Spring 2009 Martha Kim 18
Karnaugh maps • All functions can be expressed with a map • There is one square in the map for each minterm in a function’s truth table Y X Y F X 0 1 0 0 m0 m0 m1 0 1 m1 0 XY XY 1 0 m2 m1 m3 1 1 m3 1 XY XY CSEE 3827, Spring 2009 Martha Kim 19
Karnaugh maps express functions • Fill out table with value of a function X Y F Y 0 1 X 0 0 0 0 0 1 0 1 1 1 0 1 1 1 1 1 1 1 CSEE 3827, Spring 2009 Martha Kim 20
Simplification using a k-map • Whenever two squares share an edge and both are 1, those two terms can be combined to form a single term with one less variable Y 0 1 X 0 0 1 Y Y 1 1 1 0 1 0 1 X X 0 0 1 0 0 1 F = Y + XY 1 1 1 1 1 1 Y 0 1 X F = XY + XY + XY F = X + Y 0 0 1 1 1 1 F = X + XY CSEE 3827, Spring 2009 Martha Kim 21
Simplification using a k-map (2) • Circle contiguous groups of 1s (circle sizes must be a power of 2) • There is a correspondence between circles on a k-map and terms in a function expression • The bigger the circle, the simpler the term • Add circles (and terms) until all 1s on the k-map are circled Y 0 1 X 0 0 1 1 1 1 F = X + Y CSEE 3827, Spring 2009 Martha Kim 22
Karnaugh maps: terminology • A term is an implicant if it has the value 1 for all minterms (corresponds to any circled groups of 1, 2, 4, etc. 1s on a k-map) • A term is a prime implicant if the removal of any literal makes it no longer an implicant (corresponds to circles that cannot be made any larger) • If a minterm is included in only one prime implicant, that implicant is called an essential prime implicant (corresponds to any circle that is the only one to cover a 1 on a k-map) Y 0 1 X 0 0 1 1 1 1 F = X + Y CSEE 3827, Spring 2009 Martha Kim 23
Karnaugh-map example X Y F 0 0 1 0 1 1 1 0 0 1 1 0 CSEE 3827, Spring 2009 Martha Kim 24
3-variable Karnaugh maps • Use gray ordering on edges with multiple variables • Gray encoding: order of values such that only one bit changes at a time • Two minterms are considered adjacent if they differ in only one variable (this means maps wrap) Y Z Y X 0 0 0 1 1 1 1 0 m0 m1 m3 m2 0 XYZ XYZ XYZ XYZ m4 m5 m7 m6 X 1 XYZ XYZ XYZ XYZ Z CSEE 3827, Spring 2009 Martha Kim 25
3-variable Karnaugh maps (2) • List all all of the prime implicants for this function • Is any of them an essential prime implicant? • What is a simplified expression for this function? Y Z Y X 0 0 0 1 1 1 1 0 0 1 1 0 1 X 1 1 1 1 1 Z CSEE 3827, Spring 2009 Martha Kim 26
4-variable Karnaugh maps • Extension of 3-variable maps Y Z Y WX 0 0 0 1 1 1 1 0 0 0 m0 m1 m3 m2 0 1 m4 m5 m7 m6 X 1 1 m12 m13 m15 m14 W 1 0 m8 m9 m11 m10 Z CSEE 3827, Spring 2009 Martha Kim 27
4-variable Karnaugh maps (2) • List all all of the prime implicants for this function • Is any of them an essential prime implicant? • What is a simplified expression for this function? Y Z Y WX 0 0 0 1 1 1 1 0 0 0 1 1 0 1 0 1 1 1 0 1 X 1 1 1 1 0 0 W 1 0 1 1 0 1 Z CSEE 3827, Spring 2009 Martha Kim 28
4-variable Karnaugh maps (3) • List all all of the prime implicants for this function • Is any of them an essential prime implicant? • What is a simplified expression for this function? Y Z Y WX 0 0 0 1 1 1 1 0 0 0 0 0 1 0 0 1 1 1 1 0 X 1 1 0 1 1 1 W 1 0 0 1 0 0 Z CSEE 3827, Spring 2009 Martha Kim 29
5-variable Karnaugh maps DE DE D D BC BC 0 0 0 0 0 1 1 1 1 0 0 1 1 1 1 0 0 0 m0 m1 m3 m2 0 0 m16 m17 m19 m18 0 1 m4 m5 m7 m6 0 1 m20 m21 m23 m22 C C 1 1 m12 m13 m15 m14 1 1 m28 m29 m31 m30 B B 1 0 m8 m9 m11 m10 1 0 m24 m25 m27 m26 E E A = 0 A = 1 CSEE 3827, Spring 2009 Martha Kim 30
5-variable Karnaugh map (2) • What is a simplified expression for this function? DE DE D D BC BC 0 0 0 0 0 1 1 1 1 0 0 1 1 1 1 0 0 0 0 0 1 1 0 0 0 0 1 1 0 1 1 1 1 1 0 1 1 1 0 0 C C 1 1 1 1 0 0 1 1 1 1 0 0 B B 1 0 0 1 1 0 1 0 0 1 1 0 E E A = 0 A = 1 CSEE 3827, Spring 2009 Martha Kim 31
Recommend
More recommend