elec 2200-002 digital logic circuits fall 2008 logic minimization (chapter 3) vishwani d. agrawal...
TRANSCRIPT
ELEC 2200-002Digital Logic Circuits
Fall 2008Logic Minimization (Chapter 3)
Vishwani D. AgrawalJames J. Danaher Professor
Department of Electrical and Computer EngineeringAuburn University, Auburn, AL 36849http://www.eng.auburn.edu/~vagrawal
Fall 2008, Oct 13 . . .Fall 2008, Oct 13 . . . ELEC2200-002 Lecture 5ELEC2200-002 Lecture 5 11
Understanding MinimizationLogic function:
Fall 2008, Oct 13 . . .Fall 2008, Oct 13 . . . ELEC2200-002 Lecture 5ELEC2200-002 Lecture 5 22
cdbdbabaF a
b
c
d
F
AND
AND
AND
AND
OR
NOT
Understanding Minimization
Reducing products:
Fall 2008, Oct 13 . . .Fall 2008, Oct 13 . . . ELEC2200-002 Lecture 5ELEC2200-002 Lecture 5 33
bbd
ccbbdcbcbbd
cbcdcbbd
cdbdccbcdbd1b
cdbdaabcdbdbabaF
)(
)(
)(Distributivity
Complementation
Identity
Complementation
Distribitivity
Consensus theorem
Distributivity
Complement, identity
Understanding MinimizationReduced SOP:
Fall 2008, Oct 13 . . .Fall 2008, Oct 13 . . . ELEC2200-002 Lecture 5ELEC2200-002 Lecture 5 44
bbdF
b
d
FAND
OR
NOT
Understanding MinimizationReducing literals:
Fall 2008, Oct 13 . . .Fall 2008, Oct 13 . . . ELEC2200-002 Lecture 5ELEC2200-002 Lecture 5 55
bdbbdF
b
d FOR
NOT
Absorption theorem
db bd
Logic Minimization
Generally means– In SOP form:
Minimize number of products (reduce gates) and
Minimize literals (reduce gate inputs)
– In POS form:Minimize number of sums (reduce gates) and
Minimize literals (reduce gate inputs)
Fall 2008, Oct 13 . . .Fall 2008, Oct 13 . . . ELEC2200-002 Lecture 5ELEC2200-002 Lecture 5 66
Product or Implicant or CubeAny set of literals ANDed together.
Minterm is a special case where all variables are present. It is the largest product.
A minterm is also called a 0-implicant of 0-cube.
A 1-implicant or 1-cube is a product with one variable eliminated:
Obtained by combining two adjacent 0-cubes
ABCD + ABCD = ABC(D+D) = ABC
Fall 2008, Oct 13 . . .Fall 2008, Oct 13 . . . ELEC2200-002 Lecture 5ELEC2200-002 Lecture 5 77
Cubes (Implicants) of 4 VariablesCubes (Implicants) of 4 Variables
0 4 12 8
1 5 13 9
3 7 15 11
2 6 14 10
Fall 2008, Oct 13 . . .Fall 2008, Oct 13 . . . ELEC2200-002 Lecture 5ELEC2200-002 Lecture 5 88
A
B
C
D
1
1
1
Minterm or0-implicant or0-cubeAB CD
1-implicant or1-cubeABC
1
1
What is this?
Growing Cubes, Reducing ProductsGrowing Cubes, Reducing Products
0 4 12 8
1 5 13 9
3 7 15 11
2 6 14 10
Fall 2008, Oct 13 . . .Fall 2008, Oct 13 . . . ELEC2200-002 Lecture 5ELEC2200-002 Lecture 5 99
A
B
C
D
1
1
1-implicant or1-cubeAB C
1-implicant or1-cubeABC
1
1
2-implicant or2-cubeBC
What is this?
Largest Cubes or Smallest ProductsLargest Cubes or Smallest Products
0 4 12 8
1 5 13 9
3 7 15 11
2 6 14 10
Fall 2008, Oct 13 . . .Fall 2008, Oct 13 . . . ELEC2200-002 Lecture 5ELEC2200-002 Lecture 5 1010
A
B
C
D
1
1
What is this?
3-implicant or3-cubeB
1
1
1 1
1 1
Implication and Covering
A larger cube covers a smaller cube if all minterms of the smaller cube are included in the larger cube.
A smaller cube implies (or subsumes) a larger cube if all minterms of the smaller cube are included in the larger cube.
Fall 2008, Oct 13 . . .Fall 2008, Oct 13 . . . ELEC2200-002 Lecture 5ELEC2200-002 Lecture 5 1111
Implicants of a FunctionMinterms, products, cubes that imply the function.
Fall 2008, Oct 13 . . .Fall 2008, Oct 13 . . . ELEC2200-002 Lecture 5ELEC2200-002 Lecture 5 1212
0 4 12 8
1 5 13 9
3 7 15 11
2 6 14 10
A
B
C
D
1
1
1
1
1 1
1
1
DCBACDABCBAF
Prime Implicant (PI)A cube or implicant of a function that cannot grow larger by expanding into other cubes.
Fall 2008, Oct 13 . . .Fall 2008, Oct 13 . . . ELEC2200-002 Lecture 5ELEC2200-002 Lecture 5 1313
0 4 12 8
1 5 13 9
3 7 15 11
2 6 14 10
A
B
C
D
1
1
1
1
1
1
1
1
0 4 12 8
1 5 13 9
3 7 15 11
2 6 14 10
A
B
C
D
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
PI
Essential Prime Implicant (EPI)If among the minterms subsuming a prime implicant (PI), there is at least one minterm that is covered by this and only this PI, then the PI is called an essential prime implicant (EPI).
Also called essential prime cube (EPC).
Fall 2008, Oct 13 . . .Fall 2008, Oct 13 . . . ELEC2200-002 Lecture 5ELEC2200-002 Lecture 5 1414
1 1
1 1
A
B
C
EPI
Why not this?
Redundant Prime Implicant (RPI)If each minterm subsuming a prime implicant (PI) is also covered by other essential prime implicants, then that PI is called a redundant prime implicant (RPI).
Also called redundant prime cube (RPC).
Fall 2008, Oct 13 . . .Fall 2008, Oct 13 . . . ELEC2200-002 Lecture 5ELEC2200-002 Lecture 5 1515
1 1
1 1
A
B
C
EPI
RPI
Selective Prime Implicant (SPI)A prime implicant (PI) that is neither EPI nor RPI is called a selective prime implicant (SPI).
Also called selective prime cube (SPC).
SPIs occur in pairs.
Fall 2008, Oct 13 . . .Fall 2008, Oct 13 . . . ELEC2200-002 Lecture 5ELEC2200-002 Lecture 5 1616
1 1
1 1 1
A
B
C
EPI
SPI
Minimum Sum of Products (MSOP)
Identify all prime implicants (PI) by letting minterms and implicants to grow.
Construct MSOP with PI only :Cover all minterms
Use only essential prime implicants (EPI)
Use no redundant prime implicant (RfroPI)
Use cheaper selective prime implicants (SPI)
A good heuristic – Choose EPI in ascending order, starting from 0-implicant, then 1-implicant, 2-implicant, . . .
Fall 2008, Oct 13 . . .Fall 2008, Oct 13 . . . ELEC2200-002 Lecture 5ELEC2200-002 Lecture 5 1717
Example: F=m(1,3,4,5,8,9,13,15)
Fall 2008, Oct 13 . . .Fall 2008, Oct 13 . . . ELEC2200-002 Lecture 5ELEC2200-002 Lecture 5 1818
0 4
112 8
1
1
15
113
19
1
3
17 15
111
2 6 14 10
A
B
C
D
MSOP:F = AB D +A BC
+ A B D + ABC
RPI
Example: F=m(1,3,5,7,8,10,12,13,14)
Fall 2008, Oct 13 . . .Fall 2008, Oct 13 . . . ELEC2200-002 Lecture 5ELEC2200-002 Lecture 5 1919
0 4 12
18
1
1
15
113
19
3
17
115 11
2 6 14
110
1
A
B
C
D
MSOP:F = A D + A D + A BC
SPI
Functions with Don’t Care MintermsF(A,B,C) = m(0,3,7) + d(4,5)
Include don’t care minterms when beneficial.
Fall 2008, Oct 13 . . .Fall 2008, Oct 13 . . . ELEC2200-002 Lecture 5ELEC2200-002 Lecture 5 2020
1
1 1
A
B
C
1
1 1
A
B
C
F = B C +ABC F = B C +BC
Five-Variable FunctionsF(A,B,C,D,E)
= m(0,1,4,5,6,13,14,15,22,24,25,28,29,30,31)
Fall 2008, Oct 13 . . .Fall 2008, Oct 13 . . . ELEC2200-002 Lecture 5ELEC2200-002 Lecture 5 2121
0
14
112 8
1
15
113
19
3 7 15
111
2 6
114
110
A = 0 B
C
D
E
16
20
28
124
1
17
21
29
125
1
19 23 31
127
18 22
130
126
A = 1 B
C
D
E
F = ABD + A BD + B C E + C DE
Multiple-Output Minimization
Fall 2008, Oct 13 . . .Fall 2008, Oct 13 . . . ELEC2200-002 Lecture 5ELEC2200-002 Lecture 5 2222
Inputs OutputsA B C D F1 F20 0 0 0 0 00 0 0 1 1 00 0 1 0 0 00 0 1 1 0 00 1 0 0 0 00 1 0 1 1 00 1 1 0 0 00 1 1 1 1 11 0 0 0 0 11 0 0 1 1 11 0 1 0 0 11 0 1 1 0 11 1 0 0 0 01 1 0 1 1 11 1 1 0 0 01 1 1 1 1 1
0
4
12
8
1
1
5
13
19
1
3 7
115
111
1
2 6
14
10
1
0
4
12 8
1
15
113
19
1
3 7
115
111
2 6
14
10
Individual Output Minimization
Need five products.
Fall 2008, Oct 13 . . .Fall 2008, Oct 13 . . . ELEC2200-002 Lecture 5ELEC2200-002 Lecture 5 2323
F1 A
B
C
D
F2 A
B
C
D
0
4
12
8
1
1
5
13
19
1
3 7
115
111
1
2 6
14
10
1
0
4
12 8
1
15
113
19
1
3 7
115
111
2 6
14
10
Global Minimization
Need four products.
Fall 2008, Oct 13 . . .Fall 2008, Oct 13 . . . ELEC2200-002 Lecture 5ELEC2200-002 Lecture 5 2424
F1 A
B
C
D
F2 A
B
C
D
Minimized SOP and POSF(A,B,C,D) = m(1,3,4,7,11) + d(5,12,13,14,15)
= M(0,2,6,8,9,10) D(5,12,13,14,15)
Fall 2008, Oct 13 . . .Fall 2008, Oct 13 . . . ELEC2200-002 Lecture 5ELEC2200-002 Lecture 5 2525
0
04
12
8
0
1
5
13
9
0
3 7
15
11
2
06
014
10
0
0
4
112
8
1
1
5
13
9
3
17
115
11
12 6
14
10
A
B
C
D
A
B
C
D
F = BC +AD + C D F = BD + CD + AC F = (B + D)(C + D)(A + C)
SOP and POS CircuitsF(A,B,C,D) = m(1,3,4,7,11)+d(5,12,13,14,15)
= M(0,2,6,8,9,10) D(5,12,13,14,15)
Fall 2008, Oct 13 . . .Fall 2008, Oct 13 . . . ELEC2200-002 Lecture 5ELEC2200-002 Lecture 5 2626
F = BC +AD + C D F = (B + D)(C + D)(A + C)
A
B
C
D
F
A
B
C
D
F
Are two circuits functionally Identical?
Absorption TheoremFor two Boolean variables: A, B
A + A B = A
Proof:
Fall 2008, Oct 13 . . .Fall 2008, Oct 13 . . . ELEC2200-002 Lecture 5ELEC2200-002 Lecture 5 2727
BA
AB
Consensus TheoremFor three Boolean variables: A, B, C
A B +A C + B C = A B +A C
Proof:
Fall 2008, Oct 13 . . .Fall 2008, Oct 13 . . . ELEC2200-002 Lecture 5ELEC2200-002 Lecture 5 2828
BA
C
AB
AC
BC
Growing Implicants to PIF = AB +CD +ABCD initial implicants
= AB +ABCD + BCD +CD consensus th.
= AB + BCD +CD absorption th.
= AB + BCD +CD + BD consensus th.
= AB +CD + BD absorption th.
Fall 2008, Oct 13 . . .Fall 2008, Oct 13 . . . ELEC2200-002 Lecture 5ELEC2200-002 Lecture 5 2929
A
B
C
D
A
B
C
D
A
B
C
D
Identifying EPIFind all prime implicants.
From primary implicant SOP, remove a PI.
Apply consensus theorem to the remaining SOP.
If the removed PI is generated, then it is either an RPI or an SPI.
If the removed PI is not generated, then it is an EPI
Fall 2008, Oct 13 . . .Fall 2008, Oct 13 . . . ELEC2200-002 Lecture 5ELEC2200-002 Lecture 5 3030
ExamplePI SOP: F = A D +AC +CD
Is AD an EPI?
F – {AD} = AC +CD, no new PI can be generated
Hence, AD is an EPI.
Fall 2008, Oct 13 . . .Fall 2008, Oct 13 . . . ELEC2200-002 Lecture 5ELEC2200-002 Lecture 5 3131
A
B
C
D
AD
Example (Cont.)PI SOP: F = A D +AC +CD
Is CD an EPI?
F – {CD } = A D +AC
= A D +AC +C D (Consensus th.)
HenceC D is not an EPI
(it is an RPI)
Fall 2008, Oct 13 . . .Fall 2008, Oct 13 . . . ELEC2200-002 Lecture 5ELEC2200-002 Lecture 5 3232
A
B
C
D
CD
Finding MSOP1. Start with minterm or cube SOP representation
of Boolean function.
2. Find all prime implicants (PI).
3. Include all EPI’s in MSOP.
4. Find the set of uncovered minterms, {UC}.
5. MSOP is minimum if {UC} is empty. DONE.
6. For a minterm in {UC}, include the largest PI from remaining PI’s (non-EPI’s) in MSOP.
7. Go to step 4.
Fall 2008, Oct 13 . . .Fall 2008, Oct 13 . . . ELEC2200-002 Lecture 5ELEC2200-002 Lecture 5 3333
Finding Uncovered Minterms, {UC}
{UC} = ({PI} # {PMSOP}) # {DC}
Where:{PI} is set of all prime implicants of the function.
{PMSOP} is any partial SOP.
{DC} is set of don’t care minterms.
Sharp (#) operation between Boolean expressions X and Y, X # Y, is the set of minterms covered by X that are not covered by Y.
Fall 2008, Oct 13 . . .Fall 2008, Oct 13 . . . ELEC2200-002 Lecture 5ELEC2200-002 Lecture 5 3434
Example: # Operation
AD #CD = {A B C D, AB C D}
CD # AD = {A BC D,A BC D}
Fall 2008, Oct 13 . . .Fall 2008, Oct 13 . . . ELEC2200-002 Lecture 5ELEC2200-002 Lecture 5 3535
A
B
C
D
ADCD
Minterms Covered by a Product
A product from which k variables have been eliminated, covers 2k minterms.
Example: For four variables, A, B, C, DProduct AC covers 22 = 4 minterms:
1) AB CD
2) AB C D
3) A B CD
4) A B C D
Obtained by inserting the
eliminated variables in all possible ways.
Fall 2008, Oct 13 . . .Fall 2008, Oct 13 . . . ELEC2200-002 Lecture 5ELEC2200-002 Lecture 5 3636
(4) (2)
(3) (1)
A
B
C
D
Quine-McCluskeyQuine-McCluskey
Fall 2008, Oct 13 . . .Fall 2008, Oct 13 . . . Agrawal: ELEC2200-002 Lecture 5Agrawal: ELEC2200-002 Lecture 5 3737
Willard V. O. Quine1908 – 2000
Edward J. McCluskeyb. 1929
Quine-McCluskey Tabular Minimization Method
W. V. Quine, “The Problem of Simplifying Truth Functions,” American Mathematical Monthly, vol. 59, no. 10, pp. 521-531, October 1952.
E. J. McCluskey, “Minimization of Boolean Functions,” Bell System Technical Journal, vol. 35, no. 11, pp. 1417-1444, November 1956.
Textbook, Section 3.9, pp. 211-225.Fall 2008, Oct 13 . . .Fall 2008, Oct 13 . . . ELEC2200-002 Lecture 5ELEC2200-002 Lecture 5 3838
Q-M Tabular MinimizationMinimizes functions with many variables.
Begin with minterms:Step 1: Tabulate minterms in groups of increasing number of true variables.
Step 2: Conduct linear searches to identify all prime implicants (PI).
Step 3: Tabulate PI’s vs. minterms to identify EPI’s.
Step 4: Tabulate non-essential PI’s vs. minterms not covered by EPI’s. Select minimum number of PI’s to cover all minterms.
Fall 2008, Oct 13 . . .Fall 2008, Oct 13 . . . ELEC2200-002 Lecture 5ELEC2200-002 Lecture 5 3939
F(A,B,C,D) = m(2,4,6,8,9,10,12,13,15)
Q-M Step 1: Group minterms with 1 true variable, 2 true variables, etc.
Fall 2008, Oct 13 . . .Fall 2008, Oct 13 . . . ELEC2200-002 Lecture 5ELEC2200-002 Lecture 5 4040
Minterm ABCD Groups
2 0010
1: single 14 0100
8 1000
6 0110
2: two 1’s9 1001
10 1010
12 1100
13 1101 3: three 1’s
15 1111 4: four 1’s
Q-M Step 2Find all implicants by combining minterms, and then products that differ in one variable: For example,
2 and 6, orAB CD and A B CD → A CD, written as 0 – 1 0.
Try combining a minterm (or product) with all minterms (or products) listed below.
Include resulting products in the next list.
If minterm (or product) does not combine with any other, mark it as PI.
Check the minterm (or product) and repeat for all other minterms (or products).
Fall 2008, Oct 13 . . .Fall 2008, Oct 13 . . . ELEC2200-002 Lecture 5ELEC2200-002 Lecture 5 4141
Step 2 Executed on ExampleStep 2 Executed on Example
Fall 2008, Oct 13 . . .Fall 2008, Oct 13 . . . ELEC2200-002 Lecture 5ELEC2200-002 Lecture 5 4242
List 1 List 2 List 3
Minterm ABCD (X) Minterms ABCD (X) Minterms ABCD (X)
2 0010 X 2,6 0-10 PI2 8,9,12,13 1-0- PI1
4 0100 X 2,10 -010 PI3
8 1000 X 4,6 01-0 PI4
6 0110 X 4,12 -100 PI5
9 1001 X 8,9 100- X
10 1010 X 8,10 10-0 PI6
12 1100 X 8,12 1-00 X
13 1101 X 9,13 1-01 X
15 1111 X 12,13 110- X
13,15 11-1 PI7
Step 3 Identify EPI
Covered by EPI → x x x x x
Minterm → 2 4 6 8 9 10 12 13 15
PI1 x x x x
PI2 x x
PI3 x x
PI4 x x
PI5 x x
PI6 x x
PI7 x x
Fall 2008, Oct 13 . . .Fall 2008, Oct 13 . . . ELEC2200-002 Lecture 5ELEC2200-002 Lecture 5 4343
Step 4 Covering Remaining Minterms
Remaining minterm → 2 4 6 10
PI2 x x
PI3 x x
PI4 x x
PI5 x
PI6 x
Fall 2008, Oct 13 . . .Fall 2008, Oct 13 . . . ELEC2200-002 Lecture 5ELEC2200-002 Lecture 5 4444
Integer linear program (ILP), available from Matlab and other sources:Define integer {0,1} variables, xk = 1, select PIk; xk = 0, do not select PIk.Minimize k xk, subject to following constraints:
x2 + x3 ≥ 1x4 + x5 ≥ 1x2 + x4 ≥ 1x3 + x6 ≥ 1
A solution is x3 = x4 = 1, x2 = x5 = x6 = 0
Linear Programming (LP)A mathematical optimization method for problems where some “cost” depends on a large number of input variables.
An easy to understand introduction is:S. I. Gass, An Illustrated Guide to Linear Programming, New York: Dover Publications, 1970.
Very useful tool for a variety of engineering design problems.
Available in software packages like Matlab.
Courses available in Math, Business and Engineering departments.
Fall 2008, Oct 13 . . .Fall 2008, Oct 13 . . . ELEC2200-002 Lecture 5ELEC2200-002 Lecture 5 4545
Q-M Solution and Verification F(A,B,C,D) = PI1 + PI3 + PI4 + PI7
= 1-0- + -010 + 01-0 + 11-1
= AC +B CD +A BD + A B D See Karnaugh map.
Fall 2008, Oct 13 . . .Fall 2008, Oct 13 . . . ELEC2200-002 Lecture 5ELEC2200-002 Lecture 5 4646
1 1 1
1 1
1
1 1 1
A
B
C
D
Further Reading
Incompletely specified functions: See Example 3.25, pages 218-220.
Multiple outputs: See Example 3.26, pages 220-222.
Fall 2008, Oct 13 . . .Fall 2008, Oct 13 . . . ELEC2200-002 Lecture 5ELEC2200-002 Lecture 5 4747