Chap - 02 - P2 Karnaugh
Chap - 02 - P2 Karnaugh
Chap - 02 - P2 Karnaugh
1
Literal Cost
2
Gate Input Cost
Gate input costs - the number of inputs to the gates in
the implementation corresponding exactly to the given
equation or equations. (G - inverters not counted, GN - inverters
counted)
For SOP and POS equations, it can be found from the
equation(s)
by finding the sum of:
• all literal appearances
• the number of terms, (G) and
• optionally, the number of distinct complemented single literals
• = BD + A B C + A C
(GN).
F
G =11, GN = 14
• F =DBDwhich
Example, + A B solution
C + A B Dis+ best?
AB C G =15, GN = 18
• F = (A + B)(A + D)(B + C + D)( B + C + D) G =14, GN =
17
3
Cost Criteria (continued)
Example 1: GN = G + 2 = 9
F = A + B C + B C L G= 5= L + 2 = 7
B
C
A F
•input.
L (literal count) counts the AND inputs and the single literal OR
4
Cost Criteria (continued)
A
B
• F=ABC+ABC C F
• L= 6 G = 8 GN =
11
A
• F = (A + C )(B + C) ( A + B)
• L=6 G = 9 GN = C
12 B function and same
Same F
literal cost
But first circuit has better
gate input count and
better gate input count
with NOTs 5
Boolean Function Optimization
7
Some Uses of K-Maps
8
The Boolean Space Bn
B = { 0,1}
B2 = {0,1} X {0,1} = {00, 01, 10, 11}
B1
B2
B3
B4
9
Two Variable Maps
10
K-Map and Truth Tables
Input Function
y
Value x y=0
y=1
Values F(x,y)
x=0 a b
(x,y)
00 a
01 b x=1 c d
10 c
11 d
11
K-Map Function Representation
Example: F(x,y) = x
F=x y=0 y=1
x=0 0 0
x=1 1 1
F(x, y ) = x y + x y
=x
12
K-Map Function Representation
Example: G(x,y) = xy + xy + xy
G=x+y y = 0 y = 1
x=0 0 1
x=1 1 1
G ( x, y ) = ( x y + x y ) + ( xy + x y ) = x + y
Duplicate xy
13
Three Variable Maps
A three-variable K-map: yz
X yz=00 yz=01 yz=11 yz=10
m0 m1 m3 m2
x=0
x=1
m4 m5 m7 m6
Where each minterm corresponds to the product terms:
yz
X
yz=00 yz=01 yz=11 yz=10
x=0 x y z x y z x y z x y z
x=1 x y z x y z x y z x y z
Note that if the binary value for an index differs in one bit
position, the minterms are adjacent on the K-Map
14
Alternative Map Labeling
y z y z
x y
y
y
0 1 3 2 0 1 3 2
x
x
4 5 7 6
x x 14 5 7 6
00
z z z z
01
11
15
10
Example: Combining Squares
y z
Example: Let x y
3
1
F (x, y, z) = m (2, 3, 6, 7) 0 1
2
1
x 4 5
7 6
1 1
z
Applying the Minimization Theorem three times:
F(x,y,z) = x y z + x y z + x y z +
x y z
= yz + y z
= y
16
Combining Squares
17
Example Functions
18
Three-Variable Maps
19
Three-Variable Maps
Topological warps of 3-variable K-maps that show
all adjacencies:
Venn Diagram
Cylinder
0
4 X
6 5
7
Y 3 Z
2 1
y z
x y
y
0 1 3 2
x
4 5 7 6
x
z z z 20
Three-Variable Maps
4 5 7 6
x
z
Read off the product terms for the rectangles
shown
x’z’ x’y’ yz
21
Three-Variable Maps
4 5 7 6
x
x 1 1
F(x, y, z) = z + x
y
Three-Variable Map Simplification
F=z+xy+xy
yz
x y
1 1 1
x 1 1 1
z
24
Four Variable Maps
4 5 7 6
wx=01
X
12 13 15 14
wx=11
W 11 10
8 9
wx=10
Z
Four Variable Terms
26
Four-Variable Maps
4 5 7 6
wx=01
X
12 13 15 14
wx=11
W
8 9 11 10
wx=10
27
Four-Variable Maps
4 5 7 6
wx=01
X
12 13 15 14
wx=11
W 8 9 11 10
wx=10
Z
28
Four-Variable Map Simplification
F(W, X, Y, Z) = m (0,2,4,5,6,7,
8,10,13,15)yz Y
WX yz=00 yz=01 yz=11 yz=10
0 1 3 2
1 1
wx=00
4 5 7 6
wx=01 1 1 1 1
X
12 13 15 14
wxW=1
1 1
1 9
8 11
wx=10 1 110
Z
F = XZ + 29
X'Z‘+W’X
Four-Variable Map Simplification
F(W,X,Y, Z) =m
yz Y
(3,4,5,7,9,13,14,15)
WX
0 1 3 2
1
6
4 5
1 1
X
12
W 113
15
1
14
1
7
8 19 11 10
Z
F = W' X Y' + W' Y Z + WXY + WY'Z 30
Systematic Simplification
31
Example of Prime
1 1 1 1
1 1
BD BD 1 1
1 1
B B
1 1 1 1
A A
1 1 1 1 1 1 1 1
A B A B
D D
AD AD
B B
Minterms
C covered by single prime implicant C
32
Prime Implicant Practice
Find all prime implicants for:
F (A, B, C, D) = m (0,2,3,8,9,10,11,12,13,14,15)
CD C
AB 3
0 1 1 2
1 1
4 5 7 6
B
A 1 12 113 1
15
8 9 11 10
1 1 114 1
1
D
D
AB, BCD, ACD, ABD, ABC, ACD,
BCD
m= AB+ACD+ACD+ABC c= m+ABD+BCD+BCD 34
K-Maps, implicates
Find all prime implicates for:
F=(w+y+z) (w’+x’+y) (x+y) (w+x+y’) (w+x’+z) (w’+x+z)
WX
YZyz=00
yz=11
Y yz=10
0
yz=01 0 0
1 3 2
wx=00
0 0
4 5 7
wx=01 0 0
6
X
W 15 14
12
wx=11 0 013
9 10
8 11 0
wx=10 0 0
Z
m= (w+x)(w’+y)(w+z)(x+z) c= m(y+z) (y’+x’)
Five Variable or More K-Maps
X X
W W
Z Z
36
Five Variable K-Maps
Find all prime implicants for:
G(v,w,x,y,z)=m(0,1,2,4,5,6,7,8,10,16,17,18,20,
21,24,25,26,27,29)
V=0 V=1
Y Y
1 1 1 1 1 1
1 1 1 1 1 1
X 1 X
W W
1 1 1 1 1 1
Z Z
m= w’y’+x’z’+v’w’x+vy’z+vwx’ c= m+v’w’z’
37
Don't Cares in K-Maps
F = (f, d, r) : Bn {0, 1, x}
where x represents “don’t
care”.
• f = onset function - f(x)=1 F (x)=1
• r = offset function - r(x)=1 F (x)=0
• d = don’t care function - d(x)=1 F (x)=*
39
Example:Logic Minimization
Consider F (a,b,c)=(f,d,r), where f={abc, abc,
abc} and d ={abc, abc}, and the sequence of
covers illustrated below:
c
F1= abc + abc+ abc b
On Expand abca
a
Off
F2= a+abc + abc
Don abc is
’t redundant a is
car prime
e F3= a+abc
Expand abc
bc
F = a+bc
4
40
Example: BCD “5 or More”
1 1 1 1
1 1 1 1 1 1 1 1
B B
1 1
A A
1 1 1 1
D D
Minterms covered by essential prime
implicants
F=A’B+A’CD +AC’D+B’C’D’
Selection Rule Example with Don't Cares
1 x 1 x
1 x x 1 x x 1
1 B B
A A
1 1 x x
1 1
D D
Minterms covered by essential prime implicants
F = A’ B + AB’D + B’C F = A’ B + AB’D + A’C 44
Combinational Circuits
A combinational logic circuit has:
• A set of m Boolean inputs,
• A set of n Boolean outputs, and
• n switching functions, each mapping the 2
input m
Specification
• BCD to Excess-3 code converter
Transforms BCD code for the decimal digits to
Excess-3 code
• BCDfor the words
code decimalfor
digits
digits 0 through 9
4-bit patterns 0000 to 1001, respectively
• Excess-3 code words for digits 0 through 9
4-bit patterns consisting of 3 (binary 0011) added to each BCD
code word
• Implementation:
multiple-level circuit
NAND gates (including inverters)
Specification of BCD-to-Excess3
BCD to
Excess-3
converter
A B C D
48
Formulation of BCD-to-Excess-3
49
BCD-to-Excess-3 Code converter
50
Expressions for W X Y Z
W(A,B,C,D) = Σm(5,6,7,8,9) + d(10,11,12,13,14,15)
X(A,B,C,D) = Σm(1,2,3,4,9) + d(10,11,12,13,14,15)
Y(A,B,C,D) = Σm(0,3,4,7,8) + d(10,11,12,13,14,15)
Z(A,B,C,D) = Σm(0,2,4,6,8) + d(10,11,12,13,14,15)
51
Optimization – BCD-to-Excess-3
W = A + BC + BD
52
Optimization – BCD-to-Excess-3
X = BC’D’+B’C+B’D
53
Optimization – BCD-to-Excess-3
Σm (0,3,4,7,8)
Y = C’D’ + CD
Minimize K-Maps
Z minimization
Σ (0,2,4,6,8)
m
Z = D’
55
Two level versus multi-level circuit implementation
Have equations
• W = A + BC + BD
• X = B’C + B’D + BC’D’
• Y = CD + C’D’
• Z = D’
Call T= C+D, then T’ = (C+D)’ = C’D’
• W = A + BT
• X = B’T + BT’
• Y = CD + T’
• Z = D’
56
Create the digital circuit
Implementing the
second set of
equations where
T=C+D results in a
lower gate count.
This gate has a
fanout of 3
57