You are on page 1of 5

ManoCh02v4.

fm Page 72 Thursday, May 3, 2007 5:13 PM

72 CHAPTER 2 / COMBINATIONAL LOGIC CIRCUITS

F  D(A  C) ■

The foregoing example shows that the don’t-care minterms in the map are
initially considered as representing both 0 and 1. The 0 or 1 value that is eventually
assigned depends on the optimization process. Due to this process, the optimized
function will have a 0 or 1 value for each minterm of the original function, includ-
ing those that were initially don’t cares. Thus, although the outputs in the initial
specification may contain Xs, the outputs in a particular implementation of the
specification are only 0s and 1s.

MORE OPTIMIZATION This supplement gives a procedure for selecting prime impli-
cants that guarantees an optimum solution. In addition, it presents a symbolic
method for performing prime-implicant generation and a tabular method for
prime-implicant selection.

2-6 PRAGMATIC TWO-LEVEL OPTIMIZATION


The two-level optimization procedure that achieves a true optimum solution
requires: 1) use of the minterms of the function, 2) the generation of all prime
implicants, and 3) a selection process that potentially involves a huge number of
alternative prime-implicant selection solutions. A computer algorithm for this pro-
cedure when applied to many realistic problems is impractical due to the number
of minterms or prime implicants involved or the number of solutions that must be
examined. As a consequence, algorithms have been developed that do not 1)
depend upon the enumeration of minterms, 2) require generation of all prime
implicants, or 3) require enumeration of alternate prime-implicant selections. The
best known and most widely used of these algorithms is Espresso II. Using the
vehicle of K-maps, we will illustrate the Espresso II algorithm. For simplicity,
product-of-sums specifications, multiple output functions, and don’t cares are not
considered. Further, we will not illustrate the complex underlying details that con-
tribute significantly to the efficiency and effectiveness of the algorithm. Finally, we
use gate-input count as the cost measure rather than the complex multidimensional
measure used in Espresso. The resulting simplified form of the algorithm appears
in Figure 2-18. The five routines providing core operations for execution of
Espresso are: EXPAND, ESSENTIAL_PRIMES, IRREDUNDANT_COVER,
REDUCE, and LAST_GASP. The function of each of these routines is outlined
next, followed by an example that illustrates the execution of Espresso. In these
discussions, we will deal with various sets of implicants that cover all of the min-
terms of F. Such a set is called a cover of F, denoted by F.
EXPAND replaces each of the implicants of the current F with prime impli-
cants and insures that the cover is reduced in the sense that no implicants remain
that are covered by any single implicant. EXPAND depends on the order in which
the original implicants are processed. The order selects the largest (in terms of size
on the K-map) remaining unprocessed implicant first. If an implicant can be
expanded into multiple prime implicants, the prime implicant chosen is the one
ManoCh02v4.fm Page 73 Thursday, May 3, 2007 5:13 PM

2-6 / Pragmatic Two-Level Optimization 73

Input Function F and its initial cover F


Initialize Cost = Gate Input Cost of F
Loop 1: Execute EXPAND
On first pass only, execute ESSENTIAL_PRIMES
Execute IRREDUNDANT_COVER
If Cost not improved, goto OUT,
Else update Cost
Loop 2: Execute REDUCE
Goto Loop 1
Out: Execute LAST GASP
If Cost not improved, goto QUIT
Else goto Loop 2
Quit: Place Essential Primes back in F
Return Final F and Final Cost

FIGURE 2-18
Simplified Espresso Algorithm

which 1) covers the maximum number of other current implicants of F, and 2) in


the case of ties, is the largest implicant.
ESSENTIAL_PRIMES evaluates each of the current implicants to deter-
mine if it is an essential prime implicant, a concept defined in the first part of Sec-
tion 2-5. An implicant is essential prime if it contains a minterm that is surrounded
either by other minterms of the prime or by 0 values in all n directions when n is
the number of variables in the function. This test is applied to each of the current
implicants in F. Since the essential primes are required in all solutions, they are
removed temporarily from the solution space. Also, since they are guaranteed to
be covered, their minterms are changed to don’t cares in the solution space. We
denote the changed function as F−E, and a cover of F−E without the essential
primes as F−E.
IRREDUNDANT COVER is used on the implicants in F−E. First, it removes
implicants that are totally redundant in the sense that all can be removed without
exposing any uncovered minterms (squares). Second, it takes the remaining impli-
cants and performs a selection process that resembles a formalization of the selec-
tion rule in Section 2-5.
REDUCE is used to move away from a solution called a local minimum. The
solution is irredundant but, based on the possibility that all prime implicants have
not been found, may not be a minimum-cost solution. In REDUCE, each of the
implicants is reduced to the smallest implicant possible while still maintaining
the cover of the function F−E. REDUCE is performed sequentially on each of the
implicants. This process is order dependent, since the reduction of one implicant
potentially affects squares involved in the reduction of a subsequent implicant. The
ordering is described as follows: (1) choose the largest implicant first, and (2) place
the remaining implicants in the order of smallest number of positions in which the
given implicant differs from the largest one.
ManoCh02v4.fm Page 74 Thursday, May 3, 2007 5:13 PM

74 CHAPTER 2 / COMBINATIONAL LOGIC CIRCUITS

LAST_GASP is a modification of REDUCE, followed by a modification of


EXPAND, followed by IRREDUNDANT_COVER. The modified REDUCE
reduces each of the implicants one at a time to the smallest implicant possible while
still preserving the cover present upon entry. The set of smallest implicants gen-
erated then replaces the starting cover. Note that this set may no longer cover
the function F−Ε. Next the modified EXPAND finds all prime implicants that
cover at least two of the smallest implicants generated. This set of prime impli-
cants is then combined with the cover present upon entry to LAST_GASP, and
IRREDUNDANT_COVER is applied.

EXAMPLE 2-15 Espresso Example


In executing this example, the simplified Espresso algorithm in Figure 2-18 will be
followed. Our input to Espresso consists of a sum-of-products expression:

F( A, B, C, D )  A D  ABD  BCD  ABCD


The initial K-map for the cover F using the implicants in the equation F appears in
Figure 2-19(a). The initial Cost is 16 gate inputs. These implicants are already in the
order of implicant sizes as required in the next step, EXPAND. Beginning with the
largest implicant, A D, we can look at potential for its expansion by attempting to
remove each of its literals in turn, and evaluate the result on the K-map. If there
are any zeros in the region added, then the literal cannot be deleted. Deleting A,
zeros are encountered at 8, 10, 12, and 14. So, A must be restored. Deleting D, a
zero is encountered at square 1. So, D must be restored, and A D cannot be
expanded into a larger implicant. Considering ABD, deleting A expands into zeros
in squares 13 and 15, and deleting B expands into zero in square 1. Deleting D
expands into squares 4 and 6, both of which contain 1. So ABD can be expanded
into AB. AB contains no other listed implicants but ABD, which we remove. Simi-
lar operations on BCD reveal that it can not be expanded. We find that C can be
removed from AB CD, giving new implicant ABD. Figure 2-19(b) gives the final
result of the execution of EXPAND.
Next, ESSENTIAL_PRIMES is applied to the cover F represented in
Figure 2-19(b). Note that n = 4. Checking the minterms of A D, we find that square
0 is surrounded by squares 2 and 4 within A D and squares 1, and 8 which contain
0s. This satisfies the condition for A D to be essential prime. Square 5 is surrounded
by squares 4 and 7 within AB, and squares 1 and 13 contain 0. Thus, AB is essential
prime. Square 9 is surrounded by square 11 within ABD, and squares 1, 8, and 13
contain 0, making ABD essential prime. On the other hand, BCD has two 1s adja-
cent to it, neither of which is within it. The resulting essential prime implicants are
shown in Figure 2-19(c), using dashed lines. Since the essential prime implicants
are included in any solution, they are removed and the squares they cover are
changed to d’s before the steps that follow. These essential prime implicants will be
reintroduced in the final step of Espresso.
After dispensing with the essential primes, IRREDUNDANT_COVER is
applied. Since the only implicant left is BCD, the only one covering square 3, it
ManoCh02v4.fm Page 75 Thursday, May 3, 2007 5:13 PM

2-6 / Pragmatic Two-Level Optimization 75

CD C CD C
AB 00 01 11 10 AB 00 01 11 10
0 1 3 2 0 1 3 2
00 1 1 1 00 1 1 1
4 5 7 6 4 5 7 6
01 1 1 1 1 01 1 1 1 1
12 13 15 14 B 12 13 15 14 B
11 11
A A
8 9 11 10 8 9 11 10
10 1 1 10 1 1

D D
(a) Original function F and cover F (b) After EXPAND
CD C CD C
AB 00 01 11 10 AB 00 01 11 10
0 1 3 2 1 3 2
00 d* 1 d 00 d0 1 d
5
01 d
4
d* d
7
d
6
01 d4 d5 d7 d6
13 15 14 B 13 15 14 B
12 12
11 11
A A
8 9 11 10 8 9 11 10
10 d* d 10 d d

D D
(c) After ESSENTIAL (d) After IRREDUNDANT _COVER
CD C CD C
AB 00 01 11 10 AB 00 01 11 10
0 1 3 2 0 1 3 2
00 d 1 d 00 d 1 d
4 5 4 5
01 d d d7 d6 01 d d d7 d6
B B
12 13 15 14 12 13 15 14
11 11
A A
8 9 11 10 8 9 11 10
10 d d 10 d d

D D
(e) After REDUCE (f) After EXPAND
CD C
AB 00 01 11 10
0 1 3 2
00 1 1 1
4 5
01 1 1 17 16
B
12 13 15 14
11
A
8 9 11 10
10 1 1

D
(g) After IRREDUNDANT_COVER,
LAST_GASP, and QUIT

FIGURE 2-19
Espresso Example
ManoCh02v4.fm Page 76 Thursday, May 3, 2007 5:13 PM

76 CHAPTER 2 / COMBINATIONAL LOGIC CIRCUITS

must be selected. Next, the new Cost must be evaluated to see if it has improved.
Based on the K-map in Figure 2-19(d), Cost has been reduced to 14. This solution
represents a local minimum Cost.
REDUCE is applied next to attempt to move away from the local minimum
Cost to a lower Cost. There is only one implicant BCD under consideration, so
there is no need for ordering the implicants. From the K-map in Figure 2-19(d), the
only square containing a 1 is square 3, so BCD can be reduced to A BCD, as shown
in Figure 2-19(e).
Application of EXPAND replaces A BCD with the largest implicant that
covers square 3, AC. Next, IRREDUNDANT_COVER finds that all implicants are
required. The result, shown in Figure 2-19(f), gives Cost = 13.
Repetition of REDUCE, EXPAND, and IRREDUNDANT_COVER still
yields Cost = 13, so the next step is LAST_GASP. This step yields no new result,
since only one square, 3, remains to be covered. Since the Cost is still 13, the next
step is QUIT. The essential primes are returned to the solution to give the final
result in Figure 2-19(g). The equation for the result is:

F( A, B, C, D )  A D  AB  ABD  AC ■

2-7 MULTIPLE-LEVEL CIRCUIT OPTIMIZATION


Although we have found that two-level circuit optimization can reduce the cost of
combinational logic circuits, often additional cost savings are available by using cir-
cuits with more than two levels. Such circuits are referred to as multiple-level cir-
cuits. These savings are illustrated by the implementation of the function

G  ABC  ABD  E  ACF  ADF

Figure 2-20(a) gives the two-level implementation of G, which has a gate-input cost
of 17. Now suppose that we apply the distributive law of Boolean algebra to G to
give

G  AB( C  D )  E  A( C  D )F

This equation gives the multiple-level implementation of G in Figure 2-20(b), which


has a gate-input cost of 13, an improvement of 4 gate inputs. In Figure 2-20(b),
C + D is implemented twice. Instead, one implementation of this subfunction can
be shared to give the circuit in Figure 2-20(c) with a gate-input cost of 11, an
improvement of 2. This common use of (C + D) suggests that G can be written as

G  ( AB  AF )( C  D )  E

This increases the cost to 12. But by factoring out A from AB + AF, we obtain

G  A(B  F)(C  D)  E

You might also like