Quine McCluskey Method

Download as pdf or txt
Download as pdf or txt
You are on page 1of 16
At a glance
Powered by AI
The key takeaways are that the Quine-McCluskey method is an alternative technique to Karnaugh maps that can handle more variables and can be performed manually. It works by finding common factors between min-terms to simplify Boolean expressions.

The Quine-McCluskey method is a systematic approach to simplify Boolean expressions into their sum of products form. It works by finding common factors between min-terms represented by their binary values to eliminate variables.

The Quine-McCluskey method simplifies Boolean expressions by identifying min-terms that differ by only one bit, representing a single variable. This allows that variable to be eliminated, combining the min-terms into a simplified term. It works in the same way as applying Boolean algebraic identities.

Chapter 1

Quine-McCluskey Method

This document is a DRAFT. Please email all corrections and suggestions to:

nicholas.outram@plymouth.ac.uk
with the subject heading:
QM Document.

The Karnaugh Map (KM) method of logic simplification works very well for 4
variables or less. It is quick and simple, and can be performed by hand on paper. It
can be extended to 5 variables or even more, but it becomes far less intuitive and
more error prone. An alternative technique that is logically equivalent to Karnaugh
Maps that scales to many variables is known as the Quine-McCluskey (QM) method.
This technique is tabular and can still be performed by hand on paper. It is also
relatively simple to automate with a computer. Although other computer based
techniques have since superseded it (reference), it is still a useful technique as it is
functioanally equivalent to a Karnaugh Map and can still be performed manually
on paper.
In the next section, the origins of the QM technique are demonstrated and contrasted
with the KM method to illustrate their equivalence.

1.1 Underlying principles and notation


The fundamental principle underlying both KM and QM is the following identity:

A B + A B = A (B + B) = A (1.1)
In this expression, A is the common factor. The terms A B and A B are known
as min-terms. Each min-term can be represented as a binary number, where
A B = 11b and A B = 10b. Each term can also be represented as an integer
value, where m3 = 11b and m2 = 10b (the m stands for min-term). This is also
illustrated from the truth table for this Boolean expression.

1
CHAPTER 1. QUINE-MCCLUSKEY METHOD 2

min term m A B Y
m0 0 0 0
m1 0 1 0
m2 1 0 1
m3 1 1 1

First write the two terms one above the other, and compare the Logic expression
with the binary representation.

Logic Expression min-term binary representation


AB m2 10
AB m3 11

Note that for the binary representation, the first digit is the same (1 in this case) in
both terms. This represents the common factor A. In contrast, the second digit is
dierent in each term (Band B respectively). This is the variable that is removed
using (1.1).

Where two min-terms dier by only one bit, then the terms can be
merged to form a new simplified term where one variable can be elimi-
nated.

This is illustrated in the following table.

Logic Expression min-term binary representation


AB m2 10
AB m3 11
A (m2, m3) 1-

The new simplified term is labelled (m2, m3). As will be seen later, this provides
important tractability back to the original min-terms. Note also the binary nota-
tion. The - symbol is used to mark where a variable has been removed through
simplification using (1.1). Again, this will become important later.
Note the following:

Where there is one bit dierent, it is the variable represented by the bit that
diers that is removed
This process is simply a numerical equivalent to applying the identity in (1.1)

example 1.1.1: Using the approach described above, simplify the following expres-
sion:

Y =ABC +ABC

This can also be written as:

Y = m7 + m5
CHAPTER 1. QUINE-MCCLUSKEY METHOD 3

In this simple case, it can instantly be simplified using Boolean algebra, whereby
A C (B + B) = A C. Consider the tabular approach. In the table below, the
first two rows show the binary representation of each min-term. From the binary
representation, the first and third (A and C) are equal (common factors), whereas
the second variable (B) is not common. From this, the simplified term 1-1 is
derived.

Logic Expression min-term binary representation


ABC m7 111
ABC m5 101
AC (m5,m7) 1-1

The simplified expression is therefore Y = A C . Compare this to the Karnaugh


Map for the exact same expression. Note the loop spans one column, whereby the
variables A and Care seen to be constant.

BC BC BC BC

A 0 0 0 0
0 1 3 2

A 0 1 1 0
4 5 7 6

example 1.1.2: Using a tabular method, simplify the Boolean expression Y =


ABC +ABC

Logic Expression min-term binary representation


ABC m3 011
ABC m4 010
AB (m3, m4) 01-

This time the common factor is A B and the variable C diers in the both terms.
This can again be seen in the binary representation where bit 0 (C) is the only bit
that diers. The simplified expression is therefore Y = A B
This tabular approach is equivalent to creating a loop that spans two adjacent rows
or two adjacent columns in a KM. In the next section, this principle is extended
through the repeated application of (1.1) to the remiaining terms, which is equi-
valent to creating loops that span more than 2 columns on a KM.This the full
generalised QM method.
Hopefully it is becoming clear to the reader that the KM and tablar (QM) methods
are logically equivalent. For up to 4 variables, the KM is quicker and more intuitive.
However, unlike the KM, the QM method scales well beyond 4 variables and can
still be performed manually. In the following sections, the complete QM method
will be discussed.
There are cases where both KM and QM techniques produce a unique solution and
other cases that result in multiple solutions, sometimes with equal merit. Further
CHAPTER 1. QUINE-MCCLUSKEY METHOD 4

analysis is sometimes required to find the best solution and this is discussed in
section 1.4. To help the reader, the cases with unique solutions will be considered
first.

1.2 Simplifications with unique solutions


To assist understanding, the initial focus will be on 3 or 4 variable problems so that
the reader can also compare results with Karnaugh Maps. In this section, examples
will be used to illustrate the general method.
example 1.2.1: Simplify the following expression:

Y =ABC +ABC +ABC

Y = m7 + m5 + m6

Using the same approach as above, the terms are written into a table, and where
possible, all possible terms that dier by one bit are merged.

Logic Expression min-term binary representation Number of 1s


ABC m5 101 2
ABC m6 110 2
ABC m7 111 3
AC (m5,m7) 1-1 2
AB (m6,m7) 11- 2

For reasons that will be explained later, the number of 1s in the binary represen-
tation of each term are also calculated. This time, there are two combinations of
terms that dier by 1 bit: (m7, m5) and (m7, m6). Looking at these in detail:

m5 = 101

m7 = 111

Here the two terms dier by one bit (bit 1), so the simplified term is 1 1

m6 = 110

m7 = 111

Again the two terms dier by one bit (bit 0), so the simplified term is 11
The results of these two simplifications are written at the bottom of the table (see
table above). From the table Y = A C + A B
Now consider the Karnaugh map for this case.
CHAPTER 1. QUINE-MCCLUSKEY METHOD 5

BC BC BC BC

A 0 0 0 0
0 1 3 2

A 0 1 1 1
4 5 7 6

Note there are two overlapping loops. The left loop is (m5, m7) and the right loop
is (m6, m7). It is also apparent that m7 is a common term in both expressions.
example 1.2.2:
Simplify the following expression

Y =ABC D+ABC D+ABC D+ABC D

The Karnaugh Map for this expression is as follows:

C D C D C D C D

AB 1 1 0 0
0 1 3 2

AB 1 1 0 0
4 5 7 6

AB 0 0 0 0
12 13 15 14

AB 0 0 0 0
8 9 11 10

In this simple case, a loop can be drawn around all 4 min-terms. By inspection, this
simplifies to A C. Now, consider the binary representation of the min-terms.

Logic Term min term binary representation Numbers of 1s


ABC D m0 0000 0
ABC D m1 0001 1
ABC D m4 0100 1
ABC D m5 0101 2

Looking at the binary representation, it is possible to find combinations of terms


that dier by one bit and simplify using the approach described above. The table
below lists all possible combinations.
CHAPTER 1. QUINE-MCCLUSKEY METHOD 6

Logic Term min term binary representation Numbers of 1s


ABC (m0,m1) 000- 0
AC D (m0,m4) 0-00 0
AC D (m1,m5) 0-01 1
ABC (m4,m5) 010- 1

TASK: Consider what these new simplified logic


terms mean on a Karnaugh Map. Draw the loops on
the Karnaugh Map for all the min-terms in this table

These terms represent all possible loops (spanning two rows or two columns). The
next step in the QM method is to (where possible) further combine these terms to
obtain simpler expressions.
Terms which can be combined must meet the following criteria:

They dier by only one bit


They contain the same domain of variables (therefore the - symbols must
line up)

Given the above, these terms can be combined. Some useful hints to speed up this
process are as follows:

Count the number of 1s in each term,and sort the table rows respectively
(see below)
Terms with n number of 1s can only be combined with terms with n + 1
number of 1s.

Terms that can be merged must come from the same domain1 , so look
for aligned - digits, and then from those, find the terms which are one
bit dierent.
Where they can be merged, the result will have n number of 1s

In this example the following terms can be combined

(m0, m1) and (m4, m5)


(m0, m4) and (m1, m5)

The results are shown in the following table.

Logic Term min term binary representation Numbers of 1s


ABC (m0,m1) 000- 0
AC D (m0,m4) 0-00 0
AC D (m1,m5) 0-01 1
ABC (m4,m5) 010- 1
AC (m0, m1, m4, m5) 0-0- 0
AC (m0, m4, m1, m5) 0-0- 0
1 They contain the same variables
CHAPTER 1. QUINE-MCCLUSKEY METHOD 7

Note that in this case, the two remaining terms are identical, so one can be deleted.
The process stops as there is only one term left. The final result is therefore A C.
Now, consider a more complex expression, again with only 4 variables (so the reader
can directly compare with a Karnaugh Map)
example 1.2.3:
Simplify the following expression:

Y = AB C D +AB C D +AB C D +AB C D +AB C D +AB C D

Y = m0 + m1 + m4 + m5 + m7 + m11

Draw the Karnaugh Map and we can show by inspection that the simplified expres-
sion is:

Y =AC +ABD+ABC D

C D C D C D C D

AB 1 1 0 0
0 1 3 2

AB 1 1 1 0
4 5 7 6

AB 0 0 0 0
12 13 15 14

AB 0 0 1 0
8 9 11 10

First, tabulate the terms, sorted by increasing number of 1s

Logic Term min term binary representation Numbers of 1s


ABC D m0 0000 0
ABC D m1 0001 1
ABC D m4 0100 1
ABC D m5 0101 2
ABC D m7 0111 3
ABC D m11 1011 3

Now examine the terms that have n number of 1s with terms that have n + 1
number of 1s, and look for pairs of terms that dier by one bit.
CHAPTER 1. QUINE-MCCLUSKEY METHOD 8

Logic Term min term binary representation Numbers of 1s


ABC D m0 0000 0
ABC D m1 0001 1
ABC D m4 0100 1
ABC D m5 0101 2
ABC D m7 0111 3
A B C D m11 1011 3
ABC (m0, m1) 000- 0
AC D (m0, m4) 0-00 0
AC D (m1, m5) 0-01 1
ABC (m4, m5) 010- 1
ABD (m5, m7) 01-1 2

Note that one of the terms, m11, cannot be combined. This is marked as a starred
item, meaning the term has to be kept in the final result. This can be seen on the
KM. For the next phase, repeat the procedure on the combined terms.

Logic Term min term binary representation Numbers of 1s


ABC (m0, m1) 000- 0
AC D (m0, m4) 0-00 0
AC D (m1, m5) 0-01 1
ABC (m4, m5) 010- 1
A B D (m5, m7) 01-1 2
AC (m0, m1, m4, m5) 0-0- 0
AC (m0, m4, m1, m5) 0-0- 0

The starred terms are those that cannot be combined any further. Not that
(m5, m7) is the only 3-variable term that cannot be combined with any other.
Again, this can be seen on the KM as a loop of two cells. For the simplified two-
variable results, both are identical, and using the identity X + X X, only one of
them is kept.
A table of all starred and remaining terms is created as follows:

m0 m1 m4 m5 m7 m11

ABC D X
A B D X X
AC X X X X

Using this table it is confirmed that all the original min-terms are covered. Relating
this to the Karnaugh Map, all cells with a 1 are covered by these terms. As will be
seen later, there are cases where dierent combinations of terms cover the set, but
where not all are required. Before considering these cases however, it is important
to consider the situation where dont care are included in the original truth table.
CHAPTER 1. QUINE-MCCLUSKEY METHOD 9

1.3 Simplifications with dont care terms


Some combination logic contains dont care terms, where a set of specific input
conditions are defined to never occur or where the output has no consequence. The
designer therefore has the choice to choose the actual value of the dont care terms
to aid simplification. Consider the following truth table.

A B C Y
d0 0 0 0 X
m1 0 0 1 0
m2 0 1 0 0
m3 0 1 1 0
m4 1 0 0 1
m5 1 0 1 1
d6 1 1 0 X
m7 1 1 1 1

One interpretation of this truth table is that the input combinations 000 and 111
never occur, so the output is a dont care condition. The Karnaugh Map for this
truth table is shown below. By visual inspection, the simplification is simply Y = A,
whereby the dont care term d6 is taken to be a 1 and the dont care term d0 is
defined as a 0.

BC BC BC BC

A X 0 0 0
0 1 3 2

A 1 1 1 X
4 5 7 6

Note the new notation introduced here. The dont care terms are prefixed with a d.
The tabular approach is similar to the above. First, find all possible combinations
of merged terms.

Logic Term min term binary representation Numbers of 1s


ABC d0 000 0
ABC m4 100 1
ABC m5 101 2
ABC d6 110 2
ABC m7 111 3
BC (d0, m4) -00 0
AB (m4, m5) 10- 1
AC (m4, d6) 1-0 1
AC (m5, m7) 1-1 2
AB (d6, m7) 11- 2
CHAPTER 1. QUINE-MCCLUSKEY METHOD 10

Note that all possible combinations have been considered at this stage. Also note
that all of the original terms have been combined with another. One more iteration
is be applied.

Logic Term min term binary representation Numbers of 1s



BC (d0, m4) -00 0
AB (m4, m5) 10- 1
AC (m4, d6) 1-0 1
AC (m5, m7) 1-1 2
AB (d6, m7) 11- 2
A (m4, m5, d6, m7) 1 1
A (m4, d6, m5, m7) 1 1

The term (d0, m4) cannot be combined so it is starred, The other terms are com-
bined to produce two identical results, of which only one is kept.
The remaining terms are (d0, m4) and (m4, m5, d6, m7). Now create a table of all
essential terms

m4 m5 m7
BC X
A X X X

From this table, note the following:

Only the minterm columns are included (the dont care terms do not need to
be covered by the final result).

The minterms m5 and m7 are only covered by the logic term A. Therefore,
the logic term A is compulsary.
From this table, all essential minterms are covered by the logic expression A
(m4, m5, d6, m7) so no other terms are needed.
Note also that like the KM, this logic term uses the dont care term d6 (but
not d0),
The term B C (d0, m4) is not needed as m4is already covered so the dont
care term d0 is not used (defined as a zero).
The final result is therefore Y = A

1.4 Simplifications with multiple solutions


It is not always the case that a KM or the QM method will result in one unique
solution. There may even be multiple solutions of the same merit (requiring the
same number of logical operations).In cases where this is non-trivial, further analysis
is required.
CHAPTER 1. QUINE-MCCLUSKEY METHOD 11

Consider the Karnaugh Maps shown below. Both contain the same minterms, but
two solutions of equal merit are provided. Note also that these represent the simplest
possible solutions without consideration for static hazards (there are no overlapping
loops).

Table 1.1: Alternative Karnaugh Map solutions with equal merit


BC BC BC BC

A 1 0 1 1
0 1 3 2

A 1 1 1 0
4 5 7 6
BC BC BC BC

A 1 0 1 1
0 1 3 2

A 1 1 1 0
4 5 7 6

The solutions for these maps are Y = B C + A C + A B(upper) and Y =


A C + B C + A B (lower)
Now consider the QM tabular approach.

Logic Term min term binary representation Numbers of 1s


ABC m0 000 0
ABC m2 010 1
ABC m4 100 1
ABC m3 011 2
ABC m5 101 2
ABC m7 111 3
AC (m0, m2) 0-0 0
BC (m0, m4) -00 0
AB (m2, m3) 01- 1
AB (m4, m5) 10- 1
BC (m3, m7) -11 2
AC (m5, m7) 1-1 2

From the result above, no more terms can be combined.


CHAPTER 1. QUINE-MCCLUSKEY METHOD 12

m0 m2 m3 m4 m5 m7
AC X X
BC X X
AB X X
AB X X
BC X X
AC X X

The task is now to select the optimum set of logic terms to cover all the minterms
(columns).This time, there are no starred items as no logic term exclusively covers
any minterm (in this example, all minterms are covered by two logic terms). For
such a simple case, the opimum set of logic terms could be selected by inspection.
Some possible solutions are:
Y =BC +AC +AB
Y =AC +BC +AB
Y =AC +AB+AB+AC
The first two are identical to the result from the Karnaugh Map and have equal
merit in terms of the number of logical operations. This approach is only manage-
able because this is a simple example. Such an approach would become unweildy
for problems with large numbers of variables. An analytical approach, known as
Petricks method (ref), can be used to solve for the simplest solution(s).

1.4.1 Petricks Method

Petricks method is a simple analytical solution foridentifying the simplest permuta-


tion(s) of terms that cover all minterms. In contrast to the QM method, the
underlying Boolean identity is the following:

X + XY X (1.2)

Consider the example above:

Table 1.2: Prime implicant table


m0 m2 m3 m4 m5 m7
I0 AC X X
I1 BC X X
I2 AB X X
I3 AB X X
I4 BC X X
I5 AC X X

Note that each row has been labelled I[0..9]. The next step may seem unfamiliar
to those readers with an engineering background, but is reminisent of the origins of
Boolean algebra,which is to study logic in a more philosophical context!
CHAPTER 1. QUINE-MCCLUSKEY METHOD 13

The objective is to choose a permutation of simplified terms I[0..9] (known as


Implicants) such that alll minterms {m0, m2, m3, m4, m5, m7}are covered. This
can be expressed in terms of Boolean logic:

The variable M 0 shall be deemed TRUE if m0 is included, that is I0 OR I1


are selected. This can be written as M 0 = I0 + I1

Similar rules can be written for all remaining minterms m2, m3, m4, m5, m7.

The variable Y is TRUE when M 0 AND M 2 AND M 3 AND M 4 AND M 5


AND M 5 are TRUE

This can be written more consisely as:

Y = M0 M2 M3 M4 M5 M7

Combining both rules:

Y = (I0 + I1) (I0 + I2) (I2 + I4) (I1 + I3) (I3 + I5) (I4 + I5) (1.3)

To meet the criteria that all minterms must be included, then expression for Y must
be TRUE. However, the expression for Y may also be simplified using the indentity
in equation (1.2).

Algebraic Simplification

The algebraic simplification of (1.3) requires the repeated and systematic application
of the identity (1.2).
Consider the first product of sums (I0+I1)(I0+I2) = I0+I0I2+I0I1+I1I2.
Two applications of the identity (1.2) reduces this expression as follows:

I0 + I0 I2 + I0 I1 + I1 I2 = I0 (1 + I2) + I0 I1 + I1 I2
= I0 + I0 I1 + I1 I2
= I0 (1 + I1) + I1 I2
= I0 + I1 I2

Now multiply this with the next sum

(I0 + I1 I2) (I2 + I4) = I0 I2 + I0 I4 + I1 I2 + I1 I2 I4


= I0 I2 + I0 I4 + I1 I2 (1 + I4)
= I0 I2 + I0 I4 + I1 I2
CHAPTER 1. QUINE-MCCLUSKEY METHOD 14

This process is continued until all terms in (1.3) have been included and all simpli-
fication has been applied.


I0 I2 + I0 I4+ I0 I2 I3 + I0 I1 I4+
(I1 + I3) =
I1 I2 I0 I3 I4 + I1 I2
I0 I2 I3 + I0 I1 I4 I5+
I0 I2 I3 + I0 I1 I4+
(I3 + I5) = I0 I3 I4 + I1 I2 I3+
I0 I3 I4 + I1 I2
I1 I2 I5
0 1
I0 I2 I3 + I0 I1 I4 I5+ I0 I2 I3 I5 + I0 I1 I4 I5+
@ I0 I3 I4 + I1 I2 I3+ A (I4 + I5) = I0 I3 I4 + I1 I2 I3 I4+
I1 I2 I5 I1 I2 I5

The final result is the following:


2 3
I0 I2 I3 I5
6 I0 I1 I4 I5 7
6 7
6 I1 I2 I3 I4 7 (1.4)
6 7
4 I0 I3 I4 5
I1 I2 I5

Referring to table 1.2 and the result in (1.4), there are 5 possible combinations
which cover all minterms. There are two solutions with only three implicants, which
are I0 I3 I4 and I1 I2 I5 , both of which have equal merit (so either can be
used). Taking the first as the selected solution, this is interpreted as:

To cover the set of minterms, the designer needs to select I0, I3


and I4, therefore Y = A C + A B + B C

This is one of the solutions from the KM in table 1.1(lower).

Tabular method

The algebraic application of Petricks method is cumbersome and error prone and
best perormed by a computer. However, it can also be performed using a tabular
approach. Returning to equation (1.3)

Y = (I0 + I1) (I0 + I2) (I2 + I4) (I1 + I3) (I3 + I5) (I4 + I5)

Again, consider the first product of sums

(I0 + I1) (I0 + I2) = I0 + I0 I2 + I0 I1 + I1 I2


= I0 (1 + I2) + I0 I1 + I1 I2
= I0 (1 + I1) + I1 I2
= I0 + I1 I2
CHAPTER 1. QUINE-MCCLUSKEY METHOD 15

This expression includes the first two columns of the implicant table shown below
where each implicant Ix , x = 0 . . . 5, is represented in the same way as used in the
QM method.

binary m0 m2 m3 m4 m5 m7
I0 1 X X
I1 1 X X
. I2 1 X X
I3 1 X X
I4 1 X X
I5 1 X X

Remember that rows in the same column are combined with an OR function and
all columns are combined with an AND. The product of the first two columns
(I0 + I1) (I0 + I2) = I0 + I0 I2 + I0 I1 + I1 I2 which simplifies to I0 + I1 I2
Now consider these terms using the same binary representation as used in the QM
method:

I0 = 1
I1 = 1
I2 = 1

Similarly, using the same notation as the QM method:

I0 I1 = 11
I0 I2 = 1 1
I1 I2 = 11

When terms or combined with an OR function, they are simply listed as rows in a
vector:


1
M0 = (I0 + I1) =
1

1
M2 = (I0 + I2) =
1

And by combining with the AND function

2 3 2 3
1 I0
6 1 1 7 6 I0 I2 7
M0 M1 = 6
4
7=6 7 (1.5)
11 5 4 I0 I1 5
11 I1 I2
CHAPTER 1. QUINE-MCCLUSKEY METHOD 16

Consider the first two rows of this result alongside the Boolean algebra

Binary Algebraic
1
I0 + I0 I2 = I0 (1 + I2)
1 1

[ 1] I0

Here the identity X + XY X has been applied for both representations. Using
the binary representation, this can be recognised using the following rules:

Where two rows X and Y are equal except that Y has one or more additional
term(s), then delete Y

Where two rows X and Y are identical, delete Y (or X)

Returning to the result in (1.5), application of these rules can be applied to simplify
the expression for M 0 M 1

M0 M2 first simplification second simplification


-----1 -----1 -----1
---1-1 -1-1 ---11-
----11 ----11
---11- ---11-

This can be extended to the whole expression in (1.3).

Y = (I0 + I1) (I0 + I2) (I2 + I4) (I1 + I3) (I3 + I5) (I4 + I5)

M 0 M 2 M 0 M 2
M0 M2 M0 M2 M3 M4
M3 M3 M4
-----1 -----1 -----1 ---1-- ---1-1 ----1- --11-1
----1- ---1-- ---11- -1---- -1---1 --1--- -1--11
---11- -11--1
---11-

M 0 M 2 M 0 M 2 M 3 M 0 M 2 M 3
M5 M7
M3 M4 M4 M5 M4 M5 M7
--11-1 --1--- --11-1 -1---- 1-11-1
-1--11 1----- 11--11 1----- 11--11
-11--1 -11--1 -11--1
---11- --111- -1111-
1--11- 1--11-

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy