ECE 474A/57AComputer-Aided Logic Design                    Lecture 8     Qunie-McCluskey with Don’t Cares, Iterated       ...
Quine-McCluskey with Don’t CaresExample 1Step 1: Find all the prime implicants (cont’)    Compare each entry in Gi to each...
Quine-McCluskey with Don’t CaresExample 2   F = Σm(0, 3, 10, 15) + Σd(1, 2, 7, 8, 11, 14)   F        cd   ab             0...
Quine-McCluskey with Don’t Cares Example 2F = (P1+P2)(P1+P3+P4)(P2+P3+P5)(P4+P5)                        P1P1 + P1P3 + P1P4...
Iterated Consensus/Complete Sum    Consider F(x, y, z) = yz + x’y + y’z’ + xyz + x’z’    According to tabular minimization...
Iterated Consensus/Complete Sum    Typically consensus theorem used to simplify                                           ...
Iterated Consensus to Find Complete Sum        Methodology to convert SOP function to complete sum         1. Start with a...
Recursive Consensus Methodology     Break down equation until it is trivial to find complete sum            Boole’s expans...
Recursive Consensus Methodology Example 4    Started with F = a’b’ + a’bc’ + ac    Ended with CS(F) = ac + a’b’ + b’c + a’...
Constraint MatrixExample 5   F(x, y, z) = yz + x’y + y’z’ + xyz + x’z’                                                    ...
Quine-McCluskey Overview                                                   How is each step                 Are there alte...
Reduction Techniques Using Row/Col Dominance1.   Remove rows covered by “essential columns” (i.e. essential prime implican...
Reduction Techniques Using Row/Col DominanceExample 6            P2    P4                                           (1A) E...
Upcoming SlideShare
Loading in...5
×

Quine Mc-Cluskey

633

Published on

A method to reduce K-Maps - Quine Mc-Cluskey :D

Published in: Education
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
633
On Slideshare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
25
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Quine Mc-Cluskey

  1. 1. ECE 474A/57AComputer-Aided Logic Design Lecture 8 Qunie-McCluskey with Don’t Cares, Iterated Consensus, Row/Column Dominance ECE 474a/575a 1 of 39 Susan LyseckyK-map with Don’t Cares Consider F(a, b, c) = Σm(2, 4) + Σd(1, 5, 6) What should we do with the don’t cares? Include d.c. if it helps to further minimize the cover (m5, m6) Don’t need to include d.c. if it doesn’t help (better to exclude m1) bc bc bc a 00 01 11 10 a 00 01 11 10 a 00 01 11 10 0 1 3 2 0 1 3 2 0 1 3 2 0 0 X 0 1 0 0 X 0 1 0 0 X 0 1 4 5 7 6 4 5 7 6 4 5 7 6 1 1 X 0 X 1 1 X 0 X 1 1 X 0 X F = ab’c’ + a’bc’ F = ab’ + b’c + bc’ F = ab’ + bc’ How do we apply these ideas to Quine-McCluskey? ECE 474a/575a 2 of 39 Susan LyseckyQuine-McCluskey with Don’t CaresExample 1 F(a, b, c) = Σm(2, 4) + Σd(1, 5, 6)Step 1: Find all the prime implicants List all elements of on-set and don’t care set, represented as a binary number Mark don’t cares with “D” G1 (1) 001 D (2) 010 (4) 100 G2 (5) 101 D (6) 110 D ECE 474a/575a 3 of 39 Susan Lysecky 1
  2. 2. Quine-McCluskey with Don’t CaresExample 1Step 1: Find all the prime implicants (cont’) Compare each entry in Gi to each entry in Gi+1 If they differ by 1 bit, we can apply the uniting theorem and eliminate a literal If both values are don’t cares, retain “D”, otherwise no need to mark Add check to implicant to remind us that it is not a prime implicant G1 (1) 001 D G1 (1,5) -01 D no new implicants are generated – end of step 1 (2) 010 (2,6) -10 (4) 100 (4,5) 10- we have found all prime implicants G2 (5) 101 D (4,6) 1-0 (ones without check marks) (6) 110 D ECE 474a/575a 4 of 39 Susan LyseckyQuine-McCluskey with Don’t CaresExample 1Step 2: Create Prime Implicant Chart to find all essential prime implicants Minterms are added as columns in the table Prime implicants not marked as “D” are added as rows Original Equation F = Σm(2, 4) + Σd(1, 5, 6) Derived in Step1 (1,5) -01 D 2 4 (2,6) -10 (4,5) 10- (2,6) P1 (4,6) 1-0 (4,5) P2 (4,6) P3 ECE 474a/575a 5 of 39 Susan LyseckyQuine-McCluskey with Don’t CaresExample 1Step 2: Create Prime Implicant Chart to find all essential prime implicants Place “X” in a row if the prime implicant covers the minterm Essential prime implicants are found by looking for rows with a single “X” If minterm is covered by one and only one prime implicant – it’s an essential prime implicant Add essential prime implicants to the cover P1 is essential, need to include Choose between P2 and P3 to cover remaining minterm 2 4 Option 1 (2,6) P1 F = P1 + P2 F = bc’ + ab’ (4,5) P2 (4,6) P3 Option 2 F = P1 + P3 F = bc’ + ac’ ECE 474a/575a 6 of 39 Susan Lysecky 2
  3. 3. Quine-McCluskey with Don’t CaresExample 2 F = Σm(0, 3, 10, 15) + Σd(1, 2, 7, 8, 11, 14) F cd ab 00 01 11 10 Using a K-map we get 0 1 3 2 00 1 X 1 X 4 5 7 6 01 X 12 13 15 14 F = a’b’ + ac 11 1 X 8 9 11 10 2 product terms, 2 variables each 10 X X 1 Can we do just was well with Q.M.? ECE 474a/575a 7 of 39 Susan LyseckyQuine-McCluskey with Don’t CaresExample 2 F = Σm(0, 3, 10, 15) + Σd(1, 2, 7, 8, 11, 14) G0 (0) 0000 G1 (0,1) 000- G0 (0,1,2,3) 00-- G1 (1) 0001 D (0,2) 00-0 (0,2,8,10) -0-0 (2) 0010 D (0,8) -000 G1 (2,3,10,11) -01- (8) 1000 D (1,3) 00-1 G2 (3,7,11,15) --11 G2 (3) 0011 (10,11,14,15) 1-1- combined on-set (10) 1010 minterm and don’t care, drop the “D” G3 (7) 0111 D (11) 1011 D combined two don’t cares, keep the “D” (14) 1110 D These are your prime implicants G4 (15) 1111 (all smaller product terms have been combine into larger terms) ECE 474a/575a 8 of 39 Susan LyseckyQuine-McCluskey with Don’t CaresExample 2 F = Σm(0, 3, 10, 15) + Σd(1, 2, 7, 8, 11, 14) 0 3 10 15 (0,1,2,3) P1 (0,2,8,10) P2 (2,3,10,11) P3 No essentials, how do we choose? (3,7,11,15) P4 (10,11,14,15) P5 TRY PETRICKS! F = (m0)(m3)(m10)(m15) F = (P1+P2)(P1+P3+P4)(P2+P3+P5)(P4+P5) ECE 474a/575a 9 of 39 Susan Lysecky 3
  4. 4. Quine-McCluskey with Don’t Cares Example 2F = (P1+P2)(P1+P3+P4)(P2+P3+P5)(P4+P5) P1P1 + P1P3 + P1P4 + P1P2 + P2P3 + P2P4 P1F = (P1+P2P3+P2P4)(P2+P3+P5)(P4+P5) P2P4 + P2P5 + P3P4 + P3P5 + P4P5 + P5P5 P5F = (P1+P2P3+P2P4)(P2P4+P3P4+P5)F = P1P2P4+P1P3P4+P1P5+P2P2P3P4+P2P3P3P4+P2P3P5+P2P2P4P4+P2P3P4P4+P2P4P5 P2P4F = P1P3P4+P1P5+P2P3P5+P2P4 Best Options ECE 474a/575a 10 of 39 Susan Lysecky Quine-McCluskey with Don’t Cares Example 2 F = Σm(0, 3, 10, 15) + Σd(1, 2, 7, 8, 11, 14) cd cd cd ab 00 01 11 10 ab 00 01 11 10 ab 00 01 11 10 0 1 3 2 0 1 3 2 0 1 3 2 00 1 X 1 X 00 1 X 1 X 00 1 X 1 X 4 5 7 6 4 5 7 6 4 5 7 6 01 X 01 X 01 X 12 13 15 14 12 13 15 14 12 13 15 14 11 1 X 11 1 X 11 1 X 8 9 11 10 8 9 11 10 8 9 11 10 10 X X 1 10 X X 1 10 X X 1 Original K-map Q.M. Solution 1 Q.M. Solution2 F = P1P5 F=P2P4 F = a’b’ + ac F = a’b’ + ac F= b’d’ + cd ECE 474a/575a 11 of 39 Susan Lysecky Quine-McCluskey Overview How is each step Are there alternatives?Quine-McCluskey Algorithm currently done?(1) Find all prime implicants Tabular Iterated Consensus to find Minimization complete sum(2) Find all essential prime Prime Implicant Chart Constraint Matrix implicants (row with single “X”) (basically same thing except axis switched)(3) Select a minimal set of remaining Petrick’s Method Row/Column prime implicants that covers the Dominance on-set of the function ECE 474a/575a 12 of 39 Susan Lysecky 4
  5. 5. Iterated Consensus/Complete Sum Consider F(x, y, z) = yz + x’y + y’z’ + xyz + x’z’ According to tabular minimization First expanded product term into minterms yz Then start comparing pairs to determine prime implicants xyz x’yz Some of the work already done! Instead we can take existing expression and determine the complete sum ECE 474a/575a 13 of 39 Susan LyseckyIterated Consensus/Complete SumDef: A complete sum is a SOP formula composed of all prime implicants of the functionThm: A SOP formula is a complete sum if and only if (1) No term includes any other term (2) The consensus of any two terms of the formula either does not exist or is contained in some other term of the formula ECE 474a/575a 14 of 39 Susan LyseckyIterated Consensus/Complete SumWhat is consensus?In Boolean Algebra, consensus is defined as (a) xy + x’z + yz = xy + x’z x’z yz (b) (x+y)(x’+z)(y+z) = (x+y)(x’+z) bc a 00 01 11 10 0 1 3 2 0 1 1 4 5 7 6 1 1 1 xyProof: xy + x’z + yz = xy + x’z K-map shows yz already = xy + x’z + (x + x’)yz covered by other two primes = xy + x’z + xyz + x’yz = (xy + xyz) + (x’z + x’yz) = xy(1 + z) + x’z(1 + y) = xy(1) + x’z(1) = xy + x’z ECE 474a/575a 15 of 39 Susan Lysecky 5
  6. 6. Iterated Consensus/Complete Sum Typically consensus theorem used to simplify xy + x’z + yz = xy + x’z Boolean equations Removed redundant terms (x+y)(x’+z)(y+z) = (x+y)(x’+z) Ex abc + a’bd + bcd = abc + a’bd x y x’ z yz x y x’ z Ex abc’d + c’d’e + abc’e = c’(abd + d’e + abe) = c’(abd + de) y x x’ z yz y x x’ z Ex (a+b)(a’+c)(b+c) = (a+b)(a’+c) x y x’ z yz x y x’ z Ex (a+b)(c’+d)(a+c’) = cannot simplify ECE 474a/575a 16 of 39 Susan Lysecky Iterated Consensus/Complete Sum We’ll use consensus backwards Add redundant terms xy + x’z + yz = xy + x’z Generate complete sum Is SOP not a complete sum, it’s missing prime implicants Missing prime must be covered by two or more implicants x’z yz Find the term spanning these implicants (consensus term), bc find the complete sum a 00 01 11 10 0 1 3 2 0 1 1 4 5 7 6 F = xy + x’z // not a complete sum 1 1 1 xy F = xy + x’z + yz // a complete sum K-map shows yz already covered by other two primes Why is it important to start with complete sum? Better opportunity to apply absorption [x (x + y) = x] with one of the original terms to obtain simpler expression Step 1 of Quine McCluskey ECE 474a/575a 17 of 39 Susan Lysecky Quine-McCluskey Overview How is each step Are there alternatives?Quine-McCluskey Algorithm currently done?(1) Find all prime implicants Tabular Iterated Consensus to find Minimization complete sum(2) Find all essential prime Prime Implicant Chart Constraint Matrix implicants (row with single “X”) (basically same thing except axis switched)(3) Select a minimal set of remaining Petrick’s Method Row/Column prime implicants that covers the Dominance on-set of the function ECE 474a/575a 18 of 39 Susan Lysecky 6
  7. 7. Iterated Consensus to Find Complete Sum Methodology to convert SOP function to complete sum 1. Start with arbitrary SOP form 2. Add consensus pair of all terms not contained in any other term 3. Compare new terms with existing and among other new terms to see if any new consensus terms can be generated 4. Remove all terms contained in some other term Repeat 2 – 4 until no change occurs ECE 474a/575a 19 of 39 Susan Lysecky Iterated Consensus to Find Complete Sum Example 3 F = yz + x’y + y’z’ + xyz + x’z’ 1. Start with arbitrary SOP form2. Add consensus pair of all terms not contained in any other term yz + x’y = NO x’y + y’z’ = x’z’ (INCL) y’z’ + xyz = xzz’ 0, NO yz + y’z’ = yy’ 0, NO x’y + xyz = yz (INCL) y’z’ + x’z’ = NO yz + xyz = NO x’y + x’z’ = NO yz + x’z’ = x’y (INCL) xyz + x’z’ = xx’y 0, NO3. Compare new terms with existing and among other new terms to see if any new consensus terms can be generated No new terms generated4. Remove all terms contained in some other term yz + x’y + y’z’ + x’z’ yz + x’y + y’z’ + xyz + x’z’ since there is a change you will need to start again – you will find in the next iteration no change occurs ECE 474a/575a 20 of 39 Susan Lysecky Iterative vs. Recursive Iterative approach Repetitive procedure used to add new Iterated Consensus Methodology consensus terms 1. Start with arbitrary SOP form 2. Add consensus pair of all terms Recursive approach not contained in any other term Also repetitive, but we are trying to 3. Compare new terms with existing keep simplifying problem until solution and among other new terms to is easy see if any new consensus terms can be generated 4. Remove all terms contained in some other term Repeat 2 – 4 until no change occurs ECE 474a/575a 21 of 39 Susan Lysecky 7
  8. 8. Recursive Consensus Methodology Break down equation until it is trivial to find complete sum Boole’s expansion Theorem (a.k.a. Shannon Expansion) Get down to 1 term, the complete sum of this term is itself f(x1, x2, …, xn) = [x1’ f(0, x2, …, xn)] + [x1 f(1, x2, …, xn)] = [x1’ + f(1, x2, …, xn)] [x1 + f(0, x2, …, xn)] Reconstruct equation, or equation’s complete sum, using Thm 4.6.1 (Hatchel pg.138) The SOP obtained from the two complete sums F1 and F2 by the following is a complete sum for F1 F2 1. Multiply out F1 and F2 using the idempotent property (a+a=a, a a=a), distributive properties, and x x’ = 0 2. Eliminate all terms contained in some other terms ECE 474a/575a 22 of 39 Susan LyseckyRecursive Consensus MethodologyExample 4 F = a’b’ + a’bc’ + ac a=0 a=1 b’ + bc’ c Done! We are down to 1 term b=0 b=1 CS(c) = c 1 c’ CS(1) = 1 CS(c’) = c’ Now how do we put it all back together again? ECE 474a/575a 23 of 39 Susan LyseckyRecursive Consensus MethodologyExample 4 F = a’b’ + a’bc’ + ac = ABS[(a + b’ + c’) (a’ + c)] = ABS[aa’ + ac + a’b’ + b’c + a’c’ + cc’]= ABS[(b + 1) (b’ + c’)] a=0 a=1 = ABS[ac + a’b’ + b’c + a’c’]= ABS[(bb’ + bc’ + b’ + c’)] = ac + a’b’ + b’c + a’c’= ABS[(0 + bc’ + b’ + c’)] b’ + bc’ c= b’ + c’ CS(c) = c b=0 b=1 1 c’ CS(1) = 1 CS(c’) = c’CS(F1 F2) = ABS [CS(F1) CS(F2)]f(x1, x2, …, xn) = [x1’ + f(1, x2, …, xn)] [x1 + f(0, x2, …, xn)] ECE 474a/575a 24 of 39 Susan Lysecky 8
  9. 9. Recursive Consensus Methodology Example 4 Started with F = a’b’ + a’bc’ + ac Ended with CS(F) = ac + a’b’ + b’c + a’c’ Did it work? a’b’ a’bc’ a’b’ a’c’ bc bc a 00 01 11 10 a 00 01 11 10 0 1 3 2 0 1 3 2 0 1 1 1 0 1 1 1 4 5 7 6 4 5 7 6 1 1 1 ac 1 1 1 ac b’c Not a complete sum – missing Complete sum achieved some prime implicants Recursive method beneficial when dealing with larger equations Book example F = v’xyz +v’w’x + v’x’z’ + v’wxz + w’yz’ + vw’z + vwx’z ECE 474a/575a 25 of 39 Susan Lysecky Quine-McCluskey Overview How is each step Are there alternatives?Quine-McCluskey Algorithm currently done?(1) Find all prime implicants Tabular Iterated Consensus to find Minimization complete sum(2) Find all essential prime Prime Implicant Chart Constraint Matrix implicants (row with single “X”) (basically same thing except axis switched)(3) Select a minimal set of remaining Petrick’s Method Row/Column prime implicants that covers the Dominance on-set of the function ECE 474a/575a 26 of 39 Susan Lysecky Constraint Matrix Describes conditions or constraints a cover must satisfy Each column corresponds to a prime implicant Each row correspond to a minterm P1 P2 Pn M1 List of prime implicants Note: (complete sum) Similar to prime implicants M2 chart. However, this textbook List of minterms swaps the rows/cols Mm GOAL – choose minimal subset of primes where each minter form which the function is 1 is included in at least one prime of the subset Known as a “cover” ECE 474a/575a 27 of 39 Susan Lysecky 9
  10. 10. Constraint MatrixExample 5 F(x, y, z) = yz + x’y + y’z’ + xyz + x’z’ P1 P2 P3 P4 Rows are minterms: x’y x’z’ y’z’ yz yz xyz, x’yz (m0) x’y’z’ 0 1 1 0 x’y x’yz, x’yz’ (m2) x’yz’ 1 1 0 0 y’z’ xy’z’, x’y’z’ (m3) x’yz 1 0 0 1 (m7) xyz 0 0 0 1 xyz xyz (same) (m4) xy’z’ 0 0 1 0 x’z’ x’yz’, x’y’z’ Cols are prime implicants: (get these from ex3) yz + x’y + y’z’ + x’z’ ECE 474a/575a 28 of 39 Susan LyseckyConstraint MatrixExample 5 F(x, y, z) = yz + x’y + y’z’ + xyz + x’z’ P1 P2 P3 P4 Now we look for essential prime x’y x’z’ y’z’ yz implicants (m0) x’y’z’ 0 1 1 0 (m2) x’yz’ 1 1 0 0 (m3) x’yz 1 0 0 1 (m7) xyz 0 0 0 1 Singleton row (only one way to cover this minterm) (m4) xy’z’ 0 0 1 0 Must include these primes (essential) in the cover P1 P2 Remove P3 and P4 to simplify constraint matrix x’y x’z’ Remove any minterm covered by these primes (m0, m3, m7, m4) (m2) x’yz’ 1 1 Easy to see how to cover remaining minterms (QM step 3) ECE 474a/575a 29 of 39 Susan LyseckyConstraint MatrixExample 5 F(x, y, z) = yz + x’y + y’z’ + xyz + x’z’ From previous slides … P1 P2 P3 P4 x’y x’z’ y’z’ yz Solution 1 Solution 2 = P3 + P4 + P1 = P3 + P4 + P2 = y’z’ + yz + x’y = y’z’ + yz + x’z’ What happens when the solution is not so obvious? ECE 474a/575a 30 of 39 Susan Lysecky 10
  11. 11. Quine-McCluskey Overview How is each step Are there alternatives?Quine-McCluskey Algorithm currently done?(1) Find all prime implicants Tabular Iterated Consensus to find Minimization complete sum(2) Find all essential prime Prime Implicant Chart Constraint Matrix implicants (row with single “X”) (basically same thing except axis switched)(3) Select a minimal set of remaining Petrick’s Method Row/Column prime implicants that covers the Dominance on-set of the function ECE 474a/575a 31 of 39 Susan Lysecky Row Dominance (Constraint) If a row ri in a constraint matrix has all the ones of another row rj, we say ri dominates rj ri is unneeded and all dominating row can be removed Absorption property x (x + y) = x P1 P2 P3 m1 1 1 0 m2 dominates m1 m2 1 1 1 remove m2 P1 P2 P3 m1 1 1 0 ECE 474a/575a 32 of 39 Susan Lysecky Column Dominance (Variable) If column Pi has all the ones of another column Pj, and the cost of Pi is not greater than Pj, we say Pi dominates Pj The dominated column can be removed P1 P2 P3 P2 m1 1 1 0 m1 1 Assumes P2 does not cost more than P1 m2 0 1 1 m2 1 or P3 What is the cost of a column? Each prime implicant (col) corresponds to P2 dominates P1 one AND gate P2 dominates P3 Remove P1 and P3 Our Choices We could say each column = 1 gate and everyone’s the same We could include number of literal, then a prime with 5 literals cost more than 3 ECE 474a/575a 33 of 39 Susan Lysecky 11
  12. 12. Reduction Techniques Using Row/Col Dominance1. Remove rows covered by “essential columns” (i.e. essential prime implicants)2. Remove rows through row dominance (dominating row removed)3. Remove columns through column dominance (dominated column removed)Re-iterate 1-3 until no further simplification is possible ECE 474a/575a 34 of 39 Susan LyseckyReduction Techniques Using Row/Col DominanceExample 6 P1 P2 P3 P4 P5 P6 (1A) No essential columns to remove m1 1 1 1 m2 1 1 m3 1 1 m4 1 1 1 m5 1 1 m6 1 1 1 (2A) Row dominance P1 P2 P3 P4 P5 P6 m1 dominates m2 m2 1 1 m4 dominates m3 m3 1 1 m6 dominates m5 m5 1 1 Remove the dominating rows ECE 474a/575a 35 of 39 Susan LyseckyReduction Techniques Using Row/Col DominanceExample 6 Note: P6 tell us nothing, you can remove to simplify if you want P1 P2 P3 P4 P5 P6 m2 1 1 (3A) Column dominance m3 1 1 P2 dominates P1 m5 1 1 P2 dominates P3 P4 dominates P5, vice versa Remove the dominated cols P2 P4 (1A) Essential Columns m2 1 m3 1 m5 1 ECE 474a/575a 36 of 39 Susan Lysecky 12
  13. 13. Reduction Techniques Using Row/Col DominanceExample 6 P2 P4 (1A) Essential Columns m2 1 P4 only column to cover m5 m3 1 essential prime implicant = {P4} m5 1 P2 only column to cover m2, m3 essential prime implicant = {P4, P2} Simplify matrix Matrix empty – no further simplification possible Cover = P2 + P4 ECE 474a/575a 37 of 39 Susan LyseckyReduction Techniques Using Row/Col Dominance What happens when matrix cannot be simplified? No rows left We have a terminal case and solved the problem Rows left Problem is cyclic Alternative techniques such as divide-and-conquer or branch-and-bound are needed (Or guess, or use Petricks) ECE 474a/575a 38 of 39 Susan LyseckyConclusion Quine-McCluskey with Don’t Cares Alternative methods to perform Quine-McCluskey algorithm Iterated consensus (iterative and recursive) Generate a complete sum Row/Column Dominance ECE 474a/575a 39 of 39 Susan Lysecky 13

×