0% found this document useful (0 votes)
11 views26 pages

Lecture-05

Jg

Uploaded by

Ahmed Mohamed
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)
11 views26 pages

Lecture-05

Jg

Uploaded by

Ahmed Mohamed
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/ 26

Lecture 05

Karnaugh Maps

Prof. Mohammed Alrahmawy

Adapted from slides by:


➔ José Nelson Amaral

Karnaugh Maps
❑ Algebraic procedures:
• Difficult to apply in a systematic way.
• Difficult to tell when you have arrived at a minimum solution.
• Easy to make mistakes
❑ Karnaugh Map:
• It is a graphical tool presented in 1953 to assist on the minimization
of logic equations.
• Similar to a truth table, a Karnaugh Map specifies a value for each
combination of inputs.
• A Kmap is a matrix consisting of rows and columns that represent the
output values of a Boolean function.
• The output values placed in each cell are derived from the minterms
of a Boolean function.
• Karnaugh map (K-map) can be used to minimize functions of up to 6
variables.
➢ K-maps for up to 4 variables are straightforward to build
➢ Building higher order K-maps (5 or 6 variable) are a bit more
cumbersome 2
Truth Table Adjacencies

These minterms are adjacent in (


they differ by only one bit).

F = A’B’ + A’B = A’(B’+B) = A’ (1)


= A’

Same idea:

F = A’B + AB = B

Keep common literal only!


3
Karnaugh-Map
❑ A K-Map is a different way to draw a truth table. It takes advantage of
adjacency

F = A’B + AB = B
Anatomy of Karnaugh Maps
K-Map of 1-Variable
A A
0 1
m0 m1
A=0 A=1

K-Map of 2-Variables

A A B
A=0,B=0 A=1,B=0 A B
B 0 1 A 0 1
0 m0 m2 0 m0 m1
B
B 1 m1 m3 A 1 m2 m3
A=0,B=1 A=1,B=1
Anatomy of Karnaugh Maps
❑ The rules of Kmap simplification are:
➢ Groupings can contain only 1s; no 0s.
➢ Groups can be formed only at right angles; diagonal groups are not
allowed.
➢ The number of 1s in a group must be a power of 2 – even if it contains a
single 1.
➢ The groups must be made as large as possible.
➢ Groups can overlap and wrap around the sides of the Kmap.

Example

6
Anatomy of 3-Variables Karnaugh Maps
B
BC00 01 11 10
A
0 000 m0 001 m1 011 m3 010 m2
A B C F
A 1 100 m4 101 m5 111 m7 110 m6
0 0 0 m0
0 0 1 m1
C
0 1 0 m2
0 1 1 m3 OR OR
C A
1 0 0 m4 C 0 A 0
AB
1 BC 1
1 0 1 m5 00 000 m0 001 m1 m0 m4
00 000 100
1 1 0 m6 01 010 m2 011 m3 01 001 m1 101 m5
B C
1 1 1 m7 11 110 m6 111 m7 m3
11 011 111 m7
A B
10 100 m4 101 m5 m2
10 010 110
m6

7
Anatomy of 3-Variables Karnaugh Maps
Example

YZ Y
X
X Y Z F 1 m0 1 m1 1 m3 1 m2
0 0 0 1 X 1 m4 0 m5 0 m7 1 m6
0 0 1 1
0 1 0 1 Z

0 1 1 1
1 0 0 1
1 0 1 0
1 1 0 1
1 1 1 0
Anatomy of 3-Variables Karnaugh Maps
Example
YZ Y
X
1 m0 1 m1 1 m3 1 m2
X 1 m4 0 m5 0 m7 1 m6
X Y Z F
0 0 0 1 Z
• In this Kmap, we see two groups:
0 0 1 1 • Green group: In the top row. It tells us that only the value of
0 1 0 1 x is significant in that group. We see that it is complemented
in that row, so this term of the reduced function is .
0 1 1 1
• Pink group:
1 0 0 1
• This is an example of a group that wraps around the
1 0 1 0 sides of a Kmap.
1 1 0 1 • It tells us that the values of x and y are not relevant to
the term of the function that is encompassed by the
1 1 1 0 group. So, this term of the reduced function is
• So The reduced function is:
Anatomy of 4-Variables Karnaugh Maps
A B C D F A A
AB
0 0 0 0 m0 CD 00 01 11 10
0 0 0 1 m1
00 0000 m0 0100 m4 1100 m12 1000 m8
0 0 1 0 m2
01 0001 m1 0101 m5 1101 m13 1001 m9
0 0 1 1 m3 D
D
0 1 0 0 m4 11 0011 m3 0111 m7 1111 m15 1011 m11
0 1 0 1 m5 C C
10 0010 m2 0110 m6 1110 m14 1010 m10
0 1 1 0 m6
0 1 1 1 m7 B
B
1 0 0 0 m8
CD C C
1 0 0 1 m9
AB
00 01 11 10
1 0 1 0 m10
00 0000 m0 0001 m1 0011 m3 0010 m2
1 0 1 1 m11
1 1 0 0 m12 01 0100 m4 0101 m5 0111 m7 0110 m6
B B
1 1 0 1 m13 11 1100 m12 1101 m13 1111 m15 1110 m14
1 1 1 0 m14 A A
10 m8 m9 m11 m10
1 1 1 1 m15 1000 1001 1011 1010

D D 10
Anatomy of 4-Variables Karnaugh Maps
W X Y Z F Example
0 0 0 0 1
0 0 0 1 1
YZ Y Y
0 0 1 0 1
WX
0 0 1 1 0 1 1 0 1
0000 m0 0001 m1 0011 m3 0010 m2
0 1 0 0 0
0 1 0 1 0 0100 m4 0101 m5 0111 m7 0110 m6 0 0 0 1
X X
0 1 1 0 1 0 0 0 0
1100 m12 1101 m13 1111 m15 1110 m14
0 1 1 1 0 W W
1 0 0 0 1 1000 m8 1001 m9 1011 m11 1010 m10 1 1 0 1
1 0 0 1 1
Z Z
1 0 1 0 1
1 0 1 1 0 K-Map has three groups :
1 1 0 0 0 • A GREEN group entirely within the Kmap at the right.
1 1 0 1 0
• A BLUE group that wraps the top and bottom.
• A PURPLE group that spans the corners.
1 1 1 0 0
Thus we have three terms in our final function:
1 1 1 1 0
Anatomy of 4-Variables Karnaugh Maps
W X Y Z F
• It is possible to have a choice as to how to pick groups within
0 0 0 0 1 a Kmap, while keeping the groups as large as possible.
0 0 0 1 1
• The (different) functions that result from the groupings below
0 0 1 0 1
are logically equivalent.
0 0 1 1 0
0 1 0 0 0
0 1 0 1 0
0 1 1 0 1
0 1 1 1 0
1 0 0 0 1
1 0 0 1 1
1 0 1 0 1
1 0 1 1 0
1 1 0 0 0
1 1 0 1 0
F=Y`Z`+W`YZ+W`XZ` F=Y`Z`+W`YZ+W`XY`
1 1 1 0 0
1 1 1 1 0
Prime Implicants

Any single 1 or group of 1s in the Karnaugh map of a function F


is an implicant of F.
A product term is called a prime implicant of F if it cannot be
combined with another term to eliminate a variable.
If a function F is represented by
A this Karnaugh Map. Which of the
following terms are implicants of
Example: 1 1 1 F, and which ones are prime
1 1 implicants of F?
D (a) AC’D’ Implicant
1 (b) BD Not an Implicant
C Implicant
1 1 (c) A’B’C’D’
(d) AC’ Prime Implicant
(e) B’C’D’ Prime Implicant
B
13
Essential Prime Implicants

A product term is an essential prime implicant of F


if there is a minterm that is only covered by that
prime implicant.
The minimal sum-of-products form of F must include
all the essential prime implicants of F.

Theorem: If a minterm mj of F and all its adjacent


minterms are covered by a single term pi, then pi
is an essential prime implicant of F.
14
Example

Express the complement f’(w,x,y,z) of the following


expression as a sum of minterms
f(w,x,y,z) = wx(y’z + yz’)

In Topic 2 we used f’(w,x,y,z) = w’ + x’ + (y’z +yz’)’


the following algebraic = w’ + x’ + (y’z)’(yz’)’
transformations to solve = w’ + x’ + (y + z’)(y’ + z)
this problem.
= w’ + x’ + yy’ + yz + z’y’ + z’z

Could it be easier with = w’ + x’ + 0 + yz + z’y’ + 0


Karnaugh Maps? = w’ + x’ + yz + y’z’
15
Example

Express the complement f’(w,x,y,z) of the following


expression as a sum of minterms
f(w,x,y,z) = wx(y’z + yz’)
w = wxy’z + wxyz’

z
x

y
16
Example
Express the complement f’(w,x,y,z) of the following
expression as a sum of minterms
f(w,x,y,z) = wx(y’z + yz’)
w = wxy’z + wxyz’

z
1
x

y
17
Example

Express the complement f’(w,x,y,z) of the following


expression as a sum of minterms
f(w,x,y,z) = wx(y’z + yz’)
w = wxy’z + wxyz’

This is the Karnaugh Map for f(w,x,y,z).


z
1
x
1 How do we build the Karnaugh Map
y
for f’(w,x,y,z)?
18
Example

If we reverse the value in each position of the Karnaugh


map of f(w,x,y,z), we obtain the Karnaugh map for
f’(w,x,y,z).
Now we can write the minimized
w form for f’(w,x,y,z) from its
Karnaugh map.
1 1 1 1
1 1 1 1
z f’(w,x,y,z) =
1 1 1 0
x
1 1 0 1

y
19
Example

If we reverse the value in each position of the Karnaugh


map of f(w,x,y,z), we obtain the Karnaugh map for
f’(w,x,y,z).
Now we can write the minimized
w form for f’(w,x,y,z) from its
Karnaugh map.
1 1 1 1
1 1 1 1
z f’(w,x,y,z) = x’
1 1 1 0
x
1 1 0 1

y
20
Example

If we reverse the value in each position of the Karnaugh


map of f(w,x,y,z), we obtain the Karnaugh map for
f’(w,x,y,z).
Now we can write the minimized
w form for f’(w,x,y,z) from its
Karnaugh map.
1 1 1 1
1 1 1 1
z f’(w,x,y,z) = x’ + w’
1 1 1 0
x
1 1 0 1

y
21
Example

If we reverse the value in each position of the Karnaugh


map of f(w,x,y,z), we obtain the Karnaugh map for
f’(w,x,y,z).
Now we can write the minimized
w form for f’(w,x,y,z) from its
Karnaugh map.
1 1 1 1
1 1 1 1
z f’(w,x,y,z) = x’ + w’ + yz
1 1 1 0
x
1 1 0 1

y
22
Example
If we reverse the value in each position of the Karnaugh
map of f(w,x,y,z), we obtain the Karnaugh map for
f’(w,x,y,z).
Now we can write the minimized
w form for f’(w,x,y,z) from its
Karnaugh map.
1 1 1 1
1 1 1 1
z f’(w,x,y,z) = x’ + w’ + yz + y’z’
1 1 1 0
x
1 1 0 1

y
23
Examples: Consensus Theorem

The following algebraic transformations is called the


consensus theorem. Prove this theorem using
– Karnaugh maps to obtain such a proof?
Algebric Proof
XY + X’Z + YZ = XY + X’Z
XY + X’Z + YZ = XY + X’Z + 1·YZ
= XY + X’Z + (X + X’)YZ
= XY + X’Z + XYZ + X’YZ
= XY + XYZ + X’Z + X’YZ
= XY(1 + Z) + X’Z(1 + Y)
= XY·1 + X’Z·1
24
= XY + X’Z
Examples: Consensus Theorem
Karnaugh Map Proof

First we need to build the Karnaugh map for the


expression:
Y
XY + X’Z + YZ
1 1
X 1 1

Z
Now we need to write the simplified expression
from the Karnaugh map.
XY + X’Z

25
END
of

Lecture 05

26

Adapted from slides by:


➔ José Nelson Amaral

You might also like