Uploaded by sultanxx575

05 Karnaugh Maps

advertisement
Digital Logic Design
-Karnaugh Maps-
Karnaugh Maps
The Karnaugh Map (K-Map) method uses a simple
procedure for minimizing Boolean functions.
Much faster and more efficient than previous
minimization techniques with Boolean algebra. It can be
used to simplify functions of up to six variables.
It is possible to find two or more expressions that
satisfy the minimization criteria.
Instr: Dr. Awais M. Kamboh.
2
K-Maps
The Karnaugh-map is a diagram made up of squares.
Each square represents one minterm.
For 2-variables, the map contains 4 squares.
Instr: Dr. Awais M. Kamboh.
3
Two-Variable Map
A two-variable map holds four minterms.
We mark the squares of the minterms that belong to a
given function.
Combine adjacent squares to find minimal expression.
Identify the cells which result in F = 1.
a) F = xy
b) F = x + y
Instr: Dr. Awais M. Kamboh.
4
Gray Code
Gray code is a code that has a single bit
change between one code word and the
next in a sequence. Gray code is used to
avoid problems in systems where an
error can occur if more than one-bit
changes at a time.
Instr: Dr. Awais M. Kamboh.
5
Decimal
Binary
Gray code
0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
0000
0001
0010
0011
0100
0101
0110
0111
1000
1001
1010
1011
1100
1101
1110
1111
0000
0001
0011
0010
0110
0111
0101
0100
1100
1101
1111
1110
1010
1011
1001
1000
Three Variable Maps
• Cells are labeled using 0’s and 1’s to represent the variable and its
complement.
• The numbers are entered in gray code, to force adjacent cells to be
different by only one variable. Each cell differs from an adjacent
cell by only one bit.
• For 3 variables, 8 cells are required (23).
C
AB
Gray
code
0
1
00
ABC
ABC
01
ABC
ABC
11
ABC
ABC
10
ABC
ABC
Instr: Dr. Awais M. Kamboh.
6
Three Variable Maps
Alternatively, cells can be labeled with the variable letters.
This makes it simple to read, but it takes more time
preparing the map.
CC
Read the terms for the
yellow cells.
AB
AB ABC
CC
ABC
AB
AB ABC
ABC ABC
The cells are ABC and ABC.
Instr: Dr. Awais M. Kamboh.
7
AB
AB ABC
ABC
AB ABC
AB
ABC
ABC
K-Map based Function Minimization
K-maps can be used to minimize a function by using the
following steps.
❖Convert the given function in SOP form and identify the
minterms.
❖The minterms present in the function are marked 1, the
rest are marked 0 or kept empty.
❖Create rectangles of 1s having “largest possible power
of 2” cells, e.g., 1, 2, 4, 8… and so on.
❖All 1s must be included at least once.
❖The 1s must be enclosed in fewest possible rectangles.
❖Convert the rectangles into algebraic terms
❖The result is in SOP form.
Instr: Dr. Awais M. Kamboh.
8
Three Variable Maps
K-maps can simplify combinational logic by grouping cells and
eliminating variables that change.
Group the 1’s on the map and read the minimum logic.
B changes
across this
boundary
C
AB
00
0
01
1
1
1
1
11
10
C changes
across this
boundary
Instr: Dr. Awais M. Kamboh.
1. Combine the 1’s into two overlapping
groups as indicated.
2. Read each group by eliminating any
variable that changes across a boundary.
3. The vertical group is read AC.
4. The horizontal group is read AB.
X = AC +AB
9
Karnaugh Maps: 3 Variable K-map
Possibility 1
BC
00
01
Possibility 2
11
10
BC
A
00
01
11
10
A
0
1
1
0
0
0
1
0
0
0
1
0
0
0
0
1
1
0
0
0
X = A’B’C’+A’B’C=A’B’
X=A’B’C’+AB’C’=B’C’
Possibility 3
Possibility 4
BC
00
01
11
10
BC
A
00
01
11
10
A
0
1
0
0
1
0
0
1
1
0
1
0
0
0
0
1
0
1
1
0
X=A’BC’+A’B’C’=A’C’
Instr: Dr. Awais M. Kamboh.
X=A’BC+ABC+A’B’C+AB’C=C
10
Karnaugh Maps: 3 Variable K-map
Possibility 5
A
BC
Example1
00
01
11
10
0
1
0
0
1
1
1
0
0
1
A
BC
00
01
11
10
0
1
0
1
1
1
0
0
1
0
X=A’B’C’+AB’C’+A’BC’+ABC’ = C’
X=A’B’C’+A’BC’+A’BC+ABC=BC+A’C’
Example 2
Training 1
A
BC
00
01
11
10
0
1
1
1
1
1
0
1
1
0
A
X
=A’B’C’+A’BC+A’B’C+A’BC’+ABC+AB’C
= A’+C
Instr: Dr. Awais M. Kamboh.
11
BC
00
01
11
10
0
0
1
1
1
1
0
1
1
0
X=?
4 Variable Karnaugh Maps
A 4-variable map has an adjacent cell on each of its four
boundaries as shown.
CD
CD
CD
Each cell is different only by
one variable from an adjacent
cell.
Grouping follows the rules
given in the text.
The following slide shows an
example of reading a four
variable map using binary
numbers for the variables…
CD
AB
AB
AB
AB
Instr: Dr. Awais M. Kamboh.
12
4 Variable Karnaugh Maps
Group the 1’s on the map and read the minimum logic.
C changes across
outer boundary
CD
00
AB
00 1
01
11
10
1
B changes
01
1
1
11
1
1
10
1
1
B changes
C changes
X
Instr: Dr. Awais M. Kamboh.
1. Group the 1’s into two separate
groups as indicated.
2. Read each group by eliminating
any variable that changes across a
boundary.
3. The upper (yellow) group is read as
AD.
4. The lower (green) group is read as
AD.
X = AD +AD
13
Karnaugh Maps: 4 Variable K-map
Possibility 1
AB
CD
Possibility 2
00
01
11
10
00
0
1
1
0
0
01
0
1
1
0
0
1
11
0
0
0
0
0
1
10
0
0
0
0
00
01
11
10
00
1
1
0
1
01
0
0
0
11
1
0
10
0
0
AB
X= A’B’C’+B’CD’+ABD’
Instr: Dr. Awais M. Kamboh.
CD
X=A’D
14
Karnaugh Maps: 4 Variable K-map
Possibility 3
AB
CD
Possibility 4
00
01
11
10
00
1
0
0
1
0
01
0
0
0
0
0
0
11
0
0
0
0
1
0
10
1
0
0
1
00
01
11
10
00
0
1
1
0
01
0
0
0
11
0
0
10
0
1
AB
X=A’B’C’D+A’B’CD+AB’C’D+AB’CD
X= B’D
Instr: Dr. Awais M. Kamboh.
CD
X==B’D’
15
Karnaugh Maps: 4 Variable K-map
Possibility 5
AB
CD
Possibility 6
00
01
11
10
00
1
1
1
1
0
01
0
0
0
0
1
0
11
0
0
0
0
1
0
10
1
1
1
1
00
01
11
10
00
0
1
1
0
01
0
1
1
11
0
1
10
0
1
AB
X=B’
X= D
Instr: Dr. Awais M. Kamboh.
CD
16
Karnaugh Maps: 4 Variable K-map
Possibility 7
AB
CD
Possibility 8
00
01
11
10
00
1
1
1
1
1
01
1
0
0
1
0
1
11
1
0
0
1
0
1
10
1
1
1
1
00
01
11
10
00
1
0
0
1
01
1
0
0
11
1
0
10
1
0
AB
X= D’
Instr: Dr. Awais M. Kamboh.
CD
X=B’+D’
17
Karnaugh Maps: 4 Variable K-map
Possibility 9
AB
CD
Possibility 10
00
01
11
10
00
0
0
0
0
1
01
0
0
0
0
1
1
11
0
0
0
0
1
1
10
0
0
0
0
00
01
11
10
00
1
1
1
1
01
1
1
1
11
1
1
10
1
1
AB
X= 1
Instr: Dr. Awais M. Kamboh.
CD
X=0
18
Truth Table → K-map
A
B
C
D
X
0
0
0
0
1
0
0
0
1
0
0
0
1
0
1
0
0
1
1
0
0
1
0
0
1
0
1
0
1
0
1
1
0
1
1
00
01
11
10
00
1
0
0
1
0
01
1
0
0
1
0
1
11
0
1
1
0
1
1
0
10
0
1
1
0
0
0
0
0
1
0
0
1
1
1
0
1
0
0
1
0
1
1
1
1
1
0
0
0
1
1
0
1
1
1
1
1
0
0
1
1
1
1
1
Instr: Dr. Awais M. Kamboh.
AB
CD
X = A’D’ +AD
19
Download