You are on page 1of 17

Karnaugh Maps (K-map)

Alternate representation of a truth table


Red decimal = minterm value
Note that A is the MSB for this minterm numbering
Adjacent squares have distance = 1
Valuable tool for logic minimization
Applies most Boolean theorems & postulates
automatically (when procedure is followed)
B
A 0 1 B
0 01 2-variable 01
form 1 23 form 2 23
1 K-Maps A

C. E. Stroud Combinational Logic Minimization 1


(9/12)
Karnaugh Maps (K-map)
Alternate forms of 3-variable K-maps
Note end-around adjacency C
Distance = 1 AB 0 1
Note: A is MSB, C is LSB for minterm 00 01
numbering 23
BC 01
A 00 01 11 10 11
67
form 1 0 01 32 45
10
1 4 5 7 6
C
B
01
23
form 2 01 32 B
A 45 76
67
A 45
C
C. E. Stroud Combinational Logic Minimization 2
(9/12)
K-mapping & Minimization Steps
Step 1: generate K-map
Put a 1 in all specified minterms
Put a 0 in all other boxes (optional)
Step 2: group all adjacent 1s without including any 0s
All groups (aka prime implicants) must be rectangular and
contain a power-of-2 number of 1s
1, 2, 4, 8, 16, 32,
An essential group (aka essential prime implicant) contains
at least 1 minterm not included in any other groups
A given minterm may be included in multiple groups
Step 3: define product terms using variables common to
all minterms in group
Step 4: sum all essential groups plus a minimal set of
remaining groups to obtain a minimum SOP
C. E. Stroud Combinational Logic Minimization 3
(9/12)
K-map Minimization Example
Z=A,B,C(1,3,6,7) Note: this group not needed
Recall SOP minterm since 1s are already covered
implementation
8 gates BC Row
27 gate I/O A 00 01 11 10 A B C Z value
K-map results 0 0 01 1 1 0 0 0 0 0 0
32
4 gates 76 0 0 1 1 1
11 gate I/O
1 0 45 0 1 1
0 1 0 0 2
essential prime
0 1 1 1 3
implicants
A A AC 1 0 0 0 4
1 0 1 0 5
C Z=AC + AB
B 1 1 0 1 6
1 1 1 1 7
AB
C. E. Stroud Combinational Logic Minimization 4
(9/12)
K-map Minimization Goals
Larger groups:
Smaller product terms Alternate method:
Fewer variables in common
Group 0s
Smaller AND gates Could produce
In terms of number of inputs fewer and/or
Fewer groups: smaller product
terms
Fewer product terms Invert output
Fewer AND gates
Use NOR instead
Smaller OR gate of OR gate
In terms of number of inputs

C. E. Stroud Combinational Logic Minimization 5


(9/12)
4-variable K-maps
Note adjacency of 4 corners as well as sides
Variable ordering for this minterm numbering: ABCD
CD C
AB 00 01 11 10
00 01 32 01 32
45 76 45 76
01
B
11
12 13 15 14 12 13 15 14
89 11 10
A 89 11 10
10

D
form 1 form 2

C. E. Stroud Combinational Logic Minimization 6


(9/12)
5-variable K-map
Note adjacency between maps when overlayed
distance=1
Variable order for this minterm numbering:
A,B,C,D,E (A is MSB, E is LSB)
DE DE
BC 00 01 11 10 BC 00 01 11 10
00 01 32
00 16 17 19 18
45 76 20 21 23 22
01 01
11 11
12 13 15 14 28 29 31 30
10 89 11 10 10 24 25 27 26

A=0 A=1

C. E. Stroud Combinational Logic Minimization 7


(9/12)
5-variable K-map
Changing the variable used to separate maps
changes minterm numbering
Same variable order for this minterm numbering:
A,B,C,D,E (A is MSB, E is LSB)
CD CD
AB 00 01 11 10 AB 00 01 11 10
00 02 64
00 1 3 75
8 10 14 12 9 11 15 13
01 01
11 11
24 26 30 28 25 27 31 29
10 16 18 22 20 10 17 19 23 21

E=0 E=1

C. E. Stroud Combinational Logic Minimization 8


(9/12)
6-variable K-map
Variable order for minterm numbers: ABCDEF
EF EF
CD 00 01 11 10 CD 00 01 11 10
00 01 32
00 16 17 19 18
45 76 20 21 23 22
01 01
A=0
11 11
12 13 15 14 28 29 31 30
10 89 11 10 10 24 25 27 26

EF EF
CD 00 01 11 10 CD 00 01 11 10
00 32 33 35 34
00 48 49 51 50
36 37 39 38 52 53 55 54
01 01
A=1
11 11
44 45 47 46 60 61 63 62
10 40 41 43 42 10 56 57 59 58

B=0 B=1
C. E. Stroud Combinational Logic Minimization 9
(9/12)
Dont Care Conditions
Sometimes input combinations are of no concern
Because they may not exist
Example: BCD uses only 10 of possible 16 input combinations
Since we dont care what the output, we can use these
dont care conditions for logic minimization
The output for a dont care condition can be either 0 or 1
WE DONT CARE!!!
Dont Care conditions denoted by:
X, -, d, 2
X is probably the most often used
Can also be used to denote inputs
Example: ABC = 1X1 = AC
B can be a 0 or a 1
C. E. Stroud Combinational Logic Minimization 10
(9/12)
Dont Care Conditions
Truth Table
A B C Z
BC
K-map A 00 01 11 10 0 0 0 0
Minterm 0 0 01 1 1
32
X 0 0 1 1
45 76 0 1 0 X
Z=A,B,C(1,3,6,7)+d(2) 1 0 0 1 1
0 1 1 1
Maxterm 1 0 0 0
Z=A,B,C(0,4,5)+d(2) Z=B+AC 1 0 1 0
Notice Dont Cares are same 1 1 0 1
for both minterm & maxterm 1 1 1 1
A A AC
Circuit analysis:
C Z=AC + B G=3 GIO=8
B (compared to G=4 & GIO=11
w/o dont care)
C. E. Stroud Combinational Logic Minimization 11
(9/12)
Design Example
Hexadecimal to 7-segment display decoder
A common circuit in calculators
7-segments (A-G) to represent digits (0-9 & A-F)
A logic 1 turns on given segment
A

F B

E C

D
active (on) segments
A
7 segments In3
B for a given HEX value
In2 Hex to C
In1 7-segment D = dont care
decoder F
In0 F
G Circuit block diagram
C. E. Stroud Combinational Logic Minimization 12
(9/12)
HEX to 7-seg Design Example
Create truth table from specification
In3 In2 In1 In0 A B C D E F G
A
0 0 0 0 1 1 1 1 1 1 0
0 0 0 1 0 1 1 0 0 0 0
F B
0 0 1 0 1 1 0 1 1 0 1
G 0 0 1 1 1 1 1 1 0 0 1
0 1 0 0 0 1 1 0 0 1 1
E C 0 1 0 1 1 0 1 1 0 1 1
D 0 1 1 0 1 0 1 1 1 1 1
0 1 1 1 1 1 1 0 0 X 0
1 0 0 0 1 1 1 1 1 1 1
1 0 0 1 1 1 1 X 0 1 1
1 0 1 0 1 1 1 0 1 1 1
1 0 1 1 0 0 1 1 1 1 1
1 1 0 0 1 0 0 1 1 1 0
1 1 0 1 0 1 1 1 1 0 1
1 1 1 0 1 0 0 1 1 1 1
1 1 1 1 1 0 0 0 1 1 1
= dont care
C. E. Stroud Combinational Logic Minimization 13
(9/12)
HEX to 7-seg Design Example
Generate K-maps & obtain logic equations
In1 In0
In3 In2 In1 In0 A B C D E F G In3 In2 00 01 11 10
00 1 0 1 1
0 0 0 0 1 1 1 1 1 1 0
0 0 0 1 0 1 1 0 0 0 0 01 0 1 1 1 K-map for
0 0 1 0 1 1 0 1 1 0 1 A output
11 1 0 1 1
0 0 1 1 1 1 1 1 0 0 1
0 1 0 0 0 1 1 0 0 1 1 10 1 1 0 1

0 1 0 1 1 0 1 1 0 1 1 A = In2In0 + In3In1 + In2 In1


0 1 1 0 1 0 1 1 1 1 1
+ In3 In0 + In3In2 In0 + In3 In2In1
0 1 1 1 1 1 1 0 0 0 0 In1 In0
1 0 0 0 1 1 1 1 1 1 1 In3 In2 00 01 11 10
1 0 0 1 1 1 1 0 0 1 1 00 1 1 1 1
1 0 1 0 1 1 1 0 1 1 1
01 1 0 1 0 K-map for
1 0 1 1 0 0 1 1 1 1 1
1 1 0 0 1 0 0 1 1 1 0 11 0 1 0 0 B output
1 1 0 1 0 1 1 1 1 0 1 10 1 1 0 1
1 1 1 0 1 0 0 1 1 1 1
1 1 1 1 1 0 0 0 1 1 1 B = In2In0 + In2In1 + In3In1In0
+ In3 In1In0 + In3In1 In0
C. E. Stroud Combinational Logic Minimization 14
(9/12)
HEX to 7-seg Design Example
K-maps & logic equations for outputs C-G
In1 In0 In1 In0 In1 In0 In1 In0
In3 In2 00 01 11 10 In3 In2 00 01 11 10 In3 In2 00 01 11 10 In3 In2 00 01 11 10
00 1 1 1 0 00 1 0 1 1
00 1 0 0 1 00 1 0 0 0

01 1 1 1 1 01 0 1 0 1
01 0 0 0 1 01 1 1 X 1

11 0 1 0 0 11 1 1 0 1 11 1 1 1 1 11 1 0 1 1

10 1 1 1 1 10 1 X 1 0
10 1 0 1 1 10 1 1 1 1

K-map for C output K-map for D output K-map for E output K-map for F output

In1 In0
C = In3 In2 + In1In0 + In2In1 + In3In0 + In3In2 In3 In2 00 01 11 10
D = In3In2In0 + In2In1 In0 + In2 In1In0 00 0 0 1 1

+ In3 In1 + In2 In1 In0 01 1 1 0 1


E = In2In0 + In3 In2 + In1 In0 + In3 In1 11 0 1 1 1
F = In1In0 + In3 In2 + In2 In0 + In3 In1 + In3In2
10 1 1 1 1
G = In3 In2 + In1 In0 + In3 In0 + In3In2 In1 + In2In1
K-map for G output
C. E. Stroud Combinational Logic Minimization 15
(9/12)
HEX to 7-seg Design Example
Remaining steps to complete design:
Draw logic diagram (sharing common gates)
Analyze for optimization metirc: G, GIO, Gdel, Pdel
See next page for logic diagram & circuit analysis
Simulate circuit for design verification
Debug & fix problems when output is incorrect
Check truth table against K-map population
Check K-map groups against logic equation product terms
Check logic equations against schematic
Optimize circuit for area and/or performance
Use Boolean postulates & theorems
Re-simulate & verify optimized design
C. E. Stroud Combinational Logic Minimization 16
(9/12)
# loads
on PIs
9
In3
HEX to 7-seg Design Example
In3 G1
In3 Prop delay in gates
9 1+8 2+1 G10 In3 G2
In2 In2 In0 In1 3+1 G20 G3 #inputs + # loads
9 1+7 In3 G4 6+0 A
In1 In1 2+2 G11 In0 G17 G1
1+9 In2 In3
9 G18 G5
In0 In0 In3 In1 3+1 G21 G19 5+0 B
1+9 2+2 G12 In0
In2 In1 G6 G20
2+3 G1 In2 G7 G21
In0 2+1 G13 In3 2+1 G22 G5 C
In3 In0 In1 5+0
2+1 G2 In3 G10 G22
In1 2+1 G14 In3 G11 G23
In2 In0 In2 G24
2+1 G3 3+1 G23 5+0 D
In1 In2 G25
2+1 G15 In0 G1
In3 In1 In2 G26
2+1 G4 G8
In0 In1 4+0 E
In2 2+1 G16 In1 3+1 G24 G9
G6
2+1 G5 In0 In0 G12
In1 In3 In2 G11
In3 In2 3+1 G17 In1 3+2 G25 G12 5+0 F
2+3 G6 G6 G13
In2 In0 In0 G16
G9
In1 In3 In2 G14
2+1 G7 5+0 G
In0 In2 3+1 G18 In1 3+1 G26 G15 Circuit Analysis
In3 In1 In0 G27 G = 38 GIO = 141
2+1 G8 In3 In3
In2 Gdel = 3 Pdel = 30
In1 In1 3+1 G19 In2 3+1 G27
2+1 G9 In0 In1 worst case path:
In0 In0In0G1 A
C. E. Stroud Combinational Logic Minimization 17
(9/12)

You might also like