Ece lect2-
-
Upload
gunamadhan8913 -
Category
Documents
-
view
224 -
download
0
Transcript of Ece lect2-
-
8/13/2019 Ece lect2-
1/25
EECS 465: Digital Systems
Lecture Notes # 2
Two-Level Minimization Using Karnaugh Maps
SHANTANU DUTT
Department of Electrical & Computer Engineering
University of Illinois, ChicagoPhone: (312) 355-1314: e-mail: [email protected]
URL: http://www.ece.uic.edu/~dutt
-
8/13/2019 Ece lect2-
2/25
Concepts in 2-Level Minimization
Defn: An implicantg of a function is aproduct term(e.g., g=xyz) s.t.
when g=1f=1
Defn: A mintermis an implicant whose product term representation
consists of all n variables of an n-var. function (each in either compl.or
uncompl. form)
Defn: Let g, and h be 2 implicants of a function f. g is said to coverh
if h=1g=1 (e.g., g = xz, h = xyz)Defn: Let G = {g1, .., gk} be a set of implicants of func f, and let h be
another implicant of f. Then G is coversh if h=1g1+ .. + gk=1
Defn: An SOP or POS expression is also called a 2-level expression
Defn: A 2-level AND-OR (OR-AND) gate realizationof an SOP(POS) expression is one in which all product terms (OR
terms in POS) in the SOP (POS) expression are implemented
by multiple input AND (OR) gates & the ORing (ANDing)
of the product (OR) terms is realized by a multiple input OR
(AND) gate.
2
-
8/13/2019 Ece lect2-
3/25
E.g. f1= AB + BC + ACD --- 2-level. (SOP)
f2= ( B+C )( A+D )( C+D ) --- 2-level (POS)
f3=AB + AC( B+D ) --- not SOP or POS
level 1 I/Ps --- not 2-level
--- 3 level ( can be realized
directly by 3 levels of gates)A
B
A
C
B
D
f3
level 1
gates
level 0
I/Ps
level 2
gates
level 3
gate
level 2
I/Ps
3
-
8/13/2019 Ece lect2-
4/25
AB + BC + ACDA
B
B
C
ACD
f1
Level 2
Level 1
(B + C)(A + D)(C + D)B
C
A
D
C
D
f2
4
-
8/13/2019 Ece lect2-
5/25
Defn. A gate in a logic circuit is a level-1 gate if all its inputs are
primary inputs (i.e., literals, A, A, B, B, etc.)
A gate is a level-i gate i > 1 if the highest-level gate whose
output feeds the (level-i) gate is a level-(i-1) gate.
NOTE: If a given expr. is not 2-level, we can convert it to a
2-level one using the distributive law.
The goal of 2-level minimization is to minimize the number of
literals (a literal is a var. in complemented or uncompl. form)
in a 2-level logic expr..
This approx. reduces the total # of inputs over all gates in the
circuit in a 2-level gate realization.
5
-
8/13/2019 Ece lect2-
6/25
E.g. f = ABC + ABC + ABC (non-minimized 9 literals)
A
BCA
BC
ABC
f
(12 gate I/Ps)
= Circuit complexity
f = AB + AC (minimized 4 literals)
A
B
A
C
f(6 gate I/Ps)
= Circuit complexity
6
Note: Minimizing # of literals + # of product terms (approx) minimizing total # ofgate inputs
-
8/13/2019 Ece lect2-
7/25
Multilevel Minimization (Example):
f = x1x2x3+ x2x3x4+ x1x5+ x4x5 (2-level minimized)
Apply distributive law (factoring)
f = x2x3(x1+ x4) + x5(x1+ x4)
= (x2x3+ x5)(x1+ x4) -- Multilevel expr.
Gate Impl.:
x2x3
x5
x1x4
f
Multilevel
circuit
7
-
8/13/2019 Ece lect2-
8/25
Defn. Two implicants (or product terms) of a function f are said to
be adjacent (logically) if they have the same literals
except in one variable xi
which occurs in uncomplemented for
(xi) in one implicant and in complemented form (xi) in the
other. The 2 implicants are said to differ in xi.
E.g. ABC, ABC (adjacent implicants, differ in B)
ABD, ABC (not adjacent)
NOTE: Adjacent implicants can be combined into one implicant
by the combining theorem (ABC + ABC = AC)
8
-
8/13/2019 Ece lect2-
9/25
Karnaugh Maps
2-variable TT outputs
A B Z1 Z2
0 0 0 0
0 1 1 1
1 0 0 1
1 1 1 0
Binary
place-value
ordering
(Binary
ordering)
Physically adjacent
but not logically
adjacent.
logically adjacent but not physically adjacent
AB + AB
B
Another ordering of inputs ( Gray-code ordering)A B Z1
0 0 0
0 1 1
1 1 1
1 0 0
Z1= BPhysically as well as
logically adjacent.
9
-
8/13/2019 Ece lect2-
10/25
n-variable Gray-code ordering
G1 = 0 Base.1
G2 = 0 G1
1 rev(G1)=
0 0
0 1
1 1
1 0
G3 = 0 G2
1 rev(G2)=
A B C
0 0 0
0 0 1
0 1 10 1 0
1 1 0
1 1 1
1 0 11 0 0
Gn = 0 Gn-1
1 rev(Gn-1)
Convert to a 2-dimensional
Gray-code ordered TT
ABC 00 01 11 10
0
1
x
y
001
110
Throw away variable (A)
changing across the 2 squares.
We thus obtain BC.
1 1
Defn. Gi= i-bit Gray-code ordering
rev(Gi) = reverse order of Gi
10
-
8/13/2019 Ece lect2-
11/25
Example ( 3-var. K-Map)
Function f:AB
C 00 01 11 10
0
1
1 1 1
1 1f = AB + AB + AC + BC
Consensus = BC
Four Prime Implicants AB, BC, AC, AB formed. Not all these PIs
are needed in the expression. Only a minimum set that covers all
minterms is needed.
Defn. A Prime Implicant (PI) of a function f is an implicant of f that
is not covered by any other implicant of f.
Defn. An Essential PI is a PI that covers/includes at least one minterm
that is not covered by any other PI.
11
-
8/13/2019 Ece lect2-
12/25
In the above example, AB & AB are essential PIs. These will need
to be present in any SOP expr. of the function. To form a minimal
set, the PI BC can be used. Thus f = AB + AB + BC is a minimized
expression.
Larger than 2-minterm PIs can also exist:
E.g.,AB
C 00 01 11 10
0
1
1 1
1 1
AB ABB
B
AB
C 00 01 11 10
0
1 1 1 1 1
C
2-minterm implicants (AB, AB in the 1st example above) can
be merged if they are logically adjacent to form a 4-minterm
implicant and so on.
12
-
8/13/2019 Ece lect2-
13/25
When an implicant can not be grown any further, then it is a PI.
Defn. In a K-map, 2 implicants can be logically adjacent if they
are symmetric,i.e., if : (1) They are disjoint (no common minterms).
(2) They cover the same # of minterms.
(3) Each minterm in one implicant is adjacent to a
unique minterm in the other implicant.More Examples:
AB
C
AB
C
00 01 11 10
0
1
0
11 1
1 1 1
1 1
1 1 1
Symmetric ( logically adjacent)
Not symmetric
2-minterm implicants : Can be merged to form
a 4-minterm implicant, which will be a PI.
Redrawn
Both PIs
(A, BC)
are
essential.Thus, f = A + BC
is minimized.
00 01 11 10
13
-
8/13/2019 Ece lect2-
14/25
4-variable K-Map:
AB
C
D00 01 11 10
00
01
11
10
14
15
-
8/13/2019 Ece lect2-
15/25
Example:AB
CD
AB
CD
00 01 11 10
00
01
11
10
00
01
11
10
00 01 11 10
1 1 1 1
1 1
1 1 1 1
1 1
1 1
1 1 1
1
AC
f = AC + DInstead of starting with 2-minterm
implicants & growing them, you
can form larger implicants directlyby grouping power of 2 (2, 4, 8,
etc.) # of minterms so as to form
a rectangle or square ( a convex
region).Convex
Concave
Valid
groupings
Invalid grouping
(region formed is concave)
f = AB + AC + BCD
D
15
-
8/13/2019 Ece lect2-
16/25
Another Example:
A B C D Z0 0 0 0 1
0 0 0 1 0
0 0 1 0 1
0 0 1 1 1
0 1 0 0 0
0 1 0 1 10 1 1 0 1
0 1 1 1 1
1 0 0 0 1
1 0 0 1 0
1 0 1 0 1
1 0 1 1 11 1 0 0 0
1 1 0 1 0
1 1 1 0 1
1 1 1 1 1
TT:
Binary
order
ABCD 00 01 11 10
00
01
11
10
1 1
1
1 1 1 1
1 1 1 1
ABD
BD
C
f = C + BD + ABD
16
17
-
8/13/2019 Ece lect2-
17/25
Dont Cares in K-Maps
Many times certain input combinations are invalid for a function
(E.g. BCD to 7-segment display functions; see pp. 212-214 inKatz text )
For such combinations, we do not care what the output is, and
we put an x in the o/p column for the TT
A B C f
0 0 0 1
0 0 1 0
0 1 0 1
0 1 1 x
1 0 0 0
1 0 1 1
1 1 0 x
1 1 1 x
ABCD 00 01 11 10
0
1
x x 1 0
0 1 1 0
f = BC + AB
by considering allxs as 0s
f = B The xs can, however, be profitably
used to make larger PIs & thus
further simplify the function.
17
by selectively
considering the 010cells x as 1
-
8/13/2019 Ece lect2-
18/25
19
-
8/13/2019 Ece lect2-
19/25
STEPS IN K-MAP MINIMIZATION (sop EXPR.)
STEP1: Form all PIs by including the Xs with the 1s to form larger
PIs. (Do not form PIs covering only Xs !)
STEP2: Identify all essential PIs by visiting each minterm (1s) &
checking if it is covered by only one PI. If so, then that
PI is an essential PI.
STEP3: Identify all 1s not covered by essential PIs. Select a minimal-
cost set of PIs S to cover them. This requires some trial-and error (in
fact, this is a hard computational problem).
STEP4: Minimal SOP Expr. for function f:
PI Piis in set S
f = essential PIs + PiPi S
19
Mi i l POS E f K M
20
-
8/13/2019 Ece lect2-
20/25
Minimal POS Expr. from a K-Map :
METHOD 1: Obtain minimal SOP expression for the complement
function f, and complement this SOP expression to get a minimal
POS expr. for f (using De-Morgans Law)
Example:
F (A,B,C,D) = M(0,2,4,8,10,11,14,15) D(6,12,13)
Big M notation
0s of FXs of F
ABCD
ABCD 00 01 11 10
00
01
11
10
00
01
11
10
0 4 12 8
1 5 13 9
3 1 7 1 15 0 11 0
2 0 6 x 14 0 10 0
0 0 x 0
1 1 x 1
Complement 1 1 x 1
0 0 x 0
0 0 1 1
1 x 1 1AC
D
F =D + AC F = D + AC = D(A +C)
F F
20
METHOD2 Di t M th d 21
-
8/13/2019 Ece lect2-
21/25
METHOD2 : Direct Method :
(1) Obtain all prime implicates(PTs) (largest groups of 0s & Xs
of size 2 , i 0, forming a convex region, that can not be grown
any further).(2) Identify all essential PTs (those that cover at least one 0 not
covered by any other PT).
(3) Choose a minimal set T of PTs to cover the 0s not covered bythe set of essential PTs.
(4) The expression for a PT is an OR term obtained by discarding
all changing variables, & keeping variables complemented if they
are constant at 1 or uncomplemented if they are constant at 0 &
taking the OR (sum) of these literals.
(5) Minimal POS Expr.:
f = (essential PTs) qiqi T
21
i
22
-
8/13/2019 Ece lect2-
22/25
Example: (Direct Method)
ABCD 00 01 11 10
00
01
11
10
0 0 x 0
1 1 x 1
1 1 0 0
0 x 0 0
(A + C)
D
(OR terms)
Prime Implicate
( Groups of 0s that cannot
be grown any further)
Both D and A + C areEssential Prime Implicates.
F = D( A + C )
( Product of Prime Implicates )
22
23
-
8/13/2019 Ece lect2-
23/25
5-variable K-map: f(A,B,C,D,E)---Juxtapose two 4-var. K-submaps
one for the MSB A=0 and the other for A=1:BC
DE
BCDE00 01 11 10
00
01
11
10
00 01 11 10
00
01
11
10
BCDE
BC
DE00 01 11 10
00
01
11
10
00 01 11 10
00
01
11
10
A=0 A=1
A=0 A=1
0 4 12 8
1 5 13 9
3 7 15 11
2 6 14 10
16 20 28 24
17 21 29 25
19 23 31 27
18 22 30 26
0 1 4 12 1 8
1 5 13 1 9
3 1 7 1 15 x 11
2 6 14 x 10
16 20 28 x 24
17 21 29 1 25
19 x 23 1 31 x 27
18 22 1 30 1 26
4-var. K-submap 4-var. K-submapAdjacencies of a square: Adjacent squares of the 4-var. K-submap
plus the corresponding or mirror square in the other 4-var.
K-submap.
Example:
23
24
-
8/13/2019 Ece lect2-
24/25
EF EF00 01 11 10
00
01
11
10
00 01 11 10
00
01
11
10
0 4 12 8
1 5 13 9
3 7 15 11
2 6 14 10
16 20 28 24
17 21 29 25
19 23 31 27
18 22 30 26
6-variable K-map: f(A,B,C,D,E,F)--Juxtapose two 5-var. K-submaps
one for the MSB A=0 and other for A=1
B=0 B=1
A=05-var.
K-submap
EF EF00 01 11 10
00
01
11
10
00 01 11 10
00
01
11
10
32 36 44 40
33 37 45 41
35 39 47 43
34 38 46 42
48 52 60 56
49 53 61 57
51 55 63 59
50 54 62 58
CD CD
CD CD
A=1
5-var.
K-submap
Adjacencies of a square: Adjacent squares of the 5-var.
K-submap plus the corresponding or mirror squarein the other 5-var. K-submap.
B=0 B=1
24
i bl f( ) l 25
-
8/13/2019 Ece lect2-
25/25
EF EF00 01 11 10
00
01
11
10
00 01 11 10
00
01
11
10
0 4 12 8
1 5 13 9
3 7 15 11
2 6 14 10
16 20 28 24
17 21 29 25
19 23 31 27
18 22 30 26
B=0 B=1
A=0
EF EF00 01 11 10
00
01
11
10
00 01 11 10
00
01
11
10
32 36 44 40
33 37 45 41
35 39 47 43
34 38 46 42
48 52 60 56
49 53 61 57
51 55 63 59
50 54 62 58
CD CD
A=1
B=1
6-variable K-map: f(A,B,C,D,E,F,)---Example:
CD CD
B=0
25