E15 – FALL 2010 – ZUCKER WORKSHEET 2A THE QUINE-MCCLUSKEY ALGORITHM Part 1: Identifying prime implicants The Quine-McCluskey Algorithm is yet another method for simplifying and optimizing the Boolean expression for a binary function. Although the algorithm is functionally identical to using Karnaugh Maps, unlike K-Maps, Quine-McCluskey can be used on functions of more than 6 variables, and more importantly, it can be automated by computers. Quine-McCluskey is a two-step process: first, we identify a sufficient set of prime implicants, and then we use a prime implicant table to reduce that set to the smallest possible number of implicants. This worksheet describes the first step. DEFINITIONS A prime implicant for a Boolean function is a product term that implies the function; that is, if the prime implicant is equal to 1, then the function is equal to 1. For instance, the function F px, y, z q xy x y z 1 1 1 1 1 1 has two prime implicants: xy and x y z . A prime implicant is said to cover a minterm when it contains a subset of the variables constituting the minterm. The prime implicant xy covers two minterms: xyz, and xyz . 1 COMBINING PRODUCT TERMS As we learned in class, prime implicants can be combined whenever they differ by a single variable and its complement. For instance, 1 1 AB C D 1 1 1 AB C D AB C pD 1 1 Dq AB C 1 1 1 1 AB C 1 1 Also as we saw in class, we can combine a particular product term with other terms more than once (because x x x). 1 1 AB C D 1 1 1 AB C D 1 AB CD 1 1 1 1 1 1 1 1 1 1 1 1 1 AB C D AB C D AB C D AB C AB C D AB CD AB C AB D 1 1 AB CD 1 The first step of the Quine-McCluskey algorithm is to repeatedly combine product terms together in a systematic fashion until no more terms can be combined. 1 E15 – FALL 2010 – ZUCKER WORKSHEET 2A EXAMPLE We begin with a function expressed as a standard sum of products. F pA, B, C, Dq Σp0, 1, 2, 5, 6, 7, 8, 9, 10, 14q A B C D A B C D A B CD A BC D A BCD A BCD AB C D AB C D AB CD ABCD 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 Now we write the minterms out in a column, grouped by the number of 1’s in each minterm. 0 ABC D 1 ABC D 2 A B CD 8 AB C D 5 A BC D 6 A BCD 9 AB C D 10 AB CD 7 A BCD 14 ABCD 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 As you can see above, the first group has zero 1’s, the second group has one in each term, the third group has two, and the fourth group has three 1’s. Next, we will try to group each term with all the terms in the next group. Every time we successfully combine two terms, we put a check mark next to them, and write the combined term over in a new column. We start by combining the first two groups. Below, we have combined p0, 1q, p0, 2q, and p0, 8q: 0 1 2 8 5 6 9 10 7 14 1 1 1 1 ABC D ABC D A B CD AB C D A BC D A BCD AB C D AB CD A BCD ABCD 1 1 1 1 1 1 1 1 1 1 X X X X 1 1 1 1 1 1 1 1 1 2 1 1 1 1 1 1 1 1 1 0, 1 A B C 0, 2 A B D 0, 8 B C D E15 – FALL 2010 – ZUCKER WORKSHEET 2A Now we can try to combine all the terms in the second group with all of the terms in the third group. The valid combinations are p1, 5q, p1, 9q, p2, 6q, p2, 10q, p8, 9q, and p8, 10q. 0 1 2 8 5 6 9 10 7 14 1 1 1 1 ABC D ABC D A B CD AB C D A BC D A BCD AB C D AB CD A BCD ABCD 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0, 1 0, 2 0, 8 1, 5 1, 9 2, 6 2, 10 8, 9 8, 10 X X X X X X X X 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ABC ABD BCD AC D BCD A CD B CD AB C AB D 1 1 1 1 1 1 1 1 1 Finally, we combine the terms in the third and fourth groups. Here the valid combinations are p5, 7q, p6, 7q, p6, 14q, and p10, 14q. 0 1 2 8 5 6 9 10 7 14 1 1 1 1 ABC D ABC D A B CD AB C D A BC D A BCD AB C D AB CD A BCD ABCD 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0, 1 0, 2 0, 8 1, 5 1, 9 2, 6 2, 10 8, 9 8, 10 5, 7 6, 7 6, 14 10, 14 X X X X X X X X X X 1 1 1 1 1 1 1 1 1 1 1 1 1 ABC ABD BCD AC D BCD A CD B CD AB C AB D A BD A BC BCD ACD 1 1 1 1 1 1 1 1 1 1 1 1 We’re now done combining the four-variable terms, but we can keep going by combining the three-variable terms into two-variable terms. Start by combining the first two groups. 3 E15 – FALL 2010 – ZUCKER WORKSHEET 2A The valid combinations are p0, 1, 8, 9q, p0, 2, 8, 10q, p0, 8, 1, 9q, and p0, 8, 2, 10q. 0 1 2 8 5 6 9 10 7 14 1 1 1 1 ABC D ABC D A B CD AB C D A BC D A BCD AB C D AB CD A BCD ABCD 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0, 1 0, 2 0, 8 1, 5 1, 9 2, 6 2, 10 8, 9 8, 10 5, 7 6, 7 6, 14 10, 14 X X X X X X X X X X 1 1 1 1 1 1 1 1 1 1 1 1 1 ABC ABD BCD AC D BCD A CD B CD AB C AB D A BD A BC BCD ACD 1 1 1 1 1 1 1 1 X X X 0, 1, 8, 9 0, 2, 8, 10 0, 8, 1, 9 0, 8, 2, 10 1 1 1 1 1 1 1 1 BC BD BC BD X X X X 1 1 1 1 Going on, we can combine some terms from the second and third groups. The valid combinations are p2, 6, 10, 14q and p2, 10, 6, 14q. 0 1 2 8 5 6 9 10 7 14 1 1 1 1 ABC D ABC D A B CD AB C D A BC D A BCD AB C D AB CD A BCD ABCD 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0, 1 0, 2 0, 8 1, 5 1, 9 2, 6 2, 10 8, 9 8, 10 5, 7 6, 7 6, 14 10, 14 X X X X X X X X X X 1 1 1 1 1 1 1 1 1 1 1 1 1 ABC ABD BCD AC D BCD A CD B CD AB C AB D A BD A BC BCD ACD 1 1 1 1 1 1 1 1 X X X X X X X X 1 0, 1, 8, 9 0, 2, 8, 10 0, 8, 1, 9 0, 8, 2, 10 2, 6, 10, 14 2, 10, 6, 14 1 BC BD BC BD CD CD 1 1 1 1 1 1 1 1 1 1 1 1 X X Now, no further combinations are possible. At this point, we go back and sum together all of the product terms without checkmarks (the ones with checkmarks have canceled out). We can ignore duplicates (because x x x). So, our original function F can be expressed as this sum of prime implicants: F pA, B, C, Dq A C D 1 1 1 A BD 4 1 A BC 1 BC 1 1 BD 1 CD 1 E15 – FALL 2010 – ZUCKER WORKSHEET 2A ...which clearly is simpler than the expression we started with. However, this expression can be reduced further. To do so, we will use a prime implicant chart – the second step of the Quine-McCluskey algorithm. EXERCISES 1. Write out the minterms for the function F pw, x, y, z q Σp5, 7, 8, 9, 10, 11, 14, 15q 2. Group the minterms by the number of 1’s in each element, in increasing order. 3. Combine product terms together as done in the previous example. When you have finished combining all the four-variable terms, see if you can combine the threevariable terms. Continue until there are no possible combinations left. 4. Express the function as a sum of the prime implicants remaining. Remember to eliminate duplicates. 5