Lecture 2.5 - KMaps
Lecture 2.5 - KMaps
Lecture 2.5 - KMaps
EE-221
By Dr. Mir Yasir Umair
Associate Professor, MCS, NUST
K-Maps
Boolean Algrebra (Contd.)
3
Two-variable map
• Each block in a map is called a cell
• A cell corresponds to a row in a truth table
• Also a cell represents a minterm or a maxterm
• For the minterm place 1 and for maxterm place 0
• Multi cell areas represents a standard term
• For a 2 variable function number of blocks will be 22=4
• So for n variable function number of cells in a map 2n
4
Two-variable K-MAP
y
y0 1
x
0 x' y ' x' y
x 1 xy' xy
y y
y0 1 y0 1
x x
0 0 1
x 1 1 x 1 1 1
F2 = m1 + m2 + m3 =
F1 = xy
= x' y + xy'+ xy
5
Adjacent Cells
• Two cells are called adjacent if they differ by one literal
• m0=x1’x2’ is adjacent to m1=x1’x2
here x1 is same in both terms but x2 varies from 0 to 1
• Adjacent cells can be grouped together.
• Number of cells in a group should be in a power of 2 ie
2,4,8 etc.
6
Two-variable K-MAP
y y
y0 1 y0 1
x x
0 x' y ' x' y 0 1 Grouping (ORing) of
1’s allows
x 1 xy' xy x 1 1 1 simplification
F2 = x + y
Example 1
9
Three-Variable K-Map
Example 2
Simplify: F ( x, y, z ) = (3,4,6,7)
m0 m1 m3 m2
m4 m5 m7 m6
yz
xz ' xz '
10
Three-Variable K-Map
Example 3
Simplify: F ( x, y, z ) = (0,2,4,5,6)
m0 m1 m3 m2
m4 m5 m7 m6
11
Three-Variable K-Map
Example 3
Simplify: F ( x, y, z ) = (0,2,4,6)
m0 m1 m3 m2
m4 m5 m7 m6
12
Three-Variable K-Map
Example 4
Given: F ( A, B, C ) = A' C + A' B + AB' C + BC
m0 m1 m3 m2
m4 m5 m7 m6
14
Three-variable K-Map: Observations
15
Four-Variable K-Map
Example 5 Simplify F(w,x,y,z) = (0,1,2,4,5,6,8,9,12,13,14)
16
Four-Variable K-Map
17
Four-Variable K-Map
Example 6 Simplify F(A,B,C,D) = A' B' C '+ B' CD'+ A' BCD'+ AB' C '
A' B' C ' Represented by 0001 or 0000
18
Four-variable K-Map: Observations
19
POS
• Using Karnaugh map simplify the following Boolean expression
and give the f(A,B,C,D) = ∑m (0, 1, 2, 4, 5, 12, 14)+dc(8, 10).
F= A’C’D+B’D’+AD’
∑m (0, 1, 2, 5, 12, 14)+dc(8, 10).
B’D’ + A’C’D+ AD’
CD
AB 00 01 11 10
00 1 1 0 1
01 0 1 0 0
11 1 0 0 1
10 x 0 0 x
top
A
B
top
top
C
D top
∑m (0, 1, 2,4, 5, 12, 14)+dc(8, 10).
00 01 11 10
00 1 1 1
01 1 1
11 1 1
10 x x
∑m (0, 1, 2, 5, 12, 14)+dc(8, 10).
CD
AB 00 01 11 10
00 1 1 0 1
C’+D’
01 0 1 0 0
11 1 0 0 1
10 x 0 0 x
A’+D’
A+B’+D
F= (C’+D’)(A+B’+D)(A’+D’)
[CD+A’BD’+AD]’
(CD)’.(A’BD’)’.(AD)’
(C’+D’)(A+B’+D)(A’+D’)
Examples of Combinational Circuits
Design a logic circuit with four input variables that will only produce a 1
output when exactly three input variables are 1s.
A B C D F
0 0 0 0 0
0 0 0 1 0
0 0 1 0 0
0 0 1 1 0 CD
00 01 11 10
AB
0 1 0 0 0 00
0 1 0 1 0 01 1
0 1 1 0 0 11 1 1
0 1 1 1 1 10 1
1 0 0 0 0
1 0 0 1 0 ABC’D+A’BCD+AB’CD
1 0 1 0 0
1 0 1 1 1
1 1 0 0 0
1 1 0 1 1
1 1 1 0 1
1 1 1 1 0
Design a logic circuit that has three inputs, A, B, and C, and whose output will be HIGH
only when a majority of the inputs are HIGH.
A B C F
0 0 0 0
0 0 1 0
BC 00 01 11 10
0 1 0 0
A
0 1 1 1 m3 0 1
1 0 0 0
1 1 1 1
1 0 1 1 m5
1 1 0 1 m6
1 1 1 1m7 F=BC+AC+AB
Consider the following Figure, where an analog-to-digital converter is monitoring the
dc voltage (VB) of a 12-V storage battery on an orbiting spaceship. The converter’s
output is a four-bit binary number, ABCD, corresponding to the battery voltage in
steps of 1 V, with A as the MSB. The converter’s binary outputs are fed to a logic
circuit that is to produce a HIGH output as long as the binary value is greater than
(0110)2 = (6)10; that is, the battery voltage is greater than 6 V. Design this logic circuit.
A B C D z
CD
0 0 0 0 0 AB 00 01 11 10
0 0 0 1 0 00
0 0 1 0 0 01 1
0 0 1 1 0 11 1 1 1 1
0 1 0 0 0 10 1 1 1 1
0 1 0 1 0
0 1 1 0 0 F=A+BCD
0 1 1 1 1
1 0 0 0 1
1 0 0 1 1
1 0 1 0 1
1 0 1 1 1
1 1 0 0 1
1 1 0 1 1
1 1 1 0 1
1 1 1 1 1
Let’s design a logic circuit that controls an elevator door in a three-story building.
The circuit in Figure has four inputs. M is a logic signal that indicates when the
elevator is moving (M = 1) or stopped (M = 0). F1, F2, and F3 are floor indicator
signals that are normally LOW(0), and they go HIGH(1) only when the elevator is
positioned at the level of that particular floor. For example, when the elevator is
lined up level with the second floor, F2 = 1 and F1 = F3 = 0. The circuit output is the
OPEN signal, which is normally LOW and will go HIGH when the elevator door is to
be opened.
Conditions:
M F1 F2 F3 OPEN When elevator is moving, door should be closed
0 0 0 0 0 When elevator is stopped and is at a particular floor, door should be
opened
0 0 0 1 1 F2 F3
M F1 00 01 11 10
0 0 1 0 1
00 1 X 1
0 0 1 1 X
01 1 X X x
0 1 0 0 1
11
0 1 0 1 X
10
0 1 1 0 X
0 1 1 1 X
1 0 0 0 0 F=M’F1+M’F3 + M’F2
1 0 0 1 0
1 0 1 0 0
1 0 1 1 0
1 1 0 0 0
1 1 0 1 0
1 1 1 0 0
1 1 1 1 0
BCD to EXCESS-3 Code
BCD Excess 3
A B C D W X Y Z
0 0 0 0 0 0 1 1
0 0 0 1 0 1 0 0
0 0 1 0 0 1 0 1
0 0 1 1 0 1 1 0
0 1 0 0 0 1 1 1
0 1 0 1 1 0 0 0
0 1 1 0 1 0 0 1
0 1 1 1 1 0 1 0
1 0 0 0 1 0 1 1
1 0 0 1 1 1 0 0
1 0 1 0 X x X x
1 0 1 1 X X X X
1 1 0 0 X X X X
1 1 0 1 X X X X
1 1 1 0 X X X X
1 1 1 1 x X x X
Five-variable K-Map
A=0 A=1
DE D DE D
BC 00 01 11 10 BC 00 11 10
01
00 m0 m1 m3 m2 00 m16 m17 m19 m18
33
SOP and POS gate implementation
34
Implementation of Boolean Functions
a
b
F
35
• Implement a circuit
o 2 Level
o More than two level
o SOP
o POS
• Implement a circuit using OR and Inverter Gates only
• Implement a circuit using AND and Inverter Gates only
• Implement a circuit using NAND Gates only
• Implement a circuit using NOR Gates only
36
• Implicant
o A group of one or more 1 s’ which are adjacent and can be
combined on a Karnaugh Map is called an implicant.
• The biggest group of 1’s which can be circled to cover a
given 1 is called a prime implicant.
o They are the only implicants we care about.
37
38
39
40
Practice Example
41
Practice example
42