Switching Circuits & Logic Design Jie-Hong Roland Jiang 江介宏 Department of Electrical Engineering National Taiwan University Fall 23 5 Karnaugh Maps K-map Walks and Gray Codes http://asicdigitaldesign.wordpress.com/28/9/26/k-maps-walks-and-gray-codes/ 2
Outline Minimum forms of switching functions Two- and three-variable Karnaugh maps Four-variable Karnaugh maps Determination of minimum expressions using essential prime implicants Five-variable Karnaugh maps Other uses of Karnaugh maps Other forms of Karnaugh maps 3 Limitations of lgebraic Simplification Two problems of algebraic simplification. Not systematic 2. Difficult to check if a minimum solution is achieved The Karnaugh map method overcomes these limitations Typically for Boolean functions with 5 variables The Quine-McCluskey method can deal with even larger functions (Subject of Unit 6, skipped) 4
Minimum Forms of Switching Functions Correspondence between Boolean expressions and logic circuits SOP (POS) can be implemented with two-level ND-OR (OR-ND) gate circuits Reducing the number of terms and literals of an SOP expression corresponds to reducing the number of gates and gate inputs Combine terms by XY'+XY=X Eliminate redundant terms by consensus theorem Minimum SOP is not necessarily unique n SOP may be minimal (locally) but not minimum (globally) E.g., F = a'b'c'+a'b'c+a'bc'+ab'c+abc'+abc = a'b'+b'c+bc'+ab (minimal but not minimum) = a'b'+bc'+ac (minimum) 5 Two-Variable Karnaugh Maps 2-variable K-map B F(m ) F(m 2 ) =, B= =, B= F(m ) F(m 3 ) =, B= =, B= minterm locations B 'B' 'B ' B F F = 'B'+ 'B = '(B'+B) = ' 6
Three-Variable Karnaugh Maps 3-variable K-map 4 5 3 7 F 2 6 minterm locations F = ''+ '+ B'C'+ ' = 'B+ C'+ ' = 'B+ C' 7 Three-Variable Karnaugh Maps 3-variable K-map (zeros omitted) B ' C' 8
Three-Variable Karnaugh Maps 3-variable K-map bc a f(a,b,c) = abc'+b'c+a' 9 Three-Variable Karnaugh Maps 3-variable K-map F = m +m 3 +m 5 = M M 2 M 4 M 6 M 7 F = a'c+b'c bc a bc a simplify
Three-Variable Karnaugh Maps 3-variable K-map G = (m +m 3 +m 5 )' = (M M 2 M 4 M 6 M 7 )' G = ab+c' bc a bc a simplify Three-Variable Karnaugh Maps 3-variable K-map yz x yz x simplify xy+x'z+yz = xy+x'z (consensus theorem) 2
Three-Variable Karnaugh Maps 3-variable K-map F = a'b'+bc'+ac = a'c'+b'c+ab bc a bc a 3 Four-Variable Karnaugh Maps 4-variable K-map F = acd+a'b+d' CD B cd ab 4 2 8 5 3 9 3 7 5 2 6 4 minterm locations 4
Four-Variable Karnaugh Maps 4-variable K-map cd ab cd ab simplify f = m(,3,4,5,,2,3) f = ab'cd'+a'b'd+bc' 5 Four-Variable Karnaugh Maps 4-variable K-map cd ab cd ab simplify f 2 = m(,2,3,5,6,7,8,,,4,5) f 2 = c+b'd'+a'bd 6
Four-Variable Karnaugh Maps Simplify incompletely specified function ll the s must be covered, but X s are optional and are set to s only if they will simplify the expression cd ab cd ab X X X X simplify X X f= m(,3,5,7,9)+ d(6,2,3) f = a'd+c'd 7 Four-Variable Karnaugh Maps Simplify product-of-sums Circle s instead of s pply De Morgan s law converting SOP to POS yz wx yz wx simplify f = x'z'+wyz+w'y'z'+x'y f' = y'z + wxz'+w'xy f = (y+z')(w'+x'+z)(w+x'+y') 8
Determination of Minimum Expressions Using Essential Prime Implicants Implicant product term of a function ny single or any group of s on a K-map combined together forms a product term Prime implicant maximal implicant n implicant that cannot be combined with another term to eliminate a variable ll of the prime implicants of a function can be obtained from a K-map by expanding the s as much as possible in every possible way 9 Determination of Minimum Expressions Using Essential Prime Implicants Example cd ab a'b'c'd' ac' a'b'c, a'cd', ac' are prime implicants a'b'c'd', abc', ab'c' are implicants (but not prime implicants) a'b'c ab'c' abc' a'cd' 2
Determination of Minimum Expressions Using Essential Prime Implicants Determine all prime implicants In finding prime implicants, don t cares are treated as s. However, a prime implicant composed entirely of don t cares can never be part of the minimum solution Not all prime implicants are needed in forming the minimum SOP ab cd Example ll prime implicants: a'b'd, bc', ac, a'c'd, ab, b'cd (composed entirely of don t cares) Minimum solution: F = a'b'd+bc'+ac X X 2 Determination of Minimum Expressions Using Essential Prime Implicants Essential prime implicant (EPI) prime implicant that covers some minterm not covered by any other prime implicant If a single term covers some minterm and all of its adjacent s and X s, then the term is an EPI Must be present in the minimum SOP B B CD CD EPIs already cover all s Minimum SOP! f = CD+BD+B'C+C f= BD+B'C+C 22
Determination of Minimum Expressions Using Essential Prime Implicants SOP minimization. Select all essential prime implicants 2. Find a minimum set of prime implicants which cover the minterms not covered by the essential prime implicants There may be freedom left after all essential prime implicants are selected (it affects optimality especially for functions with more variables) CD B 'C' 'B'D' F = 'C'+ 'B'D'+CD+ 'BD or D CD 23 Determination of Minimum Expressions Using Essential Prime Implicants Flowchart for determining a minimum SOP using K-map Choose a which has not been covered That term is an essential prime implicant. Loop it Find all adjacent s and X s ll uncovered s checked? NO re the chosen and its adjacent s and X s covered by a single term? YES YES Find a minimum set of prime implicants which cover the remaining s on the map Note: ll essential prime implicants have been determined at this point NO STOP 24
Determination of Minimum Expressions Using Essential Prime Implicants Example B CD X 4 5 3 8 9 Step : 4 checked Step 2: 5 checked Step 3: 6 checked EPI 'B selected Step 4: 8 checked Step 5: 9 checked Step 6: checked EPI B'D' selected Step 7: 3 checked X 7 6 X 5 (up to this point all EPIs determined) Step 8: C'D selected to cover remaining s 25 Five-Variable Karnaugh Maps 5-var K-map These two terms do not combine DE DE 6 2 4 28 2 24 8 / 7 9 3 2 23 5 7 29 3 3 5 25 27 9 / 8 2 22 6 3 4 26 minterm locations B'DE' CDE BD' 26
Five-Variable Karnaugh Maps 5-var K-map Expand to eliminate DE Expand to eliminate E / Expand to eliminate B Expand to eliminate D Expand to eliminate C 27 Five-Variable Karnaugh Maps 5-var K-map P / DE B'C F = 'B'D'+BE'+CD+'E+ or P P 2 P 3 P 4 B'CD' Shaded s show prime implicants P 4 P 3 P 2 28
Five-Variable Karnaugh Maps 5-var K-map / DE P2 P C'E F = B'C'D'+B'C'E+'C'D'+'D+BDE+ or P P 2 P 3 P 4 P 5 C'D'E P 3 P 5 P 4 29 Other Uses of Karnaugh Maps Use K-map to prove the equivalence of two Boolean expressions K-maps are canonical representations of Boolean functions, similar to truth tables Use K-map to perform Boolean operations ND, OR, NOT operations can be done over K- maps (truth tables) 3
Other Uses of Karnaugh Maps Use K-map to facilitate factoring Identify common literals among product terms CD B F = 'B'C'+'B'D+CB+CD' = 'B'(C'+D)+C(B+D') 3 Other Uses of Karnaugh Maps Use K-map to guide simplification DE F = D+B'CDE+'B'+E' = D+B'CDE+'B'+E'+CDE = 'B'+E'+CDE / dd this term Then these two terms can be removed 32
Other Forms of Karnaugh Maps Other conventions (Veitch diagrams) C D B C B 33 Other Forms of Karnaugh Maps Other conventions (5-var K-map) F = D'E'+B'C'D'+E+''E'+CDE DE DE = = 34
Other Forms of Karnaugh Maps Other conventions (5-var Veitch diagram) F = D'E'+B'C'D'+E+''E'+CDE B E D C C 35