Quine McCluskey Method
Quine McCluskey Method
Quine McCluskey Method
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.
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.
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.
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
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.
BC BC BC BC
A 0 0 0 0
0 1 3 2
A 0 1 1 0
4 5 7 6
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.
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.
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
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.
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:
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
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 = 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
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
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.
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
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.
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.
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
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
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).
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
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).
X + XY X (1.2)
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
Similar rules can be written for all remaining minterms m2, m3, m4, m5, m7.
Y = M0 M2 M3 M4 M5 M7
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
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
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:
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)
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
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
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
Returning to the result in (1.5), application of these rules can be applied to simplify
the expression for M 0 M 1
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-