0% found this document useful (0 votes)
26 views30 pages

Chapter 4

Uploaded by

2022745055
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
26 views30 pages

Chapter 4

Uploaded by

2022745055
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 30

CHAPTER 4

KARNAUGH MAPS

Objectives

 Simplifying using Karnaugh Maps

 Designing Combinatorial Logic Circuits


32 Karnaugh Maps

4.1 Karnaugh Maps

One of the easiest ways to simplify logic circuits is to use Karnaugh Map
method. Karnaugh map is a graphical representation of the output for a given
logic expression. It contains the same information as a truth table.

Although a K-Map can be used for problems involving any number of input
variables, its practical usefulness is limited to 6 variables. In this chapter, we
will limit our discussion to problems up to 4 variables only.

The K-Map contains a cell for each input combination. A logic expression or
2
truth table with n input variables has 2 cells on the K-Map. A 2 variable
2
K-Map has 2 = 4 cells. AB=00 corresponds to cell 𝐴 ⋅ 𝐵 or cell 0. AB=01
corresponds to cell 𝐴 ⋅ 𝐵 or cell 1. AB=10 corresponds to cell 𝐴 ⋅ 𝐵 or cell 2.
AB=11 corresponds to cell 𝐴. 𝐵 or cell 3.

The K-Map cells are labeled so that horizontally adjacent cells differ only in
one variable. For example, cell 𝐴 ⋅ 𝐵 (0) and cell 𝐴 ⋅ 𝐵 (2): differ only in one
variable, A. Similarly, vertically adjacent cells differ only in one variable. For
example, cell 𝐴 ⋅ 𝐵 (0) and cell 𝐴 ⋅ 𝐵 (1): differ only in one variable, B.

3
A logic expression or truth table with 3 variables has 2 = 8 cells on the K-Map.
33 Karnaugh Maps

The labeling of a 3 variable K-Map is not in counting order. They are labeled in
the order shown above: (0 1), (2 3), (6 7) and (4 5), so that horizontally and
vertically adjacent cells differ only in one variable.

Cell 𝐴. 𝐵. 𝐶 (0) and cell 𝐴. 𝐵. 𝐶 (1): only C is different


Cell 𝐴. 𝐵. 𝐶 (2) and cell 𝐴. 𝐵. 𝐶 (4): only B is different
Cell 𝐴. 𝐵. 𝐶 (0) and 𝐴. 𝐵. 𝐶 (1): only C is different
Cell 𝐴. 𝐵. 𝐶 (0) and 𝐴. 𝐵. 𝐶 (2): only B is different

Cell 𝐴. 𝐵. 𝐶 (0) and cell 𝐴. 𝐵. 𝐶 (4), are considered to be adjacent: only A is


different. The left and right side of the map are connected as if rolled into a
cylinder. The cells are labeled in the order of: (0 1 3 2), (4 5 7 6), (12 13 15 14)
and (8 9 11 10). For example, cell 0 is considered adjacent to cell 1, 4 8 and 2.
Cell 1 is adjacent to cell 0, 3, 5 and 9.

4.2 Simplification using 2 Variable K-Map

The steps in simplifying a logic expression using a K-Map:

1. Write a sum of product expression from the truth table.

2. Plot a 1 on the K-Map for each product term, or plot a 1 on the K-Map for
each output Y = 1

3. Draw loops around adjacent cells containing two 1’s on the K-Map. The
loops may overlap.
34 Karnaugh Maps

4. Repeat step 2 to 3.

5. Each loop produces a simplified product term. The minimum product term
for 2 variable map is as follows:

a. 1 cell group yield 2 variable product term


b. 2 cell group yield 1 variable product term
c. 4 cell group yield of 1 for the expression

6. Logically OR the simplified product term.

Example 1:

Shown below is an OR gate truth table. The logic expression in the form of
sum of product is = 𝐴. 𝐵 + 𝐴. 𝐵 + 𝐴. 𝐵 , which can also be written as 𝑌 =
∑(1,2,3).

1. Plot 1 on the K-Map (cell 1, 2 and 3).

2. Loop the adjacent cells. There are 2 pairs of 1’s that can be loop: cell (1 3)
and cell (2 3). Each loop contains two 1’s.

3. Each loop produces a simplified product term. The loop for cell (1 3)
produces a product term B. This can easily be proven using Boolean
algebra: 𝐴. 𝐵 + 𝐴. 𝐵 = 𝐵(𝐴 + 𝐴) = 𝐵.

4. The loop for cell (2 3) produces a product term A, that can proven using
Boolean algebra: 𝐴. 𝐵 + 𝐴. 𝐵 = 𝐴(𝐵 + 𝐵) = 𝐴.

5. Logically OR the simplified product term. The simplified Boolean


expression is 𝑌 = 𝐴 + 𝐵.
35 Karnaugh Maps

Example 2.

Shown below is an AND gate truth table. The loop for cell (0 1) produces 𝐴 .
The loop for cell (0 2) produces 𝐵. The simplified expression is 𝑌 = 𝐴 + 𝐵
which is equivalent to 𝐴. 𝐵.

Example 3.

Shown below is an XOR gate truth table. Cell 1 is not considered adjacent to
cell 2, because both variables are different. Therefore it is not possible to form
a loop. We cannot simplify the expression. So the expression is left as it is,
𝑌 = 𝐴. 𝐵 + 𝐴. 𝐵 which is equivalent to 𝑌 = 𝐴 ⊕ 𝐵.

4.3 Simplification using 3 Variable K-Map

A 3 variable K-Map allows loop containing two, four and eight 1’s. For
example, a loop containing two 1’s are: (01), (02) and (04). A loop containing
four 1’s are: (0 1 2 3), (2 3 6 7), (6 7 4 5), (0 1 4 5), (0 2 6 4) and (1 3 7 5).

Steps in simplifying a 3 variable K-Map:

1. First, draw loop around adjacent cells containing four 1s. A loop
containing many 1’s will produce a simpler product term. So, find out if
there are other possible loops containing four 1’s. The loops may overlap.

2. After finishing loops containing four 1’s, draw loops containing two 1’s.

3. Each loop produces a simplified product term. The minimum product term
for 3 variable map is as follows:

a. 1 cell group yield 3 variable product term


b. 2 cell group yield 2 variable product term
36 Karnaugh Maps

c. 4 cell group yield 1 variable product term


d. 8 cell group yield of 1 for the expression

4. Logically OR the simplified product term.

Example 1.

Write the simplified expression from the truth table shown below.

The loop for cell (0 1) produces 𝐴. 𝐵 . This can be shown algebraically


𝐴. 𝐵. 𝐶 + 𝐴. 𝐵. 𝐶 = 𝐴. 𝐵(𝐶 + 𝐶) = 𝐴. 𝐵.

The loop for cell (0 2) produces 𝐴. 𝐶 . This can be shown algebraically


𝐴. 𝐵. 𝐶 + 𝐴. 𝐵. 𝐶 = 𝐴. 𝐶(𝐵 + 𝐵) = 𝐴. 𝐶.

The simplified expression is 𝑌 = 𝐴. 𝐵 + 𝐴. 𝐶.

We can prove this using Boolean algebra:


37 Karnaugh Maps

Example 2.

Write the simplified expression from the truth table shown below. We start
with a loop containing four 1’s: cell (0 1 2 3). Next a loop containing two
1’s: cell (2 6).

Loop (0 1 2 3) produces the term 𝐴 . This can be proved as follows:

Loop (2 6) produces the term 𝐵. 𝐶.

The simplified expression is 𝑌 = 𝐴 + 𝐵. 𝐶.

Example 3.

Write the simplified expression from the truth table shown below. In this
example, there are two loops containing four 1’s.
38 Karnaugh Maps

Loop (0 2 6 4) produces 𝐶.

Loop (6 7 4 5) produces 𝐴.

The simplified expression is 𝑌 = 𝐴 + 𝐶.

Why don’t we form 3 loops containing two 1’s as shown below? A loop
containing two 1’s as shown below will produce an unsimplified expression:
𝑌 = 𝐴. 𝐶 + 𝐴. 𝐶 + 𝐴. 𝐶. This expression can be further simplified as follows:

Example 4.

The cells (0 4) on the K-map shown below can be connected forming a


cylinder. The loop for cell (0 1) produces 𝑌 = 𝐵. 𝐶.

The cells (0 1) and cell (1 4) form a loop containing four 1’s produces the term
𝑌 = 𝐵.
39 Karnaugh Maps

4.4 Simplification using 4 Variable K-Map

A 4 variable K-Map allows loop containing two, four, eight and sixteen 1’s. For
example, loops containing two 1’s are: (01), (04), (02) and (08). Loops
containing four 1’s are: (0 4 12 8), (0 1 3 2), (0 1 8 9) and (0 2 8 10). A loop
containing eight1’s are: (0 1 3 2 4 5 7 6) and (0 1 3 2 8 9 11 1 0).

Steps in simplifying a 4 variable K-Map:

1. First, draw loop around adjacent cells containing eight 1s. A loop
containing many 1’s will produce a simpler product term. So, find out if
there are other possible loops containing eight 1’s. The loops may
overlap.

2. After finishing loops containing four 1’s, draw loops containing four 1’s.
Next draw loops containing two 1’s.

3. Each loop produces a simplified product term. The minimum product term
for 4 variable map is as follows:

a. 1 cell group yield 4 variable product term


b. 2 cell group yield 3 variable product term
c. 4 cell group yield 2 variable product term
d. 8 cell group yield 1 variable product term
e. 16 cell group yield of 1 for the expression

4. Logically OR the simplified product term.


40 Karnaugh Maps

Example 1.

Write the simplified expression from the truth table shown below.

Loop (4 5 7 6) produces 𝐴. 𝐵.

Loop (5 7 13 15) produces 𝐵. 𝐷.

Loop (3 7) produces 𝐴. 𝐶. 𝐷.

The simplified expression is 𝑌 = 𝐴. 𝐵 + 𝐵. 𝐷 + 𝐴. 𝐶. 𝐷.


41 Karnaugh Maps

Example 2.

Write the simplified expression from K-Map shown below.

The loop containing eight 1’s produces the term 𝐵.

The loop containing four 1’s produces the term 𝐶. 𝐷.

The simplified expression is 𝑌 = 𝐵 + 𝐶. 𝐷.

Example 3.

Write the simplified expression from the K-Map shown below.

Connecting cell 1 and cell 9 forming a loop containing two 1’s produces the
term 𝐵. 𝐶. 𝐷.
42 Karnaugh Maps

Connecting cell (4 12) and cell (6 14) forming a loop containing four 1’s
produces the term 𝐵. 𝐷.

Connecting cells at the four edges forming a loop containing four 1’s (0 2 8 10)
produces the term 𝐵. 𝐷.

4.5 Simplifying Boolean Expression Using Karnaugh Maps.

Simplifying Boolean expression using K-Map is easier and will usually


produce a simplified expression compared to using Boolean algebra. Given a
sum of product expression, we can map each product term on the K-Map.

Example 1.

Suppose we a given a Boolean expression 𝑌 = 𝐴. 𝐵 + 𝐶 + 𝐴. 𝐵. 𝐶 instead of a


truth table. We can fill in the K-Map by taking each of product terms and
placing 1’s in the corresponding cells. The product term 𝐴. 𝐵 will occupy cell
(2 3). 𝐶 will occupy cell (1 3 7 5). 𝐴. 𝐵. 𝐶 will occupy cell (6).
43 Karnaugh Maps

Now the K-Map can be looped for simplification. The simplified expression is
𝑌 = 𝐵 + 𝐶.

Example 2:

Simplify the expression using Karnaugh Map.

First, we expand the expression in the form of Sum of Product:

Next we map each product term on the K-Map.


44 Karnaugh Maps

Looping the K-Map will produce a simplified expression


.

4.6 Designing Combinational Logic Circuit.

In chapter 3, we have discussed the three steps in designing a combinational


logic circuits:

1. Construct the truth table.


2. Write the simplified expression.
3. Draw the logic circuit.

In this chapter, we will use Karnaugh Map to simplify the expression.

Example:

The diagram shown below is a system to control three valves: Pwater, Px and
Py that will control the flow of water, liquid X and liquid Y into a tank. During
the initial state, the tank is empty. When the system starts, valve Pwater is
open to allow the flow of water. As the water level reaches level A, the next
valve Px is open to allow the flow of liquid X into the tank. When the mixture of
water + liquid X reaches level B, valve Py is open to allow the flow of liquid Y.
When it reaches level C, all valves are closed and a green light is switch on
signaling a successful operation.

The tank uses three float switches A, B and C. If any of the switches fail to
function, all valves are closed and a red light is switch on.
45 Karnaugh Maps

The input of the system are three float switches A, B and C. The outputs are
there valves Pwater, Px, Py and a green light Lh and a red light Lm. The logic
levels to represent the input and output:.

Input
Float off = 0
Float on = 1

Ouput
Valve opened = 1
Valve closed = 0
Light on = 1
Light off = 0

The system will operate as follows:

Input Output Remark


ABC = 000 Pwater=1, Px=0, Py=0, Lh=0, Lm=0 Start. Water.

ABC = 100 Pwater=1, Px=1, Py=0, Lh=0, Lm=0 Level A. Water + X.

ABC = 110 Pwater=1, Px=1, Py=1, Lh=0, Lm=0 Level B. Water + X + Y.

ABC = 111 Pwater=0, Px=0, Py=0, Lh=1, Lm=0 Level C. Close all valves.
Green light on. Success.

Others Pwater=0, Px=0, Py=0, Lh=0, Lm=1 Closed all valves. Red light
on. System failure.
46 Karnaugh Maps

The truth table:

We can simply the expression using K-Map or Boolean algebra.


47 Karnaugh Maps

The logic circuit:

A
0V Px
Pwater
B
0V

C
0V

Lm

Py

Lh

4.7 Don’t Care term on Karnaugh Map

Some logic circuits may be designed so that there are certain input conditions
for which there are no specific output levels, usually because these input
conditions will never occur. In other words, there will be certain combinations
of input, where we ‘don’t care’ whether the output is 1 or 0.

Let us consider a logic circuit that will detect an odd number from a BCD
code. BCD code are numbers from 0 to 9. Six numbers are not used by the
code: (1010, 1011, 1100,1101,1110 and 1111). These combinations are called
don’t care terms. Suppose the output Y=1 if the input is an odd number.
48 Karnaugh Maps

The truth table is as follows. There are six don’t care terms which is labeled as
X.

An X on the K-Map means that the cell can be a 1 or a 0. Cells containing 1’s
can be group together with cell containing X’s to form a bigger loop. In this
example the X’s in cell (11,13,15) is looped together around the adjacent cell’s
containing 1’s. Including X’s in a loop helps to further simplify the expression.
The X’s in cell (10, 13 and 14) are ignored. The simplified expression is 𝑌 = 𝐷.
49 Karnaugh Maps

4.8 Exercises

1. Draw the appropriate loops on the K-Map and write the simplified Boolean
expression.
50 Karnaugh Maps

2. Draw the appropriate loops on the K-Map and write the simplified Boolean
expression.
51 Karnaugh Maps
52 Karnaugh Maps
53 Karnaugh Maps
54 Karnaugh Maps

3. Draw the appropriate loops on the K-Map and write the simplified Boolean
expression.
55 Karnaugh Maps

4. Draw the appropriate loops on the K-Map and write the simplified Boolean
expression.
56 Karnaugh Maps

5. Simplify the Boolean expression using K-Map.

a. Y  A.B.C.D  A.B.C.D  ABCD  ABCD  ABCD  ABC D


b. Y  A.B.C.D  A.B.C.D  A.B.C.D  A.B.C.D  A.B.C.D  A.B.C.D
c. Y  A.B.C  A.B.C  A.B.C
d. Y  A.B.C  A.B.C  A.B.C  A.B.C

e. Y  A( B.C.D  B)  ABC  D

f. Y  ABC D  BC D  BC D  BCD

g. Y  AC  AB  A  A.B.C
h. Y  A  A.B  A.B.C
i. Y  A.B  A.B  B.C  B.C
j. Y  A.D  A.B.D  A.C.D  A.C.D

6. An earthquake can create seismic waves which is dangerous to fisherman


in open water. To warn earthquake occurrences to fishermen, Mango
Island authority decided to install an Earthquake Warning System at the
coastguard station. The earthquake is measured using the Richter scale.
Detection of earthquake is indicated by two LED and siren. The
Earthquake Warning System diagram is as follows:

Richter Scale Red LED Yellow LED Siren


0-2 OFF ON OFF
3-5 OFF ON ON
6-9 ON OFF ON

Design the logic circuit for Mango Island's Earthquake Warning System.
Your solution should include the following:

a) Truth table
b) Karnaugh map and the simplified equations
c) Logic circuit
57 Karnaugh Maps

7. The diagram below shows the system of a hot-chocolate drinks vending


machine. The vending machine offers several combinations of
hot-chocolate flavors to choose from. The following table shows the
combination of flavors based on the selection made by customers:

Example: If button 1 is selected, the hot chocolate (HC) dispenser is


activated.

Button Selection of flavors


0 No dispenser is activated
1 Hot chocolate
2 Hot chocolate + hazelnuts
3 Hot chocolate + raspberry
4 Hot chocolate + milk + hazelnuts + raspberry
5 Hot chocolate + milk + raspberry
6 Hot chocolate + milk + hazelnuts
7 Hot chocolate + milk

Flavor Dispensers
Flavor Selection Hot
Button HC Chocolate Milk Hazelnuts Raspberry
Logic Circuit

0 1 2 M
Encoder

HN
3 4 5 R

6 7

Hot chocolate drinks

Design the logic circuit. Your solution should include:

a) Truth table
b) Karnaugh Map and its simplified equations
c) Logic circuit
58 Karnaugh Maps

8. The diagram shown below is a simple mosque automation system. A logic


circuit will control the gate, fan and light. An encoder will generate a binary
number from 000 to 111 according to the prayer time as shown on the
table below.

Prayer Time Output of Ouput of Logic Circuit


Encoder Gate Fan Light Light
Hall Balcony
Subuh 5.00 am - 7.00 am 000 open on on on
7.00 am - 1.00 pm 001 open off off off
Zohor 1.00 pm - 2.00 pm 010 open on on off
2.00 pm - 4.00 pm 011 open off off off
Asar 4.00 pm - 5.00 pm 100 open on on off
5.00 pm - 7.00 pm 101 open off off off
Maghrib & Isyak 7.00 pm - 9.00 pm 110 open on on on
9.00 pm - 5.00 am 111 close off off on
Assume open = 1, close =0, on = 1, off = 0.

Design the logic circuit. Your solution should include:


a) Truth table
b) Karnaugh Map and its simplified equations
c) Logic circuit

9. The diagram shown below is a logic circuit to control the flow of water into
a tank. An encoder will generate binary numbers from 000 to 101
according to the water level. The logic circuit will function as follows:

Water level Input of Logic Circuit


Output of Logic Circuit
ABC Green Red Pipe
Below 1 000 off on on
Between 1 – 5 001 – 100 on off on
Above 5 101 off on off
59 Karnaugh Maps

water flow

Green Red
Water Level Light Light Pipe
5
4 encoder
3
2 Generate Logic
000-101
1 Circuit

float
Water tank

Design the logic circuit. Your solution must include the following:
a) Truth table
b) Karnaugh Map and its simplified equations
c) The logic circuit

10. The neutral pH for freshwater streams, lakes and pond ranges from 6 to
8. High acidity in the aquatic systems may cause harmful ecological
effects especially when the pH falls below 6 (5-0). When the pH of
freshwater becomes highly alkaline (9-14), the effects on aquatic life may
include death, and a failure to dispose of metabolic wastes. A freshwater
fish farmer installs a system that can monitor the water pH level in fish
ponds as shown in the diagram below:

The outputs of the system are three LEDs to indicate whether the water
pH is acidic, alkali or neutral:
Green LED =1 when water pH is neutral (6-8)
Red LED =1 when water pH is acidic (0-5)
Blue LED=1 when water pH is alkali (9-14)
60 Karnaugh Maps

Based on the above information, design a logic circuit. Your solution


should include the following:
a) Truth table
b) Karnaugh map and the simplified equations
c) Logic circuit

11. The diagram shown below is a wind speed system to remind the public
about the storm phenomenon.

Lamp Siren

Logic
Circuit

The logic circuit will received 3 bit binary and effect the output based on
the scale shown below:

Scale Lamp on/ Siren Explanation


0-2 Green, Siren off Normal
3-4 Yellow, Siren off Moderate wind
5-6 Red, Siren off High Speed
7 Red, Siren on High Speed, in danger

Assume that for scale: Lamp on = 1, Siren on=1.

Design the logic circuit. Your solution should include:

a) Truth table
b) Karnaugh map and the simplified equations
c) Logic circuit

You might also like