Lecture 15

advertisement
Digital Logic Design
Lecture 15
Announcements
• HW5 due today
• Upcoming: Midterm on Tuesday, 10/28.
– Will post list of topics and review problems.
Agenda
• Last time:
– Quine-McClusky (4.8)
– Table Reductions (4.10)
• This time:
– Multiple Output Simplification Problem (4.12,
4.13)
The Multiple-Output Simplification
Problem
• General combinational networks can have several output
terminals.
• The output behavior of the network is described by a set of
functions 𝑓1 , 𝑓2 , … , π‘“π‘š , one for each output terminal, each
involving the same input variables, π‘₯1 , π‘₯2 , … , π‘₯𝑛 .
• The set of functions is represented by a truth table with
π‘š + 𝑛 columns.
• Objective is to design a multiple-output network of minimal
cost.
• Formally: A set of normal expressions that has associated
with it a minimal cost as given by some cost criteria.
• Cost criteria: number of gates or number of gate inputs in
the realization.
Pitfalls of Naïve Approach
• Multiple-output minimization problem is
normally more difficult than sharing common
terms in independently obtained minimal
expressions.
• Consider:
𝑓1 π‘₯, 𝑦, 𝑧 = ∑π‘š 1,3,5
𝑓2 π‘₯, 𝑦, 𝑧 = ∑π‘š(3,6,7)
𝑓1 π‘₯, 𝑦, 𝑧 = 𝑦𝑧 + π‘₯𝑧
𝑓2 π‘₯, 𝑦, 𝑧 = 𝑦𝑧 + π‘₯𝑦
Pitfalls of Naïve Approach
Naïve Approach:
𝑦
𝑧
𝑦
𝑧
𝑓1
𝑓2
π‘₯
π‘₯
𝑧
𝑦
Better Approach:
𝑦
𝑧
π‘₯
𝑦
𝑧
π‘₯
𝑦
𝑓1
𝑓2
Multiple Output Prime Implicants
• A multiple-output prime implicant for a set of
Boolean functions 𝑓1 , 𝑓2 , … , π‘“π‘š , is a product
term that:
– Is a prime implicant of one of the individual
functions
– Is a prime implicant of one of the product
functions Π𝑖∈𝑆 𝑓𝑖 , 𝑆 ⊆ {1, . . , π‘š}
Examples of Multiple Output Prime
Implicants
𝒙
π’š
𝒛
π’‡πŸ
π’‡πŸ
0
0
0
1
0
0
0
1
0
1
0
1
0
1
1
0
1
1
0
0
1
0
0
0
1
1
0
1
1
1
1
1
0
1
0
1
1
1
0
1
𝑦𝑧 is a prime implicant of 𝑓1
Examples of Multiple Output Prime
Implicants
𝒙
π’š
𝒛
π’‡πŸ
π’‡πŸ
π’‡πŸ ⋅ π’‡πŸ
0
0
0
1
0
0
0
0
1
0
1
0
0
1
0
1
1
1
0
1
1
0
0
0
1
0
0
0
1
0
1
0
1
1
1
1
1
1
0
1
1
0
1
1
1
0
1
0
π‘₯𝑦𝑧 is a prime implicant of 𝑓1 ⋅ 𝑓2
Multiple Output Prime Implicants
Theorem: Formulas that achieve the multipleoutput minimal sum consist only of sums of
multiple-output prime implicants such that all
the terms in the expression for 𝑓𝑖 or of a product
function involving 𝑓𝑖
Tagged Product Terms
• Term consists of two parts: a kernel and a tag.
– Kernel: product term involving the variables of
the function
– Tag: Appended to denote which functions are
implied by its kernel.
Tagged Product Term Example
𝒙
π’š
𝒛
π’‡πŸ
π’‡πŸ
0
0
0
1
0
Algebraic Form
Binary Form
0
0
1
1
1
π‘₯ 𝑦 𝑧𝑓1 −
000𝑓1 −
0
1
0
0
1
π‘₯ 𝑦𝑧𝑓1 𝑓2
001𝑓1 𝑓2
0
1
1
0
0
π‘₯𝑦𝑧𝑓1 𝑓2
010𝑓1 𝑓2
1
0
0
0
0
π‘₯𝑦𝑧 − 𝑓2
011 − 𝑓2
1
0
1
1
--
π‘₯𝑦𝑧𝑓1 𝑓2
101𝑓1 𝑓2
1
1
0
0
0
π‘₯𝑦𝑧𝑓1 𝑓2
111𝑓1 𝑓2
1
1
1
1
1
Quine-McClusky for tagged multipleoutput prime implicants
0
0
0
0 𝑓1
−
(0,1)
0
0 − 𝑓1
−
(1,3,5,7)
−
−
1 −
𝑓2
1
0
0
1 𝑓1
𝑓2
(0,2)
0 −
0 𝑓1
−
(1,5,3,7)
−
−
1 −
𝑓2
2
0
1
0 𝑓1
𝑓2
(1,3)
0 −
1 −
𝑓2
3
0
1
1 −
𝑓2
(1,5)
−
0
1 𝑓1
𝑓2
5
1
0
1 𝑓1
𝑓2
(2,3)
0
1 − −
𝑓2
7
1
1
1 𝑓1
𝑓2
(3,7)
−
1
1 −
𝑓2
(5,7)
1 −
1 𝑓1
𝑓2
Why doesn’t
(0,1,2,3) appear?
• The tag of a generated term has 𝑓𝑖 iff 𝑓𝑖 appears in both the tags of the
generating terms.
• A generating term is checked only if its tag is identical to the tag of the
generated term.
Minimal Sums Using Petrick’s Method
Multiple Outputs Prime Implicant
Tables
π’ŽπŸŽ π’ŽπŸ π’ŽπŸ π’ŽπŸ“ π’ŽπŸ• π’ŽπŸ π’ŽπŸ π’ŽπŸ‘ π’ŽπŸ•
𝑓1
B
π‘₯𝑦
X
𝑓1
C
π‘₯𝑧
X
𝑓2
A
𝑧
𝑓2
E
π‘₯𝑧
𝑓1 ⋅ 𝑓2
D
𝑦𝑧
𝑓1 ⋅ 𝑓2
F
π‘₯𝑧
𝑓1 ⋅ 𝑓2
G π‘₯𝑦𝑧
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
Multiple Outputs Prime Implicant
Tables
π’ŽπŸŽ π’ŽπŸ π’ŽπŸ π’ŽπŸ“ π’ŽπŸ• π’ŽπŸ π’ŽπŸ π’ŽπŸ‘ π’ŽπŸ•
𝑓1
B
π‘₯𝑦
X
𝑓1
C
π‘₯𝑧
X
𝑓2
A
𝑧
𝑓2
E
π‘₯𝑧
𝑓1 ⋅ 𝑓2
D
𝑦𝑧
𝑓1 ⋅ 𝑓2
F
π‘₯𝑧
𝑓1 ⋅ 𝑓2
G π‘₯𝑦𝑧
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
When writing down p-expression, must make a distinction between primes
associated with different functions.
Multiple Outputs Prime Implicant
Tables
π’ŽπŸŽ π’ŽπŸ π’ŽπŸ π’ŽπŸ“ π’ŽπŸ• π’ŽπŸ π’ŽπŸ π’ŽπŸ‘ π’ŽπŸ•
𝑓1
B
π‘₯𝑦
X
𝑓1
C
π‘₯𝑧
X
𝑓2
A
𝑧
𝑓2
E
π‘₯𝑧
𝑓1 ⋅ 𝑓2
D
𝑦𝑧
𝑓1 ⋅ 𝑓2
F
π‘₯𝑧
𝑓1 ⋅ 𝑓2
G π‘₯𝑦𝑧
X
X
X
X
X
X
X
X
X
X
X
X
X
X
X
P-expression: (𝐡1 + 𝐢1 )(𝐡1 + 𝐷1 )(𝐢1 + 𝐺1 )(𝐷1 + 𝐹1 )(𝐴2 + 𝐷2 )(𝐸2 + 𝐺2 )(𝐴2 +
𝐸2 )(𝐴2 + 𝐹2 )
Manipulating P-expression into sum of
product form
𝑝
= 𝐡1 + 𝐢1 𝐡1 + 𝐷1 𝐢1 + 𝐺1 𝐷1 + 𝐹1 𝐹1 (𝐴2
Calculating Cost of Product Terms
• The term 𝐴2 𝐡1 𝐹1 𝐺1 𝐺2 yields
– 𝑓1 π‘₯, 𝑦, 𝑧 = π‘₯ 𝑦 + π‘₯𝑧 + π‘₯𝑦 𝑧
– 𝑓2 π‘₯, 𝑦, 𝑧 = 𝑧 + π‘₯𝑦𝑧
• The term 𝐢1 𝐷1 𝐷2 𝐸2 𝐹1 𝐹2 yields
– 𝑓1 π‘₯, 𝑦, 𝑧 = π‘₯ 𝑧 + 𝑦𝑧 + π‘₯𝑧
– 𝑓2 π‘₯, 𝑦, 𝑧 = 𝑦𝑧 + π‘₯𝑦 + π‘₯𝑧
Calculating Cost of multiple output
combinational network
𝑓1 , … , π‘“π‘š
π‘š
𝑝
𝛼𝑖 +
𝑖=1
𝛽𝑗
𝑗=1
Where 𝑑1 , … , 𝑑𝑝 is the set of distinct terms, 𝛽𝑗 is
equal to the number of literals in 𝑑𝑗 , unless the
term consists of a single literal, in which case
𝛽𝑗 = 0. Let 𝛼𝑖 be the number of terms in
𝑓𝑖 unless there is only a single term, in which
case 𝛼𝑖 = 0.
Calculating Cost of Product Terms
• The term 𝐴2 𝐡1 𝐹1 𝐺1 𝐺2 yields
– 𝑓1 π‘₯, 𝑦, 𝑧 = π‘₯ 𝑦 + π‘₯𝑧 + π‘₯𝑦 𝑧
– 𝑓2 π‘₯, 𝑦, 𝑧 = 𝑧 + π‘₯𝑦𝑧
Distinct terms: π‘₯ 𝑦, π‘₯𝑧, π‘₯𝑦 𝑧, z
Beta costs: 2 + 2 + 3 + 0 = 7
Alpha costs = 3 + 2 = 5
Total cost: 12
• The term 𝐢1 𝐷1 𝐷2 𝐸2 𝐹1 𝐹2 yields
– 𝑓1 π‘₯, 𝑦, 𝑧 = π‘₯ 𝑧 + 𝑦𝑧 + π‘₯𝑧
– 𝑓2 π‘₯, 𝑦, 𝑧 = 𝑦𝑧 + π‘₯𝑦 + π‘₯𝑧
Distinct terms: π‘₯ 𝑧, 𝑦𝑧, π‘₯𝑧, π‘₯𝑦
Beta costs: 2+2+2+2 = 8
Alpha costs = 3 +3 = 6
Total cost: 14
Minimal Sums using Table Reduction
Table Reduction
π’ŽπŸŽ π’ŽπŸ π’ŽπŸ π’ŽπŸ“ π’ŽπŸ• π’ŽπŸ π’ŽπŸ π’ŽπŸ‘ π’ŽπŸ• Cost
B π‘₯𝑦
X
C
π‘₯𝑧
X
A
𝑧
E
π‘₯𝑧
D
𝑦𝑧
F
π‘₯𝑧
G π‘₯𝑦𝑧
X
3
X
3
X
X
X
X
X
X
X
X
X
1
3
X
3,4
X
X
X
3,4
4,5
Table Reduction
π’ŽπŸŽ π’ŽπŸ π’ŽπŸ π’ŽπŸ“ π’ŽπŸ• π’ŽπŸ π’ŽπŸ π’ŽπŸ‘ π’ŽπŸ• Cost
B π‘₯𝑦
X
C
π‘₯𝑧
X
A
𝑧
E
π‘₯𝑧
D
𝑦𝑧
F
π‘₯𝑧
G π‘₯𝑦𝑧
X
3
X
3
X
X
X
X
X
X
X
X
X
1
3
X
3,4
X
X
X
3,4
4,5
Essential prime
implicant for 𝑓1 .
Table Reduction
π’ŽπŸŽ π’ŽπŸ π’ŽπŸ π’ŽπŸ π’ŽπŸ π’ŽπŸ‘ π’ŽπŸ• Cost
B
π‘₯𝑦
X
C
π‘₯𝑧
X
A
𝑧
E
π‘₯𝑧
D
𝑦𝑧
X
3
X
3
X
X
X
X
π‘₯𝑦𝑧
X
3,4
X
X
1
3
X
*1 F π‘₯𝑧
G
X
X
𝑓1 = π‘₯𝑧 + β‹―
𝑓2 = β‹―
1
4,5
π‘š7 column cannot
be removed from
𝑓2 part since π‘₯𝑧 is
not essential for 𝑓2 .
Table Reduction
π’ŽπŸŽ π’ŽπŸ π’ŽπŸ π’ŽπŸ π’ŽπŸ π’ŽπŸ‘ π’ŽπŸ• Cost
B
π‘₯𝑦
X
C
π‘₯𝑧
X
A
𝑧
E
π‘₯𝑧
D
𝑦𝑧
X
3
X
3
X
X
X
X
π‘₯𝑦𝑧
X
3,4
X
X
1
3
X
*1 F π‘₯𝑧
G
X
X
𝑓1 = π‘₯𝑧 + β‹―
𝑓2 = β‹―
1
4,5
Dominated Rows
Table Reduction
π’ŽπŸŽ π’ŽπŸ π’ŽπŸ π’ŽπŸ π’ŽπŸ π’ŽπŸ‘ π’ŽπŸ• Cost
B
π‘₯𝑦
X
C
π‘₯𝑧
X
A
𝑧
E
π‘₯𝑧
D
𝑦𝑧
X
3
X
3
X
X
X
X
π‘₯𝑦𝑧
X
3,4
X
X
1
3
X
*1 F π‘₯𝑧
G
X
X
𝑓1 = π‘₯𝑧 + β‹―
𝑓2 = β‹―
1
4,5
Dominated Rows
Row A dominates Row F
Cost for Row A is not
greater than cost for
Row F.
Table Reduction
π’ŽπŸŽ π’ŽπŸ π’ŽπŸ π’ŽπŸ π’ŽπŸ π’ŽπŸ‘ π’ŽπŸ• Cost
B
π‘₯𝑦
X
C
π‘₯𝑧
X
A
𝑧
E
π‘₯𝑧
D
𝑦𝑧
G
π‘₯𝑦𝑧
X
3
X
3
X
X
X
X
X
X
X
X
1
3
3,4
X
𝑓1 = π‘₯𝑧 + β‹―
𝑓2 = β‹―
4,5
Table Reduction
π’ŽπŸŽ π’ŽπŸ π’ŽπŸ π’ŽπŸ π’ŽπŸ π’ŽπŸ‘ π’ŽπŸ• Cost
B
π‘₯𝑦
X
C
π‘₯𝑧
X
A
𝑧
E
π‘₯𝑧
D
𝑦𝑧
G
π‘₯𝑦𝑧
X
3
X
3
X
X
X
X
X
X
X
X
1
3
3,4
X
𝑓1 = π‘₯𝑧 + β‹―
𝑓2 = β‹―
4,5
Only row that covers π‘š7
Table Reduction
π’ŽπŸŽ π’ŽπŸ π’ŽπŸ π’ŽπŸ Cost
B
π‘₯𝑦
X
C
π‘₯𝑧
X
*2 A
𝑧
E
π‘₯𝑧
D
𝑦𝑧
G
π‘₯𝑦𝑧
X
3
X
3
1
X
X
3
3,4
X
X
4,5
𝑓1 = π‘₯𝑧 + β‹―
𝑓2 = 𝑧 + β‹―
Delete π‘š1 , π‘š3 , π‘š7
Table Reduction
π’ŽπŸŽ π’ŽπŸ π’ŽπŸ π’ŽπŸ Cost
B
π‘₯𝑦
X
C
π‘₯𝑧
X
E
π‘₯𝑧
D
𝑦𝑧
G
π‘₯𝑦𝑧
X
3
X
3
X
X
3
3
X
X
4,5
𝑓1 = π‘₯𝑧 + β‹―
𝑓2 = 𝑧 + β‹―
Delete row A
Table Reduction
π’ŽπŸŽ π’ŽπŸ π’ŽπŸ π’ŽπŸ Cost
B
π‘₯𝑦
X
C
π‘₯𝑧
X
E
π‘₯𝑧
D
𝑦𝑧
G
π‘₯𝑦𝑧
X
3
X
3
X
X
3
3
X
X
4,5
𝑓1 = π‘₯𝑧 + β‹―
𝑓2 = 𝑧 + β‹―
Row D is dominated by
Row B.
Table Reduction
π’ŽπŸŽ π’ŽπŸ π’ŽπŸ π’ŽπŸ Cost
B
π‘₯𝑦
X
C
π‘₯𝑧
X
E
π‘₯𝑧
D
𝑦𝑧
G
π‘₯𝑦𝑧
X
3
X
3
X
X
3
3
X
X
4,5
𝑓1 = π‘₯𝑧 + β‹―
𝑓2 = 𝑧 + β‹―
Row D is dominated by
Row B.
Table Reduction
π’ŽπŸŽ π’ŽπŸ π’ŽπŸ π’ŽπŸ Cost
B
π‘₯𝑦
X
C
π‘₯𝑧
X
E
π‘₯𝑧
G
π‘₯𝑦𝑧
X
3
X
X
3
X
3
X
4,5
𝑓1 = π‘₯𝑧 + β‹―
𝑓2 = 𝑧 + β‹―
Row D is dominated by
Row B.
Table Reduction
π’ŽπŸŽ π’ŽπŸ π’ŽπŸ π’ŽπŸ Cost
B
π‘₯𝑦
X
C
π‘₯𝑧
X
E
π‘₯𝑧
G
π‘₯𝑦𝑧
X
3
X
X
3
X
3
X
4,5
𝑓1 = π‘₯𝑧 + β‹―
𝑓2 = 𝑧 + β‹―
Row B is the only row
covering π‘š1
Table Reduction
π’ŽπŸŽ π’ŽπŸ π’ŽπŸ π’ŽπŸ Cost
*1 B π‘₯ 𝑦
X
C
π‘₯𝑧
X
E
π‘₯𝑧
G
π‘₯𝑦𝑧
X
3
X
X
3
X
3
X
4,5
𝑓1 = π‘₯𝑧 + π‘₯ 𝑦 + β‹―
𝑓2 = 𝑧 + β‹―
Row B is the only row
covering π‘š1
Table Reduction
π’ŽπŸ π’ŽπŸ Cost
*1 B π‘₯ 𝑦
C
π‘₯𝑧
E
π‘₯𝑧
G
π‘₯𝑦𝑧
3
X
X
3
X
3
X
4,5
𝑓1 = π‘₯𝑧 + π‘₯ 𝑦 + β‹―
𝑓2 = 𝑧 + β‹―
Delete columns π‘š0 , π‘š1
Table Reduction
π’ŽπŸ π’ŽπŸ Cost
C
π‘₯𝑧
E
π‘₯𝑧
G
π‘₯𝑦𝑧
X
X
3
X
3
X
4,5
𝑓1 = π‘₯𝑧 + π‘₯ 𝑦 + β‹―
𝑓2 = 𝑧 + β‹―
Delete columns π‘š0 , π‘š1
Table Reduction
π’ŽπŸ π’ŽπŸ Cost
C
π‘₯𝑧
E
π‘₯𝑧
G
π‘₯𝑦𝑧
X
X
3
X
3
X
4,5
𝑓1 = π‘₯𝑧 + π‘₯ 𝑦 + β‹―
𝑓2 = 𝑧 + β‹―
Cannot delete dominated
rows since their cost is
lower.
**Table is cyclic**
Table Reduction
π’ŽπŸ π’ŽπŸ Cost
C
π‘₯𝑧
E
π‘₯𝑧
G
π‘₯𝑦𝑧
X
X
3
X
3
X
4,5
𝑓1 = π‘₯𝑧 + π‘₯ 𝑦 + π‘₯𝑦𝑧
𝑓2 = 𝑧 + π‘₯𝑦𝑧
Cannot delete dominated
rows since their cost is
lower.
**Table is cyclic**
Download