12
CS@VT March 2010 ©2008-10 McQuain Quine-McCluskey Computer Organization I 1 Introduction Recall that the procedure we've seen for forming a Boolean function from a truth table leads to a sum-of-products form. It's often the case that the sum-of-products form is not the simplest possible expression for the function: wxy z wxyz wxyz wxyz wxyz wxyz wxyz wz wyz xyz Clearly, the second form would require far less time to evaluate by hand, and far fewer gates if we were to implement it as a logic circuit. Fortunately, there are relatively straightforward algorithms for determining a minimal form for such an expression.

Quine-McCluskey Computer Organization I 1 CS@VT March 2010 ©2008-10 McQuain Introduction Recall that the procedure we've seen for forming a Boolean function

Embed Size (px)

Citation preview

Page 1: Quine-McCluskey Computer Organization I 1 CS@VT March 2010 ©2008-10 McQuain Introduction Recall that the procedure we've seen for forming a Boolean function

CS@VT March 2010 ©2008-10 McQuain

Quine-McCluskey

Computer Organization I

1Introduction

Recall that the procedure we've seen for forming a Boolean function from a truth table leads to a sum-of-products form.

It's often the case that the sum-of-products form is not the simplest possible expression for the function:

wxyz wxyz wxyz wxyz wxyz wxyz wx yz wz wyz xyz

Clearly, the second form would require far less time to evaluate by hand, and far fewer gates if we were to implement it as a logic circuit.

Fortunately, there are relatively straightforward algorithms for determining a minimal form for such an expression.

Page 2: Quine-McCluskey Computer Organization I 1 CS@VT March 2010 ©2008-10 McQuain Introduction Recall that the procedure we've seen for forming a Boolean function

CS@VT March 2010 ©2008-10 McQuain

Quine-McCluskey

Computer Organization I

2Quine-McCluskey Method: Representation

Represent each product in the function as a Boolean sequence, according to whether the variables or their negations occur in the product.

Recall the expression for the carry bit in the full adder we examined earlier:

~A B Cin 011 A ~B Cin 101 A B ~Cin 110 A B C 111

out in in in inC ABC ABC ABC ABC

We would represent the four product terms as:

Page 3: Quine-McCluskey Computer Organization I 1 CS@VT March 2010 ©2008-10 McQuain Introduction Recall that the procedure we've seen for forming a Boolean function

CS@VT March 2010 ©2008-10 McQuain

Quine-McCluskey

Computer Organization I

3Quine-McCluskey Method: Combining

Order the terms by the number of 1's in them; then form all the 3-term sequences you can by looking for 4-term sequences that differ in only one position.

The key is the observation that, from the axioms of a Boolean algebra:

This is sometimes known as the resolution rule.

We may use this rule to identify equivalences that simplify the expression of a Boolean function. For example:

~w*~x*~y*z + ~w*~x*y*z = ~w*~x*(~y+y)*z = ~w*~x*1*z = ~w*~x*z

or, more compactly,

0001 + 0011 = 00-1

where the hyphen is just a placeholder indicating that the value of the third variable in this term doesn’t matter.

( ) 1F G F G F G G F F

Page 4: Quine-McCluskey Computer Organization I 1 CS@VT March 2010 ©2008-10 McQuain Introduction Recall that the procedure we've seen for forming a Boolean function

CS@VT March 2010 ©2008-10 McQuain

Quine-McCluskey

Computer Organization I

4Quine-McCluskey Method: Combining

3 011 --> 3,7 -115 101 --> 5,7 1-16 110 --> 6,7 11-7 111 none

Order the terms by the number of 1's in them; then form all the 2-term sequences you can by looking for 3-term sequences that differ in only one position; note that we only need to compare each sequence to ones that have exactly one more 1 in them.

Label each term with its numeric value.

Page 5: Quine-McCluskey Computer Organization I 1 CS@VT March 2010 ©2008-10 McQuain Introduction Recall that the procedure we've seen for forming a Boolean function

CS@VT March 2010 ©2008-10 McQuain

Quine-McCluskey

Computer Organization I

5Q-M Method: Selecting Prime Implicants

3 5 6 7-------------------------3,7 -11 X X5,7 1-1 X X6,7 11- X X

Next, determine a subset of the terms that cover all of the original terms:

First, we look for columns that contain only one X. Those identify essential terms, which must be included in any solution.

In this case, that applies to all of the terms we've found.

Page 6: Quine-McCluskey Computer Organization I 1 CS@VT March 2010 ©2008-10 McQuain Introduction Recall that the procedure we've seen for forming a Boolean function

CS@VT March 2010 ©2008-10 McQuain

Quine-McCluskey

Computer Organization I

6Q-M Method: Forming the Solution

-11 B * Cin1-1 A * Cin11- A * B

Next, translate each of the included terms to the equivalent Boolean expression in terms of the original variables:

Finally, add them up to obtain a minimized form of the original function:

Cout = A * B + A * Cin + B * Cin

Page 7: Quine-McCluskey Computer Organization I 1 CS@VT March 2010 ©2008-10 McQuain Introduction Recall that the procedure we've seen for forming a Boolean function

CS@VT March 2010 ©2008-10 McQuain

Quine-McCluskey

Computer Organization I

7Quine-McCluskey Method: Outline

1. Express each minterm in n variables by a bit string of length n with the i-th position filled by 1 if x_i occurs in the expression and 0 if ~x_i occurs.

2. Group the bit strings according to the number of 1's in them.

3. Use the Resolution Rule to combine as many n-variable terms into terms containing n-1 variables as possible.

4. Continue applying the Resolution Rule to combine Boolean products into fewer variables as long as possible.

5. Find the smallest set of the resulting combined Boolean products, together with any of the original terms that were never combined with anything, so that the sum of these products represents the Boolean function.

Page 8: Quine-McCluskey Computer Organization I 1 CS@VT March 2010 ©2008-10 McQuain Introduction Recall that the procedure we've seen for forming a Boolean function

CS@VT March 2010 ©2008-10 McQuain

Quine-McCluskey

Computer Organization I

8Quine-McCluskey Method: Representation

Represent each product in the function as a Boolean sequence, according to whether the variables or their negations occur in the product.

For the example on the previous slide, the seven products would be represented as:

w x y ~z 1110 w ~x y z 1011 w ~x y ~z 1010~w x y z 0111~w x ~y z 0101~w ~x y z 0011~w ~x ~y z 0001

Page 9: Quine-McCluskey Computer Organization I 1 CS@VT March 2010 ©2008-10 McQuain Introduction Recall that the procedure we've seen for forming a Boolean function

CS@VT March 2010 ©2008-10 McQuain

Quine-McCluskey

Computer Organization I

9Quine-McCluskey Method: Combining

Order the terms by the number of 1's in them; then form all the 3-term sequences you can by looking for 4-term sequences that differ in only one position; note that we only need to compare each sequence to ones that have exactly one more 1 in them.

Label each term with its numeric value.

term F------------ 1 0001 1 --> 1,3 00-1 --> 1,5 0-01------------ 3 0011 1 --> 3,7 0-11 --> 3,11 -011 5 0101 1 --> 5,7 01-110 1010 1 --> 10,11 101- --> 10,14 1-10------------ 7 0111 1 none11 1011 1 none14 1110 1 none------------

Page 10: Quine-McCluskey Computer Organization I 1 CS@VT March 2010 ©2008-10 McQuain Introduction Recall that the procedure we've seen for forming a Boolean function

CS@VT March 2010 ©2008-10 McQuain

Quine-McCluskey

Computer Organization I

10Quine-McCluskey Method: Combining

Repeat the process with the 3-term sequences, forming 2-term sequences:

Second phase:------------1,3 00-1 --> 1,3,5,7 0--11,5 0-01 --> 1,3,5,7 0--1 (duplicate)3,7 0-11 none3,11 -011 none5,7 01-1 none10,11 101- none10,14 1-10 none

Page 11: Quine-McCluskey Computer Organization I 1 CS@VT March 2010 ©2008-10 McQuain Introduction Recall that the procedure we've seen for forming a Boolean function

CS@VT March 2010 ©2008-10 McQuain

Quine-McCluskey

Computer Organization I

11Q-M Method: Selecting Prime Implicants

----------------------------------------

Prime Coverage Map

Implicants 1 3 5 7 10 11 14

----------------------------------------

1,3,5,7 0--1 x x x x

1,3 00-1 x x

1,5 0-01 x

3,7 0-11 x x

3,11 -011 x x

5,7 01-1 x x

10,11 101- x x

10,14 1-10 x x

----------------------------------------

Essential for 14

or

Page 12: Quine-McCluskey Computer Organization I 1 CS@VT March 2010 ©2008-10 McQuain Introduction Recall that the procedure we've seen for forming a Boolean function

CS@VT March 2010 ©2008-10 McQuain

Quine-McCluskey

Computer Organization I

12Quine-McCluskey Method: Formation

Finally, translate the selected Boolean sequences back into the appropriate product terms:

0--1

1-10

101-

wz wyz wxy