Transcript powerpoint

ELEC 2200-002
Digital Logic Circuits
Fall 2014
Logic Minimization (Chapter 3)
Vishwani D. Agrawal
James J. Danaher Professor
Department of Electrical and Computer Engineering
Auburn University, Auburn, AL 36849
http://www.eng.auburn.edu/~vagrawal
[email protected]
Fall 2014, Oct 13 . . .
ELEC2200-002 Lecture 5
1
Understanding Minimization . . .
Logic function:
F  a b  a b  bd  cd
a
AND
b
NOT
AND
OR
F
AND
c
AND
d
Fall 2014, Oct 13 . . .
ELEC2200-002 Lecture 5
2
. . . Understanding Minimization
Reducing products:
F  a b  a b  bd  cd
 b(a  a )  bd  cd
 b1  bd  cd
 b(c  c)  bd  cd
 bd  bc  cd  bc
 bd  bc  bc
 bd  b(c  c)
 bd  b
Fall 2014, Oct 13 . . .
ELEC2200-002 Lecture 5
Distributivity
Complementation
Identity
Complementation
Distribitivity
Consensus theorem
Distributivity
Complement, identity
3
. . . Understanding Minimization
Reduced SOP:
F  bd  b
b
NOT
OR
d
Fall 2014, Oct 13 . . .
F
AND
ELEC2200-002 Lecture 5
4
. . . Understanding Minimization
Reducing literals:
F  bd  b
db
b
bd
d
Absorption theorem
b
NOT
OR
d
F
Exercise: This circuit uses 8 transistors in CMOS technology.
Can you redesign it with 6 transistors? (Hint: Use de Morgan’s
Theorem.)
Fall 2014, Oct 13 . . .
ELEC2200-002 Lecture 5
5
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 2014, Oct 13 . . .
ELEC2200-002 Lecture 5
6
Product or Implicant or Cube
Any 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 0cube.
A 1-implicant or 1-cube is a product with
one variable eliminated:
Obtained by combining two adjacent 0-cubes
ABCD + ABCD = ABC(D +D) = ABC
Fall 2014, Oct 13 . . .
ELEC2200-002 Lecture 5
7
Cubes (Implicants) of 4 Variables
A
0
4
12
1
1
1
Minterm or
0-implicant or
0-cube
AB CD
8
5
13
What is this?
9
1
3
7
15
11
D
1
C
2
6
14
1
B
Fall 2014, Oct 13 . . .
ELEC2200-002 Lecture 5
10
1-implicant or
1-cube
ABD
8
Growing Cubes, Reducing Products
1-implicant or
1-cube
AB D
2-implicant or
2-cube
BD
C
A
0
4
12
8
1
5
13
9
1
1
3
7
2
6
1
15
1
14
B
What is this?
Fall 2014, Oct 13 . . .
ELEC2200-002 Lecture 5
11
D
10
1-implicant or
1-cube
ABD
9
Largest Cubes or Smallest Products
A
0
4
12
1
1
1
5
13
C
3
7
2
6
1
9
1
1
What is this?
8
15
1
14
10
1
1
B
Fall 2014, Oct 13 . . .
11
D
ELEC2200-002 Lecture 5
3-implicant or
3-cube
B
10
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 2014, Oct 13 . . .
ELEC2200-002 Lecture 5
11
Implicants of a Function
Minterms, products, cubes that imply the
function.
A
F  AB  BD  ACD  ABC D
0
4
12
1
1
1
5
13
3
7
1
2
6
1
1
9
1
1
C
8
15
14
1
11
D
10
B
Fall 2014, Oct 13 . . .
ELEC2200-002 Lecture 5
12
Prime Implicant (PI)
A cube or implicant of a function that cannot
grow larger by expanding into other cubes.
A
0
4
12
8
1
1
7
1
C
13
1
1
3
2
0
15
1
6
14
1
Fall 2014, Oct 13 . . .
1
9
1
1
1
D
11
5
3
C
7
2
ELEC2200-002 Lecture 5
13
1
1
1
1
10
12
8
1
1
1
B
4
1
1
5
A
PI
15
1
9
1
11
1
6
14
D
1
10
1
1
B
13
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).
A
1
C
Why not this?
Fall 2014, Oct 13 . . .
EPI
1
1
1
B
ELEC2200-002 Lecture 5
14
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).
A
1
C
RPI
Fall 2014, Oct 13 . . .
EPI
1
1
1
B
ELEC2200-002 Lecture 5
15
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.
A
1
1
C
SPI
Fall 2014, Oct 13 . . .
EPI
1
1
1
B
ELEC2200-002 Lecture 5
16
Minimum Sum of Products (MSOP)
Identify all prime implicants (PI) by letting
minterms and implicants grow.
Construct MSOP with PI only :
Cover all minterms
Use only essential prime implicants (EPI)
Use no redundant prime implicant (RPI)
Use cheaper selective prime implicants (SPI)
A good heuristic – Choose EPI in ascending order,
starting from 0-implicant, then 1-implicant, 2implicant, . . .
Fall 2014, Oct 13 . . .
ELEC2200-002 Lecture 5
17
Example: F=m(1,3,4,5,8,9,13,15)
A
0
4
12
8
1
1
1
5
1
13
1
MSOP:
F = AB D +A BC
+ A B D + ABC
9
1
1
D
3
7
15
1
11
1
C
2
6
RPI
Fall 2014, Oct 13 . . .
14
10
B
ELEC2200-002 Lecture 5
18
Example: F=m(1,3,5,7,8,10,12,13,14)
SPI
0
A
4
12
8
1
1
5
1
13
1
MSOP:
F = A D + A D + A BC
1
9
1
D
3
7
1
15
11
14
10
1
C
2
6
1
1
B
Fall 2014, Oct 13 . . .
ELEC2200-002 Lecture 5
19
Functions with Don’t Care Minterms
F(A,B,C) = m(0,3,7) + d(4,5)
Include don’t care minterms when beneficial.
A

1
1
C
A
1

C
B
1
1

B
F = B C +ABC
Fall 2014, Oct 13 . . .

1
ELEC2200-002 Lecture 5
F = B C +BC
20
Five-Variable Function
F(A,B,C,D,E)
= m(0,1,4,5,6,13,14,15,22,24,25,28,29,30,31)
B
A=0
0
4
1
1
D
8
20
28
5
1
13
1
7
9
15
6
17
21
29
1
1
11
1
2
16
1
1
3
12
B
A=1
14
1
10
E
19
D
1
23
31
1
25
1
E
27
1
18
22
30
1
C
24
26
1
C
F = ABD + A BD + B C E + C DE
Fall 2014, Oct 13 . . .
ELEC2200-002 Lecture 5
21
Multiple-Output Minimization
A
0
0
0
0
0
0
0
0
1
1
1
1
1
1
1
1
Fall 2014, Oct 13 . . .
Inputs
B
C
0
0
0
0
0
1
0
1
1
0
1
0
1
1
1
1
0
0
0
0
0
1
0
1
1
0
1
0
1
1
1
1
Outputs
D
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1
F1
0
1
0
0
0
1
0
1
0
1
0
0
0
1
0
1
ELEC2200-002 Lecture 5
F2
0
0
0
0
0
0
0
1
1
1
1
1
0
1
0
1
22
Individual Output Minimization
Need five products.
A
F1
0
4
12
A
F2
8
0
4
12
8
1
1
5
1
3
C
13
1
7
1
15
1
2
6
9
1
13
1
11
1
14
5
10
9
1
D
3
C
7
15
1
2
6
1
14
1
D
11
1
10
1
B
Fall 2014, Oct 13 . . .
B
ELEC2200-002 Lecture 5
23
Global Minimization
Need four products.
A
F1
0
4
12
A
F2
8
0
4
12
8
1
1
5
1
3
C
13
1
7
1
15
1
2
6
9
1
13
1
11
1
14
5
10
9
1
D
3
C
7
15
1
2
6
1
14
1
D
11
1
10
1
B
Fall 2014, Oct 13 . . .
B
ELEC2200-002 Lecture 5
24
Minimized SOP and POS
F(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)
=
=
A
0
4
12
1
1
5
1
3
7
1
C

2

13

15
1
6

14
A
8
0
=
9
1
D
11
1
C
10
B
BC +AD + C D
Fall 2014, Oct 13 . . .
12
5

13

0
9
0
D
3
7
15
11
2
6
14
10
0
F
F
8

0

F
4

0

0
B
= BD + CD + AC
= (B + D)(C + D)(A + C)
ELEC2200-002 Lecture 5
25
SOP and POS Circuits
F(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)
F = BC +AD + C D
F = (B + D)(C + D)(A + C)
A
C
B
A
F
C
F
D
D
B
Are two circuits functionally Identical?
Fall 2014, Oct 13 . . .
ELEC2200-002 Lecture 5
26
How Don’t Cares Occur
Consider two roads crossing:
Highway with traffic signal, red (R), yellow (Y) or green
(G).
Rural road with red (r) or green (g) signal.
Here R, Y, G, r and g are Boolean variables;
a 1 implies light is on, 0 means light is off.
Highway signals R, Y and G are controlled
by a computer; only one light can be on.
We only need to devise a digital circuit to
obtain g, because r =g.
Fall 2014, Oct 13 . . .
ELEC2200-002 Lecture 5
27
Traffic Signals
Fall 2014, Oct 13 . . .
ELEC2200-002 Lecture 5
28
Completely Specified Function
R
Truth Table
1
minterm
R
Y
G
g
0
0
0
0
0
1
0
0
1
0
2
0
1
0
0
Y
3
0
1
1
0
g = RYG
4
1
0
0
1
5
1
0
1
0
6
1
1
0
0
7
Fall 2014, Oct 13 . . .
1
1
1
0
G
R
g
Y
G
ELEC2200-002 Lecture 5
29
Incompletely Specified Function
R
Truth Table
minterm
R
Y
G
g
0
0
0
0
0
1
0
0
1
0
2
0
1
0
0
3
0
1
1
Φ
4
1
0
0
1
5
1
0
1
Φ
6
1
1
0
Φ
7
1
1
1
Φ
Fall 2014, Oct 13 . . .
Φ
G
ELEC2200-002 Lecture 5
Φ
1
Φ
Φ
Y
g=R
R
g
30
Absorption Theorem
For two Boolean variables: A, B
A+AB=A
Proof:
A
B
AB
Fall 2014, Oct 13 . . .
ELEC2200-002 Lecture 5
31
Consensus Theorem
For three Boolean variables: A, B, C
A B +A C + B C = A B +A C
Proof:
BC
A
B
AB
C
Fall 2014, Oct 13 . . .
ELEC2200-002 Lecture 5
AC
32
Growing Implicants to PI
F=
=
=
=
=
AB +CD +ABCD
AB +ABCD + BCD +CD
AB + BCD +CD
AB + BCD +CD + BD
AB +CD + BD
A
A
D
C
Fall 2014, Oct 13 . . .
A
D
C
B
initial implicants
consensus th.
absorption th.
consensus th.
absorption th.
D
C
B
ELEC2200-002 Lecture 5
B
33
Identifying EPI
Find all prime implicants.
From prime 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 2014, Oct 13 . . .
ELEC2200-002 Lecture 5
34
Example
PI SOP: F =
A D +AC +CD
Is AD an EPI?
F – {AD} =AC +CD, no new PI can be generated
Hence, AD is an EPI.
A
D
C
B
Fall 2014, Oct 13 . . .
ELEC2200-002 Lecture 5
AD
35
Example (Cont.)
PI SOP: F = A D +AC +CD
Is CD an EPI?
F – {CD } = A D +AC
= A D +AC +C D
(Consensus theorem)
HenceC D is not an EPI
(it is an RPI)
A
D
C
B
CD
Fall 2014, Oct 13 . . .
ELEC2200-002 Lecture 5
36
Finding MSOP
1. Start with minterm or cube SOP representation
2.
3.
4.
5.
6.
7.
of Boolean function.
Find all prime implicants (PI).
Include all EPI’s in MSOP.
Find the set of uncovered minterms, {UC}.
MSOP is minimum if {UC} is empty. DONE.
For a minterm in {UC}, include the largest PI
from remaining PI’s (non-EPI’s) in MSOP.
Go to step 4.
Fall 2014, Oct 13 . . .
ELEC2200-002 Lecture 5
37
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 2014, Oct 13 . . .
ELEC2200-002 Lecture 5
38
Example: # (Sharp) Operation
AD #CD = {A B C D, AB C D}
CD # AD = {A BC D,ABC D}
A
D
C
CD
Fall 2014, Oct 13 . . .
B
ELEC2200-002 Lecture 5
AD
39
Minterms Covered by a Product
A product from which k variables have
been eliminated, covers 2k minterms.
Example: For four variables, A, B, C, D
Product AC covers 22 = 4 minterms:
1) AB CD
A
2) AB C D
3) A B CD
D
4) A B C D
(4)
(2)
(3)
(1)
C
Obtained by inserting the
eliminated variables in all possible ways.
Fall 2014, Oct 13 . . .
ELEC2200-002 Lecture 5
B
40
Quine-McCluskey
Willard V. O. Quine
1908 – 2000
Fall 2014, Oct 13 . . .
Edward J. McCluskey
b. 1929
ELEC2200-002 Lecture 5
41
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 2014, Oct 13 . . .
ELEC2200-002 Lecture 5
42
Q-M Tabular Minimization
Minimizes 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.
MSOP contains all EPI’s and selected non-EPI’s.
Fall 2014, Oct 13 . . .
ELEC2200-002 Lecture 5
43
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 2014, Oct 13 . . .
Minterm
ABCD
Groups
2
0010
4
0100
8
1000
6
0110
9
1001
10
1010
12
1100
13
1101
3: three 1’s
15
1111
4: four 1’s
1: single 1
2: two 1’s
ELEC2200-002 Lecture 5
44
Q-M Step 2
Find all implicants by combining minterms, and
then combining products that differ in a single
variable: For example,
2 and 6, orAB CD and A B CD → A CD,
written as 0 – 1 0.
Try combining a minterm (or product) with all
minterms (or products) listed below in the table.
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 2014, Oct 13 . . .
ELEC2200-002 Lecture 5
45
Step 2 Executed on Example
List 1
List 2
Minterm ABCD PI? Minterms ABCD
_List 3
PI? Minterms ABCD
PI?
PI_1
2
0010
X
2, 6
0-10
PI_2 8,9,12,13
4
0100
X
2,10
-010
PI_3
8
1000
X
4,6
01-0
PI_4
6
0110
X
4,12
-100
PI_5
9
1001
X
8,9
100-
X
10
1010
X
8,10
10-0
PI_6
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
PI_7
Fall 2014, Oct 13 . . .
ELEC2200-002 Lecture 5
1-0-
46
Step 3: Identify EPI’s
Covered by EPI →
Minterms →
2
4
6
PI_1 is EPI
PI_2
x
PI_3
x
x
8
9
x
x
x
x
12
13
15
x
x
x
x
PI_5
x
x
x
x
PI_7 is EPI
Fall 2014, Oct 13 . . .
10
x
x
PI_4
PI_6
x
x
x
ELEC2200-002 Lecture 5
x
47
Step 4: Cover Remaining Minterms
Remaining minterms →
2
PI_2
x
PI_3
x
4
10
x
x
PI_4
x
PI_5
x
PI_6
6
x
x
Integer linear program (ILP), available from Matlab and other
sources: Define integer {0,1} variables, xk = 1, select PI_k;
xk = 0, do not select PI_k.
Minimize k xk, subject to constraints: x2 + x3 ≥ 1
x4 + x5 ≥ 1
x2 + x4 ≥ 1
x3 + x6 ≥ 1
A solution is x3 = x4 = 1, x2 = x5 = x6 = 0, or select PI_3, PI_4
Fall 2014, Oct 13 . . .
ELEC2200-002 Lecture 5
48
Linear Programming (LP)
A mathematical optimization method for problems
where some “cost” depends on a large number of
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 on linear programming are available in
Math, Business and Engineering departments.
Fall 2014, Oct 13 . . .
ELEC2200-002 Lecture 5
49
Q-M MSOP Solution and Verification
 F(A,B,C,D)

= PI_1 + PI_3 + PI_4 + PI_7
= 1-0- + -010 + 01-0 + 11-1
= AC +B CD +A BD + A B D
See Karnaugh map.
A
1
EPI’s in MSOP
1
1
1
1
D
1
C
1
Non-EPI’s in MSOP
Fall 2014, Oct 13 . . .
1
1
B
ELEC2200-002 Lecture 5
Non-EPI’s not
in MSOP
50
A
B
A
Minimized Circuit
C
B
D
C
D
PI1
PI3
F
PI4
PI7
Fall 2014, Oct 13 . . .
ELEC2200-002 Lecture 5
51
QM Minimizer on the Web
http://quinemccluskey.com/
Fall 2014, Oct 13 . . .
ELEC2200-002 Lecture 5
52
Function with Don’t Cares
F(A,B,C,D) =  m(4,6,8,9,10,12,13) +  d(2, 15)
Q-M Step 1: Group “all” minterms with 1
true variable, 2 true variables, etc.
Fall 2014, Oct 13 . . .
Minterm
ABCD
Groups
2
0010
4
0100
8
1000
6
0110
9
1001
10
1010
12
1100
13
1101
3: three 1’s
15
1111
4: four 1’s
1: single 1
2: two 1’s
ELEC2200-002 Lecture 5
53
Step 2: Same As Before on “All” Minterms
List 1
List 2
Minterm ABCD PI? Minterms ABCD
List 3
PI? Minterms ABCD
PI?
PI1
2
0010
X
2, 6
0-10
PI2 8,9,12,13
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
Fall 2014, Oct 13 . . .
ELEC2200-002 Lecture 5
1-0-
54
Step 3: Identify EPI’s Ignoring Don’t Cares
Covered by EPI →
Minterms →
4
6
PI1 is EPI
PI2
x
x
8
9
x
x
12
13
x
x
x
PI4
x
PI5
x
x
x
x
PI7
Fall 2014, Oct 13 . . .
x
x
PI3
PI6
10
x
x
x
ELEC2200-002 Lecture 5
55
Step 4: Cover Remaining Minterms
Remaining minterms →
4
PI_2
6
10
x
PI_3
x
PI_4
x
PI_5
x
PI_6
x
x
Integer linear program (ILP), available from Matlab and other
sources: Define integer {0,1} variables, xk = 1, select PI_k;
xk = 0, do not select PI_k.
Minimize k xk, subject to constraints: x4 + x5 ≥ 1
x2 + x4 ≥ 1
x3 + x6 ≥ 1
A solution is x3 = x4 = 1, x2 = x5 = x6 = 0, or select PI_3, PI_4
Fall 2014, Oct 13 . . .
ELEC2200-002 Lecture 5
56
Q-M MSOP Solution and Verification
 F(A,B,C,D)

= PI_1 + PI_3 + PI_4
= 1-0- + -010 + 01-0
= AC +B CD +A BD
See Karnaugh map.
A
1
EPI’s in MSOP
EPI’s not selected
1
1
1
1
D
1
C
1
Non-EPI’s in MSOP
Fall 2014, Oct 13 . . .
1
1
B
ELEC2200-002 Lecture 5
Non-EPI’s not
in MSOP
57
Minimized Circuit
A
C
B
A
B
D
C
D
PI1
PI3
F
PI4
Fall 2014, Oct 13 . . .
ELEC2200-002 Lecture 5
58
Further Reading
Incompletely specified functions: See
Example 3.25, pages 218-220.
Multiple output functions: See Example
3.26, pages 220-222.
Fall 2014, Oct 13 . . .
ELEC2200-002 Lecture 5
59