EE2420 – Digital Logic Summer II 2013
description
Transcript of EE2420 – Digital Logic Summer II 2013
EE2420 – Digital LogicSummer II 2013
Hassan Salamy
Ingram School of Engineering
Texas State University
Set 5: Karnaugh Maps
Test 1
Thursday July 18, 2013
2
Karnaugh map
The key to finding a minimum cost SOP or POS form is applying the combining property (14a for SOP or 14b for POS)
The Karnaugh map (K-map) provides a systematic (and graphical) way of performing this operation
Minterms can be combined by 14a when they differ in only one variable f(x,y,z) = xyz+xyz’ = xy(z+z’) = xy(1) = xy
The K-map illustrates this combination graphically
3
Karnaugh map
The K-map is an alternative to a truth table for representing an expression K-map consists of cells that correspond to rows of the truth table Each cell corresponds to a minterm
A two variable truth table and the corresponding K-map
x1 x2 f
0 0 m0
0 1 m1
1 0 m2
1 1 m3
m3m1
m2m0
0
0
1
1x1
x2
4
Karnaugh map
m3m1
m2m0
0
0
1
1x1
x2
Values for the first variableare listed across the top
Values for the second variableare listed down the left side
5
Karnaugh map groupings
Minterms in adjacent squares on the map can be combined since they differ in only one variable
Indicated by looping the corresponding ‘1’s on the map (the ‘1’s must be adjacent)
Looping two ‘1’s together corresponds to eliminating a term and a variable from the output expression => xy+xy’ = x
x y f
0 0 0
0 1 0
1 0 1
1 1 1
10
10
0
0
1
1x
y
f=xy’+xy=x
6
K-map groupings example
Note that the bottom two cells differ in only one variable (x) and the right two cells differ in only one variable (y)
x y f
0 0 0
0 1 1
1 0 1
1 1 1
11
10
0
0
1
1x
y
x
yf=x+y
7
K-map groupings example
x
0 1
y0 1 1
1 1 0
Draw the K-map and give the minimized logic expression for the following truth table.
Show the groupings made in the K-map
x y f
0 0 1
0 1 1
1 0 1
1 1 0
8
Three variable K-map
A three-variable K-map is constructed by laying 2 two-variable maps side by side
K-maps are always laid out such that adjacent squares only differ by one variable (i.e. by 1 bit in the binary expression of the minterm values)
x y z Minterm0 0 0 m0=x’y’z’
0 0 1 m1=x’y’z
0 1 0 m2=x’yz’
0 1 1 m3=x’yz
1 0 0 m4=xy’z’
1 0 1 m5=xy’z
1 1 0 m6=xyz’
1 1 1 m7=xyz
m3m1
m2m0
00
0
1
01xy
z
m5m7
m4m6
11 10
End cells are ‘adjacent’
9
Example three-variable K-maps
f(x,y,z)=m(0,1,2,4)01
11
00
0
1
01xy
z
00
10
11 10
=x’y’+x’z’+y’z’
11
11
00
0
1
01xy
z
00
10
11 10
f(x,y,z)=m(0,1,2,3,4)=x’+y’z’
A grouping of four eliminates 2 variables
10
Guidelines for combining terms Can combine only adjacent ‘1’s Can group only in powers of 2 (1,2,4,8,
etc.) Try to form as large a grouping as
possible Do not generate more groups than are
necessary to “cover” all the ‘1’s
11
Example groupings
00
11
00
0
1
01xyz
00
11
11 10
01
11
00
0
1
01xyz
10
11
11 10
00
10
00
0
1
01xyz
11
11
11 10
10
11
00
0
1
01xyz
01
01
11 10
f=z’ f=yz’+x
f=z’+y’ f=y+x’z’
12
K-map groupings example
ab
00 01 11 10
c0 0 1 1 1
1 1 1 0 1
Draw the K-map and give the minimized logic expression for the following. f(a,b,c)=m(1,2,3,4,5,6)
Show the groupings made in the K-map
13
Four variable K-map
A four-variable K-map is constructing by laying 2 three-variable maps together to create four rows f(a,b,c,d)
m5m1
m4m0
00 01ab
cd
m9m13
m8m12
11 10
m6m2
m7m3
m10m14
m11m15
00
01
11
10
14
Four variable K-map
Adjacencies wrap around in the K-map
m5m1
m4m0
00 01abcd
m9m13
m8m12
11 10
m6m2
m7m3
m10m14
m11m15
00
01
11
10
15
Example four-variable K-maps
00
00
00 01ab
cd
11
00
11 10
01
01
10
10
00
01
11
10
f(a,b,c,d)=m(2,3,9-11,13)
=ac’d+b’c
10
10
00 01ab
cd
11
01
11 10
10
11
01
11
00
01
11
10
f(a,b,c,d)=m(3-7,9,11,12-15)
=b+cd+ad
16
Example groupings
01
11
00 01ab
cd
10
11
11 10
11
01
11
10
00
01
11
10
f(a,b,c,d)=b’+d’
01
10
00 01ab
cd
10
01
11 10
10
01
01
10
00
01
11
10
f(a,b,c,d)=b’d+bd’
17
Example groupings
10
01
00 01ab
cd
01
10
11 10
01
10
10
01
00
01
11
10
f(a,b,c,d)=b’d’+bd
01
11
00 01ab
cd
10
01
11 10
11
01
01
10
00
01
11
10
f(a,b,c,d)=b’d+bd’+a’b’
18
Examples
We will revisit some of the examples we studied in the last lecture.
We will simplify the equations using K-Maps this time instead of algebraic manipulations.
19
Multiplexer circuit
s x y f
0 0 0 0
0 0 1 0
0 1 0 1
0 1 1 1
1 0 0 0
1 0 1 1
1 1 0 0
1 1 1 1
f(s,x,y)=m2+m3+m5+m7
f(s,x,y)=s’xy’+s’xy+sx’y+sxyf(s,x,y)=s’x(y’+y)+sy(x’+x)f(s,x,y)=s’x+sy
20
Car safety alarm
D K S B A0 0 0 0 00 0 0 1 00 0 1 0 00 0 1 1 00 1 0 0 10 1 0 1 10 1 1 0 10 1 1 1 11 0 0 0 01 0 0 1 01 0 1 0 01 0 1 1 01 1 0 0 01 1 0 1 01 1 1 0 11 1 1 1 0
A(D,K,S,B)=m(4,5,6,7,14)A(D,K,S,B)=D’KS’B’+D’KS’B+D’KSB’+D’KSB+DKSB’
=D’KS’+D’KS+KSB’
=D’K+KSB’
21
Three-way light control
x y z f
0 0 0 0
0 0 1 1
0 1 0 1
0 1 1 0
1 0 0 1
1 0 1 0
1 1 0 0
1 1 1 1
f(x,y,z)=m1+m2+m4+m7
f(x,y,z)=x’y’z+x’yz’+xy’z’+xyzThis is the simplest sum-of-products form.
22
Majority Function23
X Y Z Majority
0 0 0 0
0 0 1 0
0 1 0 0
0 1 1 1
1 0 0 0
1 0 1 1
1 1 0 1
1 1 1 1
• The output of the majority function is equal to the value for the three inputs which occurs on more inputs.
• Majority(X,Y,Z) = m(3,5,6,7)
• Majority(X,Y,Z) = X’YZ + XY’Z + XYZ’ + XYZ
• Simplified Majority(X,Y,Z) = XY + XZ + YZ