Transcript ppt

Multi Function Quine-McCluskey 2-Level
Minimization
Shantanu Dutt
University of Illinois at Chicago
Acknowledgement: Transcribed to Powerpoint by Huan Ren from
Prof. Shantanu Dutt’s handwritten notes
Multiple Output Q-M
 General digital system:
Multiple
i/p’s
Multiple
o/p’s
Share gates as much as
possible to reduce cost
Sometimes sharing reduces cost; however indiscriminate
sharing (e.g., having canonical SOPs for all functions) can
actually increase cost.
Q: How to do this optimally or near-optimally?
A: Multi-function Q-M is one such technique.
Multiple Output Q-M
Example 1:
f   m(1,3,5,7,13,15)
f    m(8,9,10,11,13,15)
 Separate consideration
f  AD  BD cost  6
A
D
B
D
fα
f   AB  AD cost  6
B
A
A
D
fβ
CD
AB
00 01 11
10
ADα 00
0
8
01
1
11
3
10
2
4
12
1α
5
1α
13
1α
7
1α
15
6
1α β
1α β
14
BDα
1β
9
1 β ADβ
11
1β
10
1β ABβ
ABDαβ
No common implicants used →
Total cost =12 [six 2-i/p gates] →
12*2=24 transistors
Multiple Output Q-M
 Example 1 (contd): Now consider common implicants—
PIs of the function f.f—for inclusion first in each function:
f  AD  ABD
f   AB  ABD
 Total cost =
A
D
A
B
D
A
B
4 trans.
4 trans.
fα
6 trans.
4 trans.
4 trans.
fβ
 Total literals in distinct/different implicants + total # of implicants
(for the 2nd term a common impl. occurring multiple times is
counted as many times as it occurs) over all functions
= (2+2+3)+4=11  22 transistors (8% cost reduction from
separate consideration of the 2 functions)
Multiple Output Q-M
Example 2:
f   m(3, 4,5,7,13,15)
CD
00 01 11
10 ACDβ
ABCα 00
0
4
1α
12
1β
8
01
1
5
1α
13
1α β
9
11
3
7
1α
15
6
xβ
14
f    m(8,12,13,14,15)   d(6)
 Taken separately
ACDα
10
f  ACD  ABC  BD cost  8  3  11
f   AB  ACD cost  5  2  7
Total cost=18
AB
2
1α
Xβ
ABDα β
1α β
1β
1β
11
10
CDβ
Xβ
BDα
ABβ
Multiple Output Q-M (contd.)
 Example 2 (contd): Use heuristic “Always
include common implicants”
f  ACD  ABC  ABD
f   ACD  ABD  BCD
Total cost= 14+6=20 (11% cost increase using the above
heuristic, from separate consideration of the 2 functions)
So how do we determine optimally
when and when not to include a
common term in an expression ?
This can be achieved by the
multiple-function QM method.
Multiple-function QM
 Difference with single function QM
(1) Each minterm is tagged by “flag(s)” of the function it is in.
(2) For PI formation, the impl./min-term list is formed for all minterms/DCs simultaneously over all functions.
(3) Two impl’s (incl. minterms) can be combined only if they
contain same common flags. The new impl. formed by this
combining is flagged by the set of common (intersecting) flags.
(4) An impl. i that was combined to form a larger impl. can be
“checked” (i.e., covered) only if the combined impl. contains
all the flags that i contains. In other words, an implicant is
covered in the multi-function context if it is covered in each
func. that it is an implicant in.
(5) In the PIT, the cols are separated by functions, and each
minterm for a function is listed under its function’s group—thus
a minterm will have separate cols for each function it belongs
to.
(6) In the PIT, each PI covers minterms only for functions whose
flags it contains.
Multiple-function QM (contd.)
 All other rules of PIT reduction applies,
including the heuristic rules for cyclic PITs
(further clarification & caveats given later).
Back to
Example 1
f   m(1,3,5, 7,13,15)
f    m(8,9,10,11,13,15)
Min
term
List 1
Flags
Min
term
List 2
Min
Flags
term
List 3
Flags
1
0001 α
1,3
00-1 α
1,3,5,7
0--1 α PI2
8
1000 β
1,5
0-01 α
8,9,10,11
10-- β PI3
3
0011 α
8,9
100- β
5,7,13,15
-1-1 α PI4
5
0101 α
8,10
10-0 β
9,11,13,15
1--1 β PI5
9
1001 β
3,7
0-11
10
1010 β
5,7
01-1 α
7
0111 α
5,13
-101 α
Example 1 (contd.):
11
1011 β
9,11
10-1 β
13
1101 α β
9,13
1-01 β
f   m(1,3,5, 7,13,15)
15
1111 α β
10,11 101- β
α
-111
α
11,15 1-11
β
13,15 11-1
αβ
7,15
f    m(8,9,10,11,13,15)
PI1
 PI table:
When incl. a multifunc. PI, mark the *
w/ only the flags for
which it is included
*,
*
*
C
1
1
1
1
5
5
2
2
2
fα
PIs
5
3+1
PI1αβ
1
2+1
PI2α
2
2+1
PI3β
3
2+1
PI4α
4
2+1
PI5β
1 3 5
2
5
5
fβ
7
13
15
8
9
10
11
13 15
More Rules:
Rule 5: The row cov. rules (1 and 1’) apply across the entire PIT, not just in the sub-PIT
corresponding to each function. However, the col. cov. rule applies only within the sub-PIT
corresponding to a single function (has to do w/ cost issues similar to Rule 6).
Ruke 6: The EPI/pseudo-EPI defn. also applies to only single functions, and if a multi-function PI g is
an EPI for some funcs and not for all for which it is an impl, it is only chosen for the former
function(s) and not right away for the latter. After this partial inclusion (for some funcs), g’s cost is
reduced to 1, and it maybe chosen later for other functions based on this reduced cost. This
reduced cost of 1 is not changed any more after future inclusions. The reduction in cost
corresponds to the AND gate cost of g which has already been incurred. The remaining cost of 1
corresponds to the OR gate cost in each remaining function for which it may be included later.
Note: We will provide an alternative for rule (6) in which an EPI/pseudo-EPI for one func. is also
automatically included in all other funcs for which it is an implicant. This alternative uses a sweep(same good soln. of cost 11
up phase.
f  PI  PI f  PI  PI obtnd. via the include all

1
2

1
3
common impl. heuristic)
Back to
Example 2:
Min
term
f   m(3, 4,5,7,13,15)
List 1
Flags
Min
term
f    m(8,12,13,14,15)   d(6)
List 2
Min
Flags
List 3
term
4
0100 α
4,5
010- α
PI1 5,7,13,15
8
1000 β
8,12
1-00 β
PI2 12,13,14,15 11-- β PI6
3
0011 α
3,7
0-11
5
0101 α
5,7
01-1 α
6
0110 β
5,13
-101 α
12
1100 β
6,14
-110
β
7
0111 α
12,13 110-
β
13
1101 α β
12,14 11-0
β
14
1110 β
7,15
α
15
1111 α β
13,15 11-1
αβ
14,15 111-
β
-111
α
PI3
PI7
PI4
-1-1 α PI5
3 1
1
3
7
7
2
2
fα
*
*
*
PIs
C
1
PI1α
3+1
2
PI2β
3+1
3
PI3α
3+1
PI5α
2+1
PI6β
2+1
4
PI7β
3+1
* 7
* 5
7
13
f  PI1  PI3  PI5
f   PI2  PI6
5
5
fβ
15
8
12 13 14 15
PI4αβ 3+1
C
C
6
3 4 5
5
Total cost
=13+5=18
Not the bad soln. of cost 20 obtained via the
include-all-common-implicants heuristic. Here it
was more expensive to include any common
implicant, and so none were incuded by multi-QM
Example 3
DE
BC
A=0
00 01 11
10
00
0
4
1α
12
1β
8
01
1
5
1α β
13
1α β
9
11
3
7
1α β
15
10
2
6
1α
14
1α β
1β
DE
1α
11
10
ABCα ACEαβ
ABCβ ABDEα
PI1
PI3
PI2
PI4
BC
A=1
00 01 11
10
00
16
20
28
24
01
17
21
1β
29
25
11
19
23
1α
31
10
18
22
1
α
30
1α
CDEβ
CDEα
PI5
PI6
1β
27
1α
1β
1α
26
ADEα
PI7
 Taking # of MTs covered and cost into consideration
fα
C
PIs
*β1
*α 8
* 5
* 2
3+1
PI1α
3+1
1
PI2αβ
3+1
PI3β
4+1
PI4α
7
3+1
PI5α
3+1
PI6β
3+1
PI7α
*
*
6
3
4 5 6 7 9 13
15
fβ
19
27
31 5 7 12
13
14
15
21
29
4
5
4
6
6
4
8
C
23
4
5
1
2
3
Note: For every choice of a multi-func PI g as an EPI/pseudo-EPI for a function,
mark each inclusion choice of g by the flag of the function(s) for which it is an
EPI/pseudo-EPI (update w/ additional flags as it is included again in more functions).
At the end, the flags will determine which functions g should be included in
f  PI1  PI2  PI4 +PI7
f   PI2  PI3 +PI6
Total cost=26
Three Output Function Example
Example 4:
f (A, B, C, D)   m(0, 2, 7,10)  d(12,15)
f  (A, B, C, D)   m(2,4,5)  d(6, 7,8,10)
f (A, B, C, D)   m(2,7,8)  d(0,5,13)
Min
term
List 1
Min
term
Flag
List 2
Min
Flag
List 3
term
00-0 αγ
PI2 4,5,6,7 01-- β
PI3
2,6
-000 γ
0-10 β
2,10
-010 α β
PI5
0101 βγ
4,5
010- β
6
0110 β
4,6
01-0 β
10
1010 α β
8,10
10-0 β
PI6
12
PI12 5,7
1100 
0111 αβγ PI13 5,13
01-1 β γ
PI7
PI8
6,7
-101 γ
011- β
7,15
-111
0
0000 αγ
0,2
2
PI10 0,8
4
0010 αγβ
0100 β
8
1000 βγ
PI11
5
7
13
15
1101 γ
1111 α
α
PI4
PI9
PI1
Do QM w/o Rule 6 for PI5 only (Rule 6 used for other multi-function EPI or pseudo-EPI PIs)
fα
PIs
αγ
0 2 7 10
1
2+1 PI1 β
2
3+1 PI2αγ
New cost = 1
fβ
2
4
fγ
5
2
3
3+1 PI3γ
3+1 PI5αβ
3+1 PI6β
3+1 PI7βγ
C
3+1 PI8γ
3+1 PI9α
4
4+1 PI10αβ γ
4+1 PI11β
4+1 PI12α
γ
4+1 PI13αβ
8
5
3+1 PI4β
α,
7
γ
2
2
3
3
1
1
5
γ
f =PI 2  PI5  PI13
Reduced PIT
PIs
γ
2
3+1 PI3γ
C
3+1 PI7βγ
3
3+1 PI9α
1
bC
4+1 PI11
α 4 4+1
γ
fα
fγ
7
7 8
f  =PI1  PI5
f =PI2  PI3  PI13
5
Note that because of Rule 6, P13 was not
unnecessarily included in f, thus saving a cost of 1.
A
βγ
PI13αβ
γ
B
C
D
6
γ
New cost = 1
Total cost = (4+4+5) +
(3+1) + (1+4+1) = 23
4
2
Bad covering but no choice.
However, if we consider the two PIs PI9 and PI7
together that PI13 covers, then covering them together
is a good covering (cost of 4+1+1 = 6 of PI13 included
in f and f vs. cost of 3+1 + 3+1 = 8 of incl. PI9 & PI7,
resp. in these functions). Thus covering them
individually also leads to an optimal soln. in this case
(since a good covering of PI13 of {PI9, PI7} exists).
PI1
PI2
PI3
PI5
PI13
fα
fβ
fγ
Redo Example 4 w/ Rule 6 applied to all multi-function PIs
fα
PIs
α
0 2 7 10
1
2+1 PI1 β
2
3+1 PI2αγ
New cost = 18
9
fβ
2
4
fγ
5
2
7
8
3+1 PI3γ
3+1 PI4β
3+1 PI5αβ
α 3
3+1 PI6β
New cost = 1
5 3+1
Pseudosingleton
cols
PI7βγ
3+1 PI8γ
4
3+1 PI9α
4+1 PI10αβ γ
6
4+1 PI11β
4+1 PI12α
α, 7
γ
4+1 PI13αβ
γ
2
2
7
3
1
1
7
8
Reduced PIT
f
bC
Cost
PIs
1
PI2γ
1
bC
α,
PI5
•
•
•
f  =PI1  PI10
5
2 2
1
α
2
4+1 PI10α
Unfortunately, we come up
against bad covering (bC)
as the only option
f =PI 2  PI5  PI13
fγ
3
3
3
f =PI 2  PI3  PI13
Total cost =
(4+4+5) + (3+5)
+ (1+4+1) = 27
10
Once again, because of Rule 6, we avoid unnecessarily
including P13 in f, and P10 in f . However due to a
combination of Rule 6 and bad covering, PI2 and PI5 not
not included in f and in f , respectivly, and PI10 of higher
totak cost than that of PI2 and PI5 used instead. So cost
increases by 4+1+1 (cost of PI10 in 2 funcs) – 2 (OR cost
of PI5 and PI2, if they were shared) = 4. Total cost = 27
Solution? Either:
1. Form general PI pairs and perform good coverings among them and of single PIs if possible.
2. OR selectively form multi-PI sets of only those PIs that are either bad or good covered by one
PI, PIj, w/ at least one bad covering this set of coverings, and check if this multi-PI set S (or a
min-cost subset S1 of S that covers all the MTs covered by S) good covers PIj: if so include S1 in
the SOP expr. and delete PIj & S-S1. If not, delete S & include PIj in the SOP expr (this may be an
“overall” good cover, as we saw in the earlier version of this example (see below for more
details), or may still be a bad cover).
Using 2) above, we get S = {PI2 ,PI5} that is min-cost in covering the MTs above in f and f, (so no
subset S1 of S possible) & good covers PI10 (cost of 2 vs. 6). We can then delete PI10, thus making PI2
and PI5 pseudo-EPIs, and giving us the better soln. of cost 23 we obtained earlier.
Thus Rule 6 + multi covered-PI set based covering exploration is a good approach that has the
advantage of: (a) being able to reduce unnecessary OR cost (and thus unnecessary capacitive loading
[and the attendant delay and dynamic power increases] of the corresponding AND gate) of PIs that
are EPIs/pseudo-EPIs of some functions but not all that they belong to, and (b) also avoid bad
coverings (or determine that the set of bad coverings is actually a good covering; we did not see this
in this example, but saw it in the previous version of this example in PI13 covering PI9 and PI7, the
former being a bad covering when it was applied, but PI13 good covers the PI pair {PI9, PI7}.)
Multi-function QM: Rule 7: Alternative to
Rule 6
 If a PI is found to be essential for one or more functions
that it covers, delete it completely. Also, include it in
other functions fj (for which it is currently non-essential)
whose minterms it covers only if not all such MTs of fj
have been deleted so far.
 At the end of the PIT phase when all MTs have been
covered do the following sweep-up phase
 In each function fj’s expression, mark each implicant of fj that
was included in it because it was either an essential-PI or
pseudo-essential PI for fj at the point of its inclusion.
 For each unmarked implicant PIk in a function fj , delete PIk
from fj’s expression only if each MT of fj that it covers is also
covered by some marked implicant of fj.
Utility of the Sweep-up Phase
Example:
1
PIs
1
fα
1
2
4
2
fβ
αβ
PIjαβ
β
PIkβ
4
PIlβ
3
PIrβ
2
*
1
….
*C
β
*
fα =PIj+……
fβ=PIj+PIk+PIr
We thus get fβ =PIk+PIr, reducing
the cost by 1.
Deleted in the sweep-up phase.
Exercise: Use this alternative to rule 6 to find a minimum-cost covering of the problem
in Examples 3 and 4.
Not in current syllabus
Reduced
PIT
bC
f
Cost
PIs
1
PI2γ
1
bC
α,
PI5
fγ
f  =PI1  PI10
5
2 2
1
α
2
4+1 PI10α
Unfortunately, we come up
against bad covering (bC)
as the only option
f =PI 2  PI5  PI13
3
3
3
f =PI 2  PI3  PI13
10
Thus PI2 and PI5 not shared, PI10
used instead, and so cost
increases by 4+1+1 (cost of PI10
in 2 funcs) – 2 (OR cost of PI5
and PI2, if they were shared) = 4
Alternative approach to eliminating the above situation (not in current syllabus). Do
the following for every row Rj included in the “final” expressions so far:
• For each row Rj that covers another row, note the subset Cov(Rj) of rows that it explicitly or implicitly
covers (a row Ri is implicitly covered by Rj, if Ri is eliminated due to the last of its MTs being
eliminated when Rj is inclusion deleted and all MTs it covers are eliminated)
• Replace phase: For each Rj in the final expression, see if any subset of PIs in Cov(Rj) plus other
selected PIs (those in the final expressions) can together cover all MTs of Ri. If so, select the min-cost
subset Covmin(Rj) of Cov(Rj) that meets this criterion.
• Cost of each PI Ri in Covmin(Rj) is its cost when it was eliminated + r-1, where r is the # of new (i.e.,
additional) function expressions Ri is inserted in due to it replacing Rj (possibly along with other PIs in
Covmin}(Rj) in these expressions.
• cost(Rj) is its cost across all expressions it is in.
• If cost(Covmin(Rj)) < cost(Rj), then replace Rj by the appropriate PIs in Covmin(Rj) in each function
expression that Rj occurs in; cost(Covmin(Rj)) is the sum of the cost of each PI in it.
• Thus if the replace phase is applied, we will end up replacing PI10 by PI5 in f and PI2 in f, to reduce
the cost of the implementation by (4+1+1) – (1+1) = 4.