4.

Simplification of Boolean Functions

4-1

Chapter 4. Simplification of Boolean Functions
Boolean Cubes and Boolean Functions
(a) n = 1
0 1

00

01

(b) n = 2

10

11

010

011

000

001

(c) n = 3
110 111

100

101

0010

0011

0000

0001 0110 0111

(d) n = 4
0100 0101

1110 1111 1100

1110 1011

1000

1001

Figure 1: Boolean cubes [Gajski].

c ­ Cheng-Wen Wu, Lab for Reliable Computing (LaRC), EE, NTHU

2005

4. Simplification of Boolean Functions

4-2
Ò 

A Boolean Ò-cube uniquely represents a Boolean function of each vertex is assigned a 1 (marked) or 0 (unmarked).

variables if 

Each vertex of the Ò-cube represents a minterm (a row in the truth table). Example 1 Fig. 2 shows the truth table and the corresponding cube representations of the carry and sum functions. ¾
ci xi yi
0 0 0 0 1 1 1 1 0 0 1 1 0 0 1 1 0 1 0 1 0 1 0 1

c i+1 s i
0 0 0 1 0 1 1 1 0 1 1 0 1 0 0 1

(a) Truth table
010 011

000

001

110

111

100

101

(b) Carry function c i+1
010 011

000

001

110

111

100

101

(c) Sum function s i

Figure 2: Boolean-cube representations for carry and sum functions [Gajski]. 

(a) Each Ñ-subcube of the Ò-cube represents ¾Ñ minterms with the same Ñ Ò   Ñ literals, where Ñ Ò; (b) each Ñ-subcube with ¾ 1-minterms represents a product term of Ò   Ñ literals.  A prime implicant (PI) is a subcube (of 1-minterms) that is not contained in any other subcube (of 1-minterms); an essential prime implicant (EPI) is a PI that contains a 1-minterm that is not contained in any other PI.
c ­ Cheng-Wen Wu, Lab for Reliable Computing (LaRC), EE, NTHU
2005

4. Simplification of Boolean Functions

4-3

Map Representation  Complexity of digital circuit (gate count) » complexity of algebraic expression (literal count).  A function’s truth-table representation is unique; its algebraic expression is not. Simplification by algebraic means is awkward (from algorithmic point of view).  A Karnaugh map (K-map) is an array of squares each representing one minterm. Simplification by the map method is straightforward.
x 0 1 (a) n = 1

y x 0 1 0 m0 1

m1
(b) n = 2

m2

m3

yz x 0 1 00 m0 01 m1 11 m3 10 m2 (c) n = 3

m4

m5

m7

m6

zw xy 00 01 11

00

01

11

10

m0 m4 m12

m1 m5 m13 m9

m3 m7 m15 m11

m2 m6 m14 m10
(d) n = 4

10

m8

Figure 3: Boolean cubes and corresponding Karnaugh maps [Gajski]. 

Each K-map defines a unique Boolean function.  A Boolean function can be represented by a truth table, a Boolean expression, an Ò-cube, or a map.
c ­ Cheng-Wen Wu, Lab for Reliable Computing (LaRC), EE, NTHU
2005

Lab for Reliable Computing (LaRC). EE. 2-10 Three-Variable Map (b) Figure 6: Three-variable map simplification [Mano & Kime].  They are used for manual minimization of Boolean functions.and Three-Variable Maps Ü Ý 0 0 1 1 0 1 0 1 Ѽ ѽ Ѿ Ñ¿ Ѽ Ñ ½ Ѿ Ñ ¿ Ü Ý 0 ¼ ¼ ¼ 1 ¼ 0 ÜÝ ÜÝ 1 ÜÝ ÜÝ 2-var map Ü Ý 0 1 1 ÜÝ Ü Ý 0 0 1 0 1 1 1 1 1 Ü 0 0 1 1 ´ Ý 1 1 2-var map Ü·Ý Ü ¨ ݵ ¼ Figure 4: Two-variable maps. Exercise 1 How do you transform a K-map into a truth table? Is it unique? How do you transform a K-map into an Ò-cube? Is it unique? ¾ Two. NTHU 2005 . c ­ Cheng-Wen Wu. YZ X m0 m4 m1 m5 m3 m7 m2 m6 Y 00 01 11 10 0 XY Z XY Z XY Z XY Z X 1 XY Z XY Z XY Z XY Z Z (a) Fig. Simplification of Boolean Functions 4-4  K-map is in fact a visual diagram of all possible ways a function may be expressed—the simplest one can easily be identified.  K-maps provide visual aid to identify PIs and EPIs. Ü ÝÞ Ñ¼ ѽ Ñ¿ Ѿ Ñ Ñ Ñ Ñ 00 01 11 10 ¼ ¼ ¼ ¼ ¼ ¼ ¼ ¼ ¼ ¼ ¼ ¼ Ü 0 Ü Ý Þ Ü Ý Þ Ü ÝÞ Ü ÝÞ 1 ÜÝ Þ ÜÝ Þ ÜÝÞ ÜÝÞ 3-var map 00 01 11 10 0 1 1 1 1 1 Þ ÝÞ Ü 00 01 11 10 0 1 1 1 1 1 Ü Ý · ÜÝ ¼ ¼ ÝÞ 3-var map Figure 5: Three-variable maps.4.

. Simplification of Boolean Functions 4-5  Minterms are arranged in the Gray-code sequence. which is complemented in one square and uncomplemented in the other. 7) = YZ + XZ (b) F2 (X. Ñ · Ñ ÜÝ Þ · ÜÝÞ ÜÞ ´Ý · Ý µ ÜÞ .g. ¾´ È µ È Y 11 ´¿ µ. 4. Z) = Σm (3. Z) = Σm(0. 2-14 Maps for Example 2-4 ¾ c ­ Cheng-Wen Wu. 5.  Any 2 minterms in adjacent squares that are ORed together will cause a removal of the different variable. (Why?)  Any 2 (horizontally or vertically) adjacent squares differ by exactly 1 variable. 4. Example 2 Simplify the following Boolean functions: (a) ½ ´ µ ´¼ ¾ µ. (b) YZ 00 X 0 X 1 1 Y 01 11 1 1 Z 1 10 YZ 00 X 0 X 1 1 1 01 10 1 1 Z 1 (a) F1 (X. e. because Ý · Ý ½. Y. EE. 6) = Z + XY Fig. 2. 6. Lab for Reliable Computing (LaRC). Y. NTHU 2005 .4. ¼ ¼ ¼ x iyi ci 0 4 5 0 0 01 1 11 3 10 2 1 7 6 1 x iyi ci 0 4 1 0 0 1 11 1 3 1 10 2 01 1 5 7 1 6 1 1 1 Figure 7: K-maps for the carry and sum functions [Gajski].

3. 4. 3.2 . c ­ Cheng-Wen Wu.4. EE. 5. Y . 5. Z ) = Σm(1. Lab for Reliable Computing (LaRC). Z ) = Σ m (1 . Y 11 1 1 10 1 ¾ Four-Variable Maps yz wx 00 01 11 10 00 0 1 3 2 01 4 10 8 5 7 6 11 12 13 15 14 9 11 10 yz wx 00 01 11 10 00 1 1 1 01 1 11 1 10 1 ÛÞ ¼ yz wx 00 01 11 10 00 1 1 1 01 11 10 1 1 ¼ 1 1 1 ¼ 1 1 Ý ¼ 1 1 ¼ ¼ · · ÜÞ ¼ ÜÞ ¼ · ÜÝ · Û ÝÞ ¼ ¼ Figure 8: Four-variable maps. NTHU 2005 . 7) ¼ · ¼ · ¼ · . 2-16 F( X. Y 01 1 1 Z 11 1 1 Fig. Simplification of Boolean Functions Example 3 Simplify the Boolean function YZ 00 X 0 X 1 1 ´ µ È 10 4-6 ´½ ¿ µ. Y . 6) ¾ Example 4 Simplify the Boolean function YZ 00 X 0 X 1 01 1 1 Z Fig. 2-15 F( X.

Simplification of Boolean Functions 4-7  The map is considered to lie on a surface with the top and bottom edges.  Eight adjacent squares µ a term of 1 literal. Example 5 For the maps shown above. Lab for Reliable Computing (LaRC). Minimize the number of groupings.  Two adjacent squares µ a term of 3 literals. touching each other to form adjacent squares. Maximize their sizes. c ­ Cheng-Wen Wu.4.  Four adjacent squares µ a term of 2 literals. ½ ´Û Ü Ý Þµ ¼ ¼ È ´¼ ½ ¾ ½¾ ½¿ ½ µ and ¾ Û ÜÝ ¼ ¼ ¼ · Ü ÝÞ · Û ¼ ¼ ¼ ÜÝÞ ¼ · ÛÜ Ý . ¾  A PI is a product term obtained by combining the maximum possible number of adjacent squares in the map. NTHU 2005 . as well as the right and left edges.  One square µ a minterm of 4 literals. EE.  Pick the EPIs that minimize the number of literals.  Sixteen adjacent squares µ the constant ‘1’.

4. XZ 2 10 11 3 XZ (b) Fig. 2-18 Four-Variable Map: Flat and on a Torus to Show Adjacencies Example 7 Simplify the Boolean function ´Ï µ È Y 10 1 1 ¾ ´¼ ½ ¾ ½¾ ½¿ ½ µ. YZ 00 WX 00 01 11 W 10 1 1 1 1 01 1 1 1 1 Z 11 X 1 Fig. 2-19 Map for Example 2-5: F = Y + WZ + XZ ¾ c ­ Cheng-Wen Wu. Simplification of Boolean Functions 4-8 ¼ ¼ Example 6 Show the region in the K-map that is represented by YZ 00 WX 00 01 11 W 10 8 9 Z (a) 11 10 1 0 4 12 Y 01 1 5 13 11 3 7 15 10 2 6 X 14 9 0 8 . Lab for Reliable Computing (LaRC). EE. NTHU 2005 .

Simplification of Boolean Functions 4-9 ¼ ¼ ¼ Example 8 Simplify the Boolean function CD AB 00 01 11 A 10 1 00 1 · C 10 1 1 ¼ ¼ · ¼ ¼ · ¼ ¼ .  Maps of 6 or more variables are hard to read. (2) CAD programs. NTHU 2005 . and thus are impractical.  Any ¾ adjacent squares.  (1) Variable-entered maps (VEMs). in an Ò-variable map represent an literals.4. ¼ ½ area that gives a product term of Ò   . EE.  It is possible to construct a 6-variable map with four 4-variable maps by following a similar procedure.  Imagine that the 2 maps are superimposed on one another. 2-20 Map for Example 2-6: F = BD + BC + ACD ¾ *Five-Variable Maps A=0 DE BC A=1 DE BC A=0 DE BC A=1 DE BC 00 01 11 10 1 5 3 7 2 6 00 01 11 10 00 01 11 10 1 1 1 1 ¼ ¼ ¼ 00 01 11 10 1 1 1 1 1 00 0 01 4 10 8 00 16 17 19 18 01 20 21 23 22 11 28 29 31 30 10 24 25 27 26 00 1 01 1 11 10 00 01 11 10 · ¼ 11 12 13 15 14 9 11 10 · Figure 9: Five-variable maps. Ò c ­ Cheng-Wen Wu. Lab for Reliable Computing (LaRC). 01 1 11 B 1 D 1 Fig.

Simplification of Boolean Functions 4-10 v=0 zw xy 00 0 v=1 { { 01 11 10 1 3 2 00 16 6 20 01 17 21 11 10 19 18 23 22 u=0 u=1 { { 00 0 4 12 8 32 36 44 00 m0 4 m1 5 m3 m2 7 m16 m17 m19 m18 m20 m21 m23 m22 14 28 29 31 30 01 m4 12 m5 13 m7 m6 15 11 m12 m13 m15 m14 8 9 11 10 m28 m29 m31 m30 24 25 27 26 10 m8 32 m9 33 m11 m10 35 34 m24 m25 m27 m26 48 49 51 50 00 m32 m33 m35 m34 36 37 39 38 m48 m49 m51 m50 52 53 55 54 01 m36 m37 m39 m38 44 45 47 46 m52 m53 m55 m54 60 61 63 62 11 m44 m45 m47 m46 40 41 43 42 m60 m61 m63 m62 56 57 59 58 10 m40 m41 m43 m42 m56 m57 m59 m58 v=0 zw xy 01 11 10 1 3 2 5 7 6 v=1 { { 00 16 20 01 17 21 11 10 19 18 23 22 u=0 u=1 { { 00 01 13 15 14 28 29 31 30 11 9 11 10 24 25 27 26 x’ v 10 33 35 34 48 49 51 50 00 37 39 38 52 53 55 54 01 45 47 46 60 61 63 62 xz 11 40 41 43 42 56 57 59 58 10 z’ ’ w Figure 10: Six-variable K-maps [Gajski]. Lab for Reliable Computing (LaRC). c ­ Cheng-Wen Wu. NTHU 2005 . EE.4.

2 minterms are adjacent iff they differ in exactly 1 variable. which immediately give the sop form: ¼ ¼ · ¼ ¼ ¼ · ¼ ¼ (c) Use the 0s to determine the EPIs of ¼ . 6 the extension sequence in each dimension is a Gray sequence. Simplification of Boolean Functions 4-11 Theorem 1 In a K-map.4. EE. Example 9 We want to simplify the following function in sop & pos: ´ µ ´¼ ½ ¾ ½¼µ (a) Mark the map with 1s and 0s according to the function. CD AB 00 01 11 10 1 1 1 1 ¼ ¼ CD AB 00 01 11 10 0 0 0 0 0 ¼ 00 1 01 1 11 1 10 1 1 1 1 · ¼ 00 01 11 10 ¼ ¼ · · Figure 11: The complement of ¼ gives in pos. where Ò K-map such that: ¾ . NTHU 2005 . for an Ò-variable function. Lab for Reliable Computing (LaRC). we can construct a -D 6 the map is extended in each dimension on 2 of the variables. and complement it to give the pos form: · ¼ · c ­ Cheng-Wen Wu. Simplification Using K-Maps  The complement of a function is represented in the map by the squares not marked by 1s (they usually are marked by 0s). B In general. (b) Use the 1s to determine the EPIs of .

canonical form. and the 0s represent the maxterms.  Find minimal cover (set) of PIs. c ­ Cheng-Wen Wu.  Entering a function in the map:  Entering a function expressed in sop in the map is straightforward. NTHU 2005 . Simplification of Boolean Functions B’ D’ C’ A’ D 4-12 A’ B’ ¯ ¯ f ¯ f C’ D’ D Figure 12: Two-level implementation.  To enter a function expressed in pos in the map.  Determine PIs.4. Lab for Reliable Computing (LaRC). ¾  The 1s of the function in the K-map or the truth table represent the minterms. or standard form.  Generate K-map.  Simplification procedure:  Obtain truth table. The remaining squares are marked by 1s.  Select EPIs. Note that NOT gates (inverters) are required if complemented inputs are not available. take the complement of the function (to get sop) and from it find the squares to be marked by 0s. ´ ¼ · ¼ µ´ ¼ · ¼ µ´ ¼ · µ The 2-level (sop/pos) implementations using the AND/OR gates are shown below. EE.

Lab for Reliable Computing (LaRC). EE. NTHU 2005 . c ­ Cheng-Wen Wu. CD AB 00 01 11 A 10 00 1 1 01 1 1 11 C 10 1 3 B 1 1 1 D 1 2 Fig. 2-22 Simplification with Prime Implicants in Example 2-8 Figure 13: Simplification with PIs for È ´¼ ½¼ ½½ ½¾ ½¿ ½ µ [Mano & Kime].4. 2-23 Map for Example 2-9 1 Figure 14: Simplification with PIs for È ´¼ ½ ¾ ½¼ ½½ ½¿ ½ µ [Mano & Kime]. Simplification of Boolean Functions 4-13 CD AB 00 01 11 A 10 1 D 1 00 1 1 01 11 C 10 AB CD 00 00 01 B 1 1 01 11 C 10 B 11 A 1 1 1 1 1 1 1 1 10 D (b) Essential prime implicants (a) Plotting the minterms Fig.

2-24 Map for Example 2-10: F = (A + B) (C + D) (B + D) ¼ · · ¼ µ µ´ ´ ¼ · ¼ µ´ ¼ · ¼ µ´ ¼ · µ ¾ ¾ Exercise 3 Simplify ´ ¼ · ¼ · · µ in the pos form. in the 4-bit BCD code for the decimal digits. ¾ È CD AB 00 01 11 A 10 1 1 D 0 00 1 0 0 01 1 1 0 11 0 0 0 C 10 1 0 B 0 1 Fig. Lab for Reliable Computing (LaRC). EE. there are applications where the function is not specified for certain combinations of the input variables.  Functions that have unspecified outputs for some input combinations are called incompletely specified functions.  These don’t-care conditions can be used on a map to provide further simplification of the Boolean expression.  The unspecified minterms of a function are called the don’t-care conditions. the outputs are unspecified for the input combinations 1010-1111. or simply the don’t-cares. c ­ Cheng-Wen Wu. NTHU 2005 . Simplification of Boolean Functions 4-14 Exercise 2 Does the minimal cover of PIs contain only EPIs? Example 10 Simplify the following Boolean function in the pos form: ´ µ ´¼ ½ ¾ ½¼µ. Don’t-Care Conditions  In practice.4. For example. and are denoted as Xs.

to help the simplification procedure.  Note that the above 2 expressions represent 2 functions that are algebraically unequal: each covers different don’t-care terms. Simplification of Boolean Functions 4-15  Each X can be assigned an arbitrary value.  The map method is essentially a trial-and-error method that does not offer any guarantee of producing the best realization. Example 11 Simplify the Boolean function care conditions ´Û Ü Ý Þ µ ÝÞ ÛÜ È ´Û Ü Ý Þµ È ÛÜ ´½ ¿ ½½ ½ µ that has the don’t- ´¼ ¾ µ. Tabulation (Quine-McCluskey) Method  The map method is convenient when the number of variables does not exceed 5 or 6. Lab for Reliable Computing (LaRC). 0 or 1. EE. ÝÞ 00 01 11 10 1 X 0 0 0 1 1 00 01 11 10 1 X 0 0 0 1 1 00 X 1 11 0 10 0 0 0 ÝÞ 00 X 1 11 0 10 0 0 0 ÝÞ 01 0 X 1 01 0 X 1 · Û ¼ ܼ · Û¼ Þ Figure 15: Simplification using don’t-cares.  We may or may not include any of the Xs. while all the 1s must be included.  The map method’s dependence on the somewhat intuitive human ability to recognize patterns makes it unsuitable for design automation (programming for a digital computer).  It is also possible to obtain a simplified pos expression using the don’t-cares. NTHU 2005 .4. ¾  Either one of the above expressions satisfies the conditions stated. c ­ Cheng-Wen Wu.

 Find EPIs through a selection table.4. of a set of objects. Determination of PIs  The goal of the Quine-McCluskey algorithm is a special case of the following: Select the smallest possible subset. . of which the set contains all possible products.  It however is quite tedious for human use. .  Find minimal cover through the pos of the PIs. Repeat the above procedure on generated subcubes until no more subcubes can be generated. EE. is satisfied.  Step 1: Exhaustive search of all PIs. Compare minterms and find pairs with distance 1. thus known as the Quine-McCluskey method. NTHU 2005 . . Simplification of Boolean Functions 4-16  The tabulation method is a specific step-by-step (algorithmic) procedure that is guaranteed to produce a simplified standard-form expression for a function. Generate subcubes. so that some criterion. c ­ Cheng-Wen Wu.  Step 2: Choose among the PIs which give an expression with the least amount of literals (minimal cover generation).  The set will consist of all products in the minimal sop realization of a given Boolean function .  The tabulation method was first formulated by Quine (1952) and later improved by McCluskey (1956).  It can be applied to problems with any number of variables.  It is suitable for machine computation.     Group minterms by number of 1s. Lab for Reliable Computing (LaRC).

15 10–0  101–  1–10  1–11  111–  –0–0 –0–0 1–1– 1–1– x Group the minterms according to the number of 1s (see Column (a)). Simplification of Boolean Functions Let È 4-17 ´¼ ½ ¾ ½¼ ½½ ½ ½ µ.2.15 000– 0.10 1010  10.11 1011  10.14.10 8.2 0001  0. Try this for all possible pairs of minterms.10 –000  10.2. the comparison can be done directly on the decimal numbers.8. It of course is unnecessary to use the same term twice.14.14 1110  11.11. the unmatched variable removed (see Column (c)).15 –010  10. dist-1). Combine any 2 product terms from Step y that differ from each other by exactly one variable.e. A check () is placed to the right of both minterms if they have been used in a match..  When comparing 2 terms to decide if they can be combined. z Repeat the process. NTHU 2005 . EE. { The unchecked terms in the table form the PIs.4.15 1111  14. the unmatched variable removed (see Column (b)). Lab for Reliable Computing (LaRC). y Combine any 2 minterms that differ from each other by exactly one variable (i.10 00–0  0. We combine 2 terms iff the difference of their corresponding decimal numbers is a power of 2.1 0. c ­ Cheng-Wen Wu. (a) ÛÜÝÞ (b) ÛÜÝÞ (c) ÛÜÝÞ 0 1 2 8 10 11 14 15 0000  0.8. Some of the product terms may appear twice in the table.8 0010  1000  2.11.

These PIs are the EPIs. ¼ ¼ . We of course will select the PIs with a smallest total number of literals (ÜÝÞ in this example). Simplification of Boolean Functions 4-18  In most cases. NTHU 2005 .9 X 4. Lab for Reliable Computing (LaRC). and compare the ¾ Minimal Cover Generation The selection of PIs that form the minimized function is made from a PI table: each PI is represented in a row and each minterm in a column.6 X X 6.15 X 11. z If there are minterms left uncovered (7 & 15 in this example). Exercise 4 Use the map method to simplify result with the tabulation method. y Check each column whose minterm is covered by the selected EPIs. ÜÝÞ . The reason is that some of the PIs may be redundant. Û ÜÝ .10. 9 10 11 15 X ¼ ¼ Û ÜÝ ÜÝÞ ÛÝÞ  ÛÜ ¼ Minterms 1 4 6 7 8 1. ÛÝÞ .15 8. Suppose we have the following PIs: PI   Ü Ý Þ Û ÜÞ ¼ ¼ ¼ ¼ ¼ Ü Ý Þ Û ÜÞ ¼ ¼ .9.7 X X 7. È ´¼ ½ ¾ ½¼ ½½ ½ ½ µ. and ÛÜ . EE. the sum of PIs obtained from the procedure shown above is not necessarily a standard form (which is minimized).11 X     X X   X X  X X x Check the PIs that cover minterms with a single X in their columns. some nonessential PIs have to be selected to cover them.4. c ­ Cheng-Wen Wu.

and search for a minimal cover by using shared terms. ½´ ¾´ ¿´ BC A 00 01 11 10 0 1 1 1 1 1 1 µ µ µ ´¼ ¾ ¿ ´½ ¾ ¿ ´¾ ¿ µ µ µ BC A 00 01 11 10 0 1 1 1 1 1 1 BC A 00 01 11 10 0 1 1 1 1 1 1 ½ ¾ ¿ Figure 16: Simplification of multiple output functions. EE.4. Lab for Reliable Computing (LaRC). ½ ¾ ¿ ¼ ¼ ¼ · · · ¼ ¼ · · ¼ ¼ · ¼ ¼ ¼ · · ¼ ¼ ¼ · ¼ c ­ Cheng-Wen Wu. Simplification of Boolean Functions 4-19 *Multi-Output Minimization Using Maps  Identify all possible PIs that cover each implicated minterms in each output expression.  The Quine-McCluskey method also can be extended for this purpose. NTHU 2005 .

NTHU 2005 . Lab for Reliable Computing (LaRC). BC A 00 01 11 10 0 1 1 ´ BC A 00 01 11 10 0 1 1 offset ´ 1 kitty-corner 1 ¨ µ ¨ µ CD 00 01 11 10 AB 00 1 1 01 1 11 10 ½ CD 00 01 11 10 AB 00 1 01 11 1 10 1 ¾ CD 00 01 11 10 AB 00 1 01 11 1 10 1 ¿ 1 1 1 1 1 1 1 Figure 17: XOR/XNOR patterns on the map.4. ½ ¼ ¼ ¼ ¼ ¼ ´ ¼ ¼ ´ ¼ ¨ ¨´ ¨ µ´ · µ· · µ´ ¨ · ¼ ¼ ¼ ¼ · µ´ ¼ ¼ ¼ ¼ µ· µ ¼ ´ ¨ · ¼ µ·´ ¨ · µ µ ¼ ¾ ¼ ¼ ¼ ¼ ´ ¼ ¨ · ¼ ¼ ´ ¨ ¼ µ ¼ ¼ ¿ ´ ¼ ¼ ¨ ¨ · · ¼ ¼ µ c ­ Cheng-Wen Wu. Simplification of Boolean Functions 4-20 *XOR & XNOR Patterns on the Map  Inspect the K-map to detect XOR/XNOR patterns: 1) kitty-corner adjacencies. 2) offset adjacencies. EE.

and NOT gates to one with only NAND or NOR gates is an example of technology mapping. OR. EE. NAND gate or Ü ¼ · ݼ · Þ¼ ´ÜÝÞ µ¼ NOR gate or Ü Ý Þ ¼ ¼ ¼ ´Ü · Ý · Þ µ¼ Figure 18: NAND/NOR gates. B NAND-NAND implementation: 6 Simplify the function and express it in sop: · · 6 Transfer it to 2-level NAND-NAND expression (DeMorgan’s Thm): ´´ · · µµ ¼ ¼ ´´ µ´ ¼ µ ¼ ¼ µ ¼ 6 Draw the corresponding NAND gate implementation. For example. Note that a 1-input NAND gate can replace an inverter. Lab for Reliable Computing (LaRC). in gate arrays. NTHU 2005 .  The conversion process from an expression/schematic with AND. Simplification of Boolean Functions 4-21 Two-Level Implementations  Digital circuits are more frequently constructed with NAND/NOR gates than with AND/OR/NOT gates due to ease of fabrication. only NAND (or NOR) gates are used. c ­ Cheng-Wen Wu.4.

Lab for Reliable Computing (LaRC). B NOR-NOR implementation: 6 Simplify the function and express it in pos: ´ · µ´ · µ 6 Transfer it to 2-level NOR-NOR expression (DeMorgan’s Thm): ´´´ · µ´ · µ µµ ¼ ¼ ´´ · µ ·´ ¼ · µ · ¼ ¼ µ ¼ 6 Draw the corresponding NOR gate implementation. so NAND & NOR logic implementations are the most important from a practical point of view. Simplification of Boolean Functions 4-22  AND-OR NAND-NAND  The process can be done directly on the logic diagram. B NAND-AND & AND-NOR implementations: 6 Both perform the AND-OR-INVERT (AOI) function. EE.  The types of gates most often found in ICs are NAND & NOR. it is convenient to use the simplification of (the complement of the function) instead of .4.  Because of the INVERT part in each case.  It is the dual of the NAND-NAND implementation. B OR-NAND & NOR-OR implementations: 6 Both perform the OR-AND-INVERT (OAI) function. Note that a 1-input NOR gate can replace an inverter.  OR-AND NOR-NOR  The process can be done directly on the logic diagram. NTHU 2005 . ¼ c ­ Cheng-Wen Wu.

Lab for Reliable Computing (LaRC). YZ 00 X F = XY + XY + Z 1 1 X Y X Y Z • • • (b) X Y • • • F • • • F X Y Z (c) Fig. NAND-AND: ´Ü Ý µ ´ÜÝ µ Þ . 19. NTHU 2005 . NOR-NOR: ´ µ ´Ü · Ý µ · ´Ü · Ý µ · ´Þ µ . AND-NOR: ´ µ ´Ü Ý · ÜÝ · Þ µ . NOR-OR: ´Ü · Ý · Þ µ · ´Ü · Ý · Þ µ . NAND-NAND: ´ µ ´Ü Ý Þ µ ´ÜÝÞ µ . Example 12 Consider the function ¼ ¼ ¼ ¼ given in Fig. ¼ ¼ ¼ ¼ ¼ ¼ ¼ ¼ ¼ ¼ ¼ ¼ ¼ ¼ ¼ ¼ ¼ ¼ ¼ ¼ ¼ ¼ ¼ ¼ ¼ ¼ ¼ ¼ ¼ Example 13 Implement ´ µ È 0 X 1 ¾ ´½ ¾ ¿ Y 01 1 11 1 1 Z (a) 10 1 µ with NAND gates. EE. ¼ ¼ ¼ ¼ ¼ ¼ ¼ ¼ ¼ AND-OR: Ü Ý Þ · ÜÝÞ . OR-AND: ´Ü · Ý µ´Ü · Ý µÞ .4. 2-30 Solution to Example 2-12 ¾ c ­ Cheng-Wen Wu. Simplification of Boolean Functions Ü 4-23 00 01 11 10 0 1 0 0 0 1 0 0 0 1 ¼ ÝÞ Ü Ý Þ Ü Ý ¼ ¼ ¼ ¼ · ÜÝÞ ¼ · ÜÝ ¼ · Þ Figure 19: NAND/NOR gates. OR-NAND: ´Ü · Ý · Þ µ´Ü · Ý · Þ µ .

¼ ¨ ¨ µ¼ . 2-32 Implementing F = ( A B + AB ) E (C + D) ¾ Exclusive-OR (XOR) Gates  Some identities for XOR: 6 6 6 ¨¼ ¨ ¨ ¨ ¨ . ¾ c ­ Cheng-Wen Wu. ¼. EE.  The XOR function is both commutative and associative. NTHU 2005 . Simplification of Boolean Functions 4-24 · ¼ Example 14 Implement A B A B C D ´ ¼ · ¼ µ´ ´ µµ with NOR gates. 6 6 ´ µ ¨ ¨ . ¨´ ¨ µ ¨ ¨ . ¼ ¼ ¼ . F E (a) AND – OR gates A B A B C D • • • • E • • X • • • • F (b) NAND gates Fig. ´ ½. ¼ ´ ¨½ ¨ ¨ µ.4. Lab for Reliable Computing (LaRC). Calculate the hardware cost (in terms of primitive gates) and performance (in terms of primitive-gate delays). Exercise 5 (a) How do you implement the Even function with XOR (XNOR) gates? (b) Design an Ò-bit even-parity generator.

2-38 Maps for Multiple-Variable Odd Functions Figure 21: Implementing the Odd function with XOR gates [Mano & Kime].4. YZ 00 X 0 X 1 1 Y 01 1 1 Z A 11 10 1 AB CD 00 00 01 11 1 1 1 D (b) A B C 1 01 1 1 11 (a) X Y Z 10 Fig. NTHU • • • • • F=X Y C 10 1 B 1 D 2005 . Lab for Reliable Computing (LaRC). Simplification of Boolean Functions 4-25 X • • • Y • Fig. 2-37 Exclusive-OR Constructed with NAND Gates Figure 20: Implementing the XOR function with NAND gates [Mano & Kime]. EE. c ­ Cheng-Wen Wu.

NTHU 2005 .4. Simplification of Boolean Functions 4-26 *Technology Mapping  A gate array is a 2-dimensional array of cells within which each cell contains a single NAND (NOR) gate that has a fixed number (usually 3) of inputs. c ­ Cheng-Wen Wu. OR. Rule 1 Rule 2 Rule 3 Rule 4 Standard form ÜÝ Ü ´´ÜÝ µ µ ´´ÜÝ µ µ ¼ ¼ ¼ ¼ ¼ ¼ ¼ ¼ ·Ý ·Ý ´´Ü · Ý µ µ ¼ ´Ü Ý µ ¼ ¼ ÜÝ Ü ´Ü · Ý µ ¼ ¼ ¼ ´´Ü · Ý µ µ NAND implementation NOR implementation sum−of−products product−of−sums Figure 22: Conversion standard forms to NAND and NOR implementations [Gajski]. and NOT gates to one with only NAND or NOR gates is an example of technology mapping.  The conversion process from an expression/schematic with AND. EE. Lab for Reliable Computing (LaRC).

For example. NTHU 2005 .4 1.  Replace AND and OR gates with NAND gates by using Rules 1 and 2. Simplification of Boolean Functions 4-27 Example 15 Consider the carry function again: ·½ Ü Ý ·Ü ·Ý ´Ü · Ý µ´Ü · µ´Ý · µ The NAND and NOR implementations of the carry function are shown in Fig 23.4 2.4 1.4 1.  Term decomposition: each Ò-input gate is decomposed into a tree of Ñ-input gates.4 2.4 2. ¾ xi yi ci 2. EE.4 xi yi ci 1. Lab for Reliable Computing (LaRC).4 (d) NOR implementation Figure 23: NAND and NOR implementations of the carry function [Gajski]. Fig 24 shows the decomposition of a 10-input AND gate into 3-input AND gates.4 ci+1 1.4 2.4 ci+1 2. where Ò Ñ.4. and eliminate double inverters whenever possible.4 ci+1 1.4 (c) NAND implementation xi yi ci 2. c ­ Cheng-Wen Wu. and eliminate double inverters whenever possible.  Replace AND and OR gates with NOR gates by using Rules 3 and 4.4 1.  The tree has ÐÓ Ñ Ò levels and ´Ò   ½µ ´Ñ   ½µ Ñ -input gates.4 xi yi ci 1.4 ci+1 2.

4 (b) One possible decomposition (c) Alternative decomposition Figure 24: Decomposition of a 10-input AND gate into 3-input AND gates [Gajski]. Simplification of Boolean Functions 4-28 2.4 2.4 2.  Retiming: performance optimization (delay time minimization)—decomposition of a large gate can produce a tree in which different paths may incur different delays.4 2.4 2. Fig 25 shows two NAND implementations of the 4-bit carry-look-ahead function: ¿ · Ô¿ ¾ · Ô¿Ô¾ ½ · Ô¿ Ô¾Ô½ ¼ · Ô¿Ô¾Ô½ Ô¼ ¼  Carry generate function:  Carry propagate function:  Carry look-ahead function: Ô Ü Ý Ü . EE. ·½ ·Ô  Critical path: the delay on the longest input-output path.  The rule of thumb is to minimize delay on critical paths and minimize cost on non-critical paths.4 2.4. NTHU 2005 .4 2. c ­ Cheng-Wen Wu. A technology mapping example is shown in Fig 26.4 2.4 2. Lab for Reliable Computing (LaRC).4 2. ·Ý . . For example.

8 c4 1.8 Max delay = 6. c ­ Cheng-Wen Wu.8 1.8 g p 1 3 p2 p1 g0 p 3 p p1 2 p0 c0 1.8 1.4.8 1. Lab for Reliable Computing (LaRC). Simplification of Boolean Functions g3 g2 p 3 4-29 p p2 3 g1 p 3 p p1 2 g0 p 3 p p1 2 p c0 0 c4 (a) AND−OR implementation g3 p g2 p2 p 3 3 g p 1 3 p2 p1 g0 p 3 p p1 2 p0 c0 c4 (b) Decomposition of (a) g3 p g2 p2 p 3 3 1.8 1.8 1. NTHU 2005 .8 1.8 Max delay = 9.8 1. EE.8 1.8 1.2 ns (c) NAND implementation of (b) g3 p g2 p2 p 3 3 g p 1 3 p2 p1 g0 p 3 p p1 2 p0 c0 c4 (d) Performance optimized decomposition g3 p g2 p2 p 3 3 1.8 1.8 c4 1.8 g p 1 3 p2 p1 g0 p 3 p p1 2 p0 c0 1.4 ns (e) Performance optimized NAND implementation Figure 25: Two NAND implementations of the 4-bit carry-look-ahead function [Gajski].

NTHU 2005 .4 1.4 F w z 1 1 1.2ns. EE.8ns.0 1. c ­ Cheng-Wen Wu.4 F w z 1 1 1.8ns.4 2.4 1 (f) Cost optimized alternative B (Delay = 3.4 (b) NAND implementation (Delay = 5. Simplification of Boolean Functions 4-30 y w z 2. Cost = 20) y 2.4 1 1 2. Cost = 20) y 2.4 2. Cost = 28) y 1 1.0 1 1 1 F (d) Alternative A (Delay = 5.4 (c) Two possible conversions y w z 1 1.4 F w z 1 1 1.2ns.4 (e) Alternative B (Delay = 3.4 F w z 1.4 1.4 F (a) AND−OR implementation (Delay = 7.0 1.4 2. Cost = 22) B y 1 1.4. Lab for Reliable Computing (LaRC). Cost = 18) Figure 26: Technology mapping example [Gajski].4 A 1.4ns.4 1.

 Static-1 hazard: there are two 1-minterms that differ in only one variable but are not covered by a common product term in a sop implementation (Fig.  Hazards can cause malfunction. Lab for Reliable Computing (LaRC).4. c ­ Cheng-Wen Wu. EE. static 0-hazard static 1 hazard .  It can be eliminated by including an additional PI covering both adjacent 1-minters (called the consensus term) (Fig.  It occurs when the same variable value propagates through the circuit on two different paths with different delays.  It also can be eliminated by inserting a delay element. .  See Fig. 30 for an example. .  It can be eliminated by introducing a redundant (consensus) PI. NTHU 2005 . Simplification of Boolean Functions 4-31 Hazard-Free Design Definition 1 Hazards are unwanted switching transients (glitches) that appear at the output of a circuit because of different propagation delays on different but converging paths through the circuit.  It is a static hazard that occurs during the output transition.  Static hazards are caused by two complementary signals which become equal for short periods of time due to different delays on different paths through the circuit. dynamic hazards Figure 27: Hazards. 29). .  Static-0 hazard: there are two 0-minterms that differ in only one variable but are not covered by a common sum term in a pos implementation.  Dynamic hazard: two signals that always have the same value (even during the transition) become different for a short period of time. 28).

4 F b (b) Logic schematic x y z a 3.4 2.4. c ­ Cheng-Wen Wu.0 t1 t 2 (c) Timing diagram Figure 28: A design with static-1 hazard [Gajski]. Lab for Reliable Computing (LaRC). Simplification of Boolean Functions 4-32 yz x 0 4 5 0 0 01 1 11 3 10 2 1 7 6 1 1 1 1 F = xy’ + yz (a) Map representation x y z 1 a 2.4 2. EE. NTHU 2005 .4 b 2.4 F t0 4.8 1.

4.4 F 2. Simplification of Boolean Functions 4-33 yz x 0 4 5 0 0 01 1 11 3 10 2 1 7 6 1 1 1 1 F = xy’ + yz + xz (a) Map representation x y z 1 2. c ­ Cheng-Wen Wu. NTHU 2005 .4 c F (c) Timing diagram Figure 29: Hazard-free design [Gajski]. EE. Lab for Reliable Computing (LaRC).4 b 2.4 a b 2.4 c (b) Logic schematic x y z a 3.4 2.

Simplification of Boolean Functions 4-34 Static 1−hazard x y z w 1 2.4 1. EE.4 F t0 t1 2.4 2.4.0 d 3. c ­ Cheng-Wen Wu.0 t2 (b) Timing diagram Figure 30: A design with dynamic hazard [Gajski].4 b 2. Lab for Reliable Computing (LaRC). NTHU 2005 .4 a 2.4 1.4 F d (a) Logic schematic x y z w 4.4 e 2.8 e 1.

Sign up to vote on this title
UsefulNot useful

Master Your Semester with Scribd & The New York Times

Special offer for students: Only $4.99/month.

Master Your Semester with a Special Offer from Scribd & The New York Times

Cancel anytime.