Title: Karnaugh Maps
1Lecture 5
Karnaugh Maps One of the easiest ways to
simplify a Boolean expression is through the use
of a Karnaugh map. Let us recall the OR gate
(again!)
The general form of a 2 input Karnaugh map is
below. Note that each square differs from its
neighbouring square by changing only 1 of the
numbers- this is more important for 3 and greater
Karnaugh maps
A logic function with n variables will require 2n
squares
2To produce a simplified Boolean expression using
a K-map (1) produce the Boolean minterm (2)
plot the 1s for the ANDed variables in the
appropriate square (3) loop adjacent
(horizontal or vertical groups of 8, 4, or 2 1s
together (4) eliminate variable/complements
pairs (5) OR the remaining variables Lets use
the OR function as an example.
1. The Boolean minterm is 2
3Loop 1
3. Loop adjacent 1s
Loop 2
4. Eliminate variable/complements pairs From
loop 1 A B and A B, since A and A are variable
and complement they are eliminated. This leaves
only B. From loop 2, A B and A B, since B and B
are variable and complement they are eliminated.
This leaves only A.
5. OR the remaining variables Y A B
4- Note
- You may only loop horizontally or vertically.
This is because you are changing just one
variable at a time. You cannot loop diagonally. - Start with the highest number of squares 8, then
4 then 2. - If you have a group of 4, it is the same as
looping 4 groups of 2. (Can you see where the 4
doublets are?) - You can loop the same 1 more than once in fact
you can do this often.
5Consider the case of a 3 input K map. In this
case we have A, B and C which are grouped into
the 4 possible AB combinations x 2 possible
C combinations. Therefore the K map will have 8
squares
Consider the truth table. Step 1. Minterm Y
6Step 2. Mark 1s in the appropriate squares
Step 3. Loop 8, 4 or 2, adjacent 1s.
Step 4. Eliminate variable/complements pairs
Step 5. OR remaining variables
7Check 1 Do we always get a 1 when C
1 Do we always get a 1 when A B 1
8Check 2 Can we simplify the original minterm
expression to get the same answer. Y A B C
A B C A B C A B C A B C
9As the number of variables increases K maps
become very useful. Consider the case of a 4
variable input (A,B,C and D). There are 4
possible AB combinations x 4 possible CD
combinations so the K map will have 16 squares.
Fill in the possible arrangements
AB
CD
Pick any square and going vertically or
horizontally we only change one variable at a
time.
10Note the pattern 0 0 ? 0 1 ? 1 1 ? 1 0 We are
changing one bit at a time. This single variable
change is called adjacency. The bit in the
sequence is 0 0 - which is the same as the first
bit. This is important when considering special
looping arrangements
11Exercise 5.1 Use this 4 input truth table.
Step 1. Write out the unsimplified Boolean
minterm
12Step 2. Mark 1s in the appropriate squares
Step 3. Loop 8, 4 or 2 adjacent 1s.
Step 4. Eliminate variable/complements pairs
Step 5. OR remaining variables
13Check Do you get a 1 when D 1 or when A B C
1
14Lecture 6
K maps can have some unusual looping
arrangements. You should prove to yourself that
the K map for the expression Y A B C D A
B C D A B C D A B C D A B C D
is given below
15Loop 1 B and B - eliminate A, C, D - keep
1
1
1
1
1
Loop 2 B and B - eliminate A, C, D - keep
Is loop 3 permitted???? NO
16Why can we not loop on a diagonal or a group of
3??
17So the original expression can be simplified to
Y A C D A C D A B C D But we can
combine the first 2 terms here to give
18This grouping is equivalent to
19Other interesting looping arrangements are
1
1
No change
1
Eliminate A and A gives B and C
1
1
1
201
1
1
1
21You should prove that looping (i) vertically and
(ii) horizontally gives the same result.
A B
A B
A B
C D
1
1
C D
C D
1
1
C D
22- We can come to some conclusions about the
structure of K maps. For a 3 variable K map - a 1 cell group yields a 3 variable product term
- a 2 cell group yields a 2 variable product term
- a 4 cell group yields a 1 variable product term
- a 8 cell group yields a value of 1 for the
expression - Example. What logic expression do we get from
these K maps?
1
1
1
1
1
1
1
1
23This allows us to regard different parts of the K
map to be associated with different variables.
A
A
B
B
B
24- For a 4 variable K map
- a 1 cell group yields a 4 variable product term
- a 2 cell group yields a 3 variable product term
- a 4 cell group yields a 2 variable product term
- a 8 cell group yields a 1 variable product term
- a 16 cell group yields a value of 1 for the
expression
25Similar to a 3 variable to a map we can regard
different parts of the K map to be associated
with different variables.
26Some formal definitions A literal is a variable
either complemented or not complemented. Example
A, B and D Normal product term is a product of
terms in which no variable appears more than
once. Example AB or ACD. An example of a
non-normal product term would be ACC
27- An implicant is a normal product term that
implies Y 1. For example if Y AB BC, the
implicants are AB and BC. - A prime implicant (PI) is one that is not a
subset of another implicant. - In a K map a PI is the largest possible grouping
allowed. - E.g a group of 4 will be a PI whereas the two
groups of 2 will only be implicants. - A distinguished 1-cell is a cell that is covered
by only one PI. - In a K-map, such cells are 1s that are circled
once. - An essential prime implicant is a PI if it
includes a 1 that is not included in any other
prime implicant. -
- For a K map the EPIs must include the PIs
associated with a distinguished 1 cells.
28- 5. A minimal sum is a SOP expression such that no
SOP expression of Y has fewer product terms. -
- It will include the EPIs but MUST also include
whatever number of other terms to make sure that
all the 1s have been covered.
29- The best way to examine these terms is by means
of an example. Using the information in the K-map
to determine - the number and list of PIs,
- The distinguished 1-cells,
- the EPIs and
- the minimal sum.
30So we can write Y as Y This SOP
expression contains 5 terms these are the 5
implicants. What we want to see is if it is
possible to write out another expression for Y
but which has fewer terms.
31- the PIs,
- The distinguished 1-cells,
- the EPIs and
- the minimal sum.
32Recall that Y Now Ymin A C D A C D
other terms???? The key point was the
distinguished 1-cells are also EPI and the EPI
will form part of the minimal sum. We must
check whether using the EPIs alone is sufficient
so that all the 1s are covered. Answer NO we
must add an extra term/s but which one?? Add
BCD to the EPIs to give the minimal sum
33- Exercise 6.1. Here is a slight variation from the
previous example. Using the information in the
K-map to determine - the number and list of PIs,
- The distinguished 1-cells,
- the EPIs and
- the minimal sum.
34- the PIs,
- The distinguished 1-cells,
- the EPIs and
- the minimal sum.
35In each of the 3 maps the location of the EPI
have been circled How do we know that theses are
EPIs? They are the PIs associated with a
distinguished 1 cell. So the minimal sum will
include these two terms. How many ways is it
possible to group together the other 1s present
using as small a number of groups as possible??
36So the minimal sum will include these two terms.
Do these two terms cover all the 1s
present? If YES then the the minimal sum is
just the EPIs If NO then we need to add the
minimal number of extra terms How many ways is
it possible to group together the other 1s
present using as small a number ofgroups as
possible??
37The previous example showed that that there are 3
ways to ensure that all the 1s are covered so
there are three possible ways to write out the
the minimal sum Ymin A B C A C D
Ymin A B C A C D Ymin A B C
A C D Each of these uses 4 terms. The
original expression used 6. This means that
there exist expressions with 5 PI but they do not
form a minimal sum.
38- Exercise 6.2 Using the information in the K-map
to determine - the number and lists of PIs,
- The distinguished 1-cells,
- the EPIs and
- the minimal sum.
1
1
1
1
1
1
1
1
1
39- the PIs,
- The distinguished 1-cells,
- the EPIs and
- the minimal sum.
40Lecture 7
We can write the minterm as
Since it consist of terms from rows
4 and 7 it can also be written as S A,B,C (4,7)
S (4,7). This is known as the canonical sum of
the logic function and the elements within the
sum make up the minterm list and mans the sum of
the minterms 4 and 7 with variables A,B and C.
Remember this is the sum-of-products. In
the case of 3 input K map the cell numbers are
Y A B C A B C
41What are the cell numbers associated with the 4
variable K map.
42(No Transcript)
43Exercise 7.1. Look at the K map below. Write
out an canonical sum for Y?
44- Exercise 7.2
- This system has four inputs and one outputs.
The first two inputs A and B represent a 2-bit
binary number in the range of 0 to 3. A second
binary number (in the same range) is represented
by the other two outputs, C and D. - The output F is to be 1 if and only if the
second number is larger than the first number. - Show a truth table for F and write down the
unsimplifed Boolean expression. - Show F on a Karnaugh map and find a simplified
expression for F.
45(No Transcript)
46The final aspect of K maps is the dont care
condition. To produce a decimal signal for the
numbers 0-9 we need to know the binary
equivalents.
47From the truth table binary numbers 0000 to 1001
represent 0 to 9. (This is a 4 bit weighted
code and is correctly known as the 8421 BCD code
binary coded decimal). The truth table shows
that possible values such as 1010 etc are
possible but these would not lie in the range
0-9. These six combinations are called Dont
cares when plotted on a Karnaugh map using an
X We may allow the Xs to be 1 or 0 depending on
our needs. In the example above, suppose to
prevent using these 6 additional number we wish
to stop when the BCD count reaches 9. The
Boolean expression for this is D C B A (remember
that A B B A).
48 The 6 dont cares are marked with an X which
could me that they could be 0 or 1.
We can then loop around, 8, 4 or 2 adjacent 1s
and since the Xs could be 1s we loop around them
and then proceed as normally. So the simplified
expression is Y D A
49 An interesting question. Why do we not loop
like this as well. Answer. Firstly it
does not cover a 1 and secondly it would add an
extra term AB
50Exercise 7.3 Simplify the logic function given
by f S (1, 3, 7, 8, 9, 10, 12, 13, 14,
15) How would your answer change if
the function to be minimised had dont care
conditions D (4, 5, 11).
51(No Transcript)