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

 K-maps provide visual aid to identify PIs and EPIs.4. NTHU 2005 . Lab for Reliable Computing (LaRC).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.  They are used for manual minimization of Boolean functions. c ­ Cheng-Wen Wu. 2-10 Three-Variable Map (b) Figure 6: Three-variable map simplification [Mano & Kime]. 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. 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. Ü ÝÞ Ñ¼ ѽ Ñ¿ Ѿ Ñ Ñ Ñ Ñ 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. EE. 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.

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

2-16 F( X. Simplification of Boolean Functions Example 3 Simplify the Boolean function YZ 00 X 0 X 1 1 ´ µ È 10 4-6 ´½ ¿ µ. Y 01 1 1 Z 11 1 1 Fig. 3. 2-15 F( X. Lab for Reliable Computing (LaRC). NTHU 2005 . 6) ¾ Example 4 Simplify the Boolean function YZ 00 X 0 X 1 01 1 1 Z Fig. 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.2 .4. EE. c ­ Cheng-Wen Wu. 5. 5. 7) ¼ · ¼ · ¼ · . Y . Z ) = Σ m (1 . Z ) = Σm(1. Y . 4. 3.

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

2-18 Four-Variable Map: Flat and on a Torus to Show Adjacencies Example 7 Simplify the Boolean function ´Ï µ È Y 10 1 1 ¾ ´¼ ½ ¾ ½¾ ½¿ ½ µ.4. 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 . XZ 2 10 11 3 XZ (b) Fig. EE. 2-19 Map for Example 2-5: F = Y + WZ + XZ ¾ c ­ Cheng-Wen Wu. Lab for Reliable Computing (LaRC). NTHU 2005 . YZ 00 WX 00 01 11 W 10 1 1 1 1 01 1 1 1 1 Z 11 X 1 Fig.

 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. (2) CAD programs. ¼ ½ area that gives a product term of Ò   . Ò c ­ Cheng-Wen Wu. 01 1 11 B 1 D 1 Fig. 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 ¼ ¼ · ¼ ¼ · ¼ ¼ . and thus are impractical.  Any ¾ adjacent squares.  (1) Variable-entered maps (VEMs). EE. Lab for Reliable Computing (LaRC).  Maps of 6 or more variables are hard to read. NTHU 2005 .  It is possible to construct a 6-variable map with four 4-variable maps by following a similar procedure.4. in an Ò-variable map represent an literals.

NTHU 2005 . Lab for Reliable Computing (LaRC).4. c ­ Cheng-Wen Wu. EE. 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].

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: ¾ . and complement it to give the pos form: · ¼ · c ­ Cheng-Wen Wu.4. Lab for Reliable Computing (LaRC). 6 the extension sequence in each dimension is a Gray sequence. NTHU 2005 . Example 9 We want to simplify the following function in sop & pos: ´ µ ´¼ ½ ¾ ½¼µ (a) Mark the map with 1s and 0s according to the function. Simplification of Boolean Functions 4-11 Theorem 1 In a K-map. B In general. 2 minterms are adjacent iff they differ in exactly 1 variable. EE. for an Ò-variable function. 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) Use the 1s to determine the EPIs of . we can construct a -D 6 the map is extended in each dimension on 2 of the variables. which immediately give the sop form: ¼ ¼ · ¼ ¼ ¼ · ¼ ¼ (c) Use the 0s to determine the EPIs of ¼ .

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

2-22 Simplification with Prime Implicants in Example 2-8 Figure 13: Simplification with PIs for È ´¼ ½¼ ½½ ½¾ ½¿ ½ µ [Mano & Kime]. 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. 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. NTHU 2005 . Lab for Reliable Computing (LaRC). EE. c ­ Cheng-Wen Wu.4. 2-23 Map for Example 2-9 1 Figure 14: Simplification with PIs for È ´¼ ½ ¾ ½¼ ½½ ½¿ ½ µ [Mano & Kime].

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

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

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

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

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

 The Quine-McCluskey method also can be extended for this purpose. Lab for Reliable Computing (LaRC). NTHU 2005 .4. Simplification of Boolean Functions 4-19 *Multi-Output Minimization Using Maps  Identify all possible PIs that cover each implicated minterms in each output expression. ½ ¾ ¿ ¼ ¼ ¼ · · · ¼ ¼ · · ¼ ¼ · ¼ ¼ ¼ · · ¼ ¼ ¼ · ¼ c ­ Cheng-Wen Wu. EE. ½´ ¾´ ¿´ 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. and search for a minimal cover by using shared terms.

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. 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. ½ ¼ ¼ ¼ ¼ ¼ ´ ¼ ¼ ´ ¼ ¨ ¨´ ¨ µ´ · µ· · µ´ ¨ · ¼ ¼ ¼ ¼ · µ´ ¼ ¼ ¼ ¼ µ· µ ¼ ´ ¨ · ¼ µ·´ ¨ · µ µ ¼ ¾ ¼ ¼ ¼ ¼ ´ ¼ ¨ · ¼ ¼ ´ ¨ ¼ µ ¼ ¼ ¿ ´ ¼ ¼ ¨ ¨ · · ¼ ¼ µ c ­ Cheng-Wen Wu. EE. NTHU 2005 . Lab for Reliable Computing (LaRC). 2) offset adjacencies.

only NAND (or NOR) gates are used. OR. c ­ Cheng-Wen Wu. 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. EE. Lab for Reliable Computing (LaRC). and NOT gates to one with only NAND or NOR gates is an example of technology mapping. in gate arrays.  The conversion process from an expression/schematic with AND.4. Note that a 1-input NAND gate can replace an inverter. NAND gate or Ü ¼ · ݼ · Þ¼ ´ÜÝÞ µ¼ NOR gate or Ü Ý Þ ¼ ¼ ¼ ´Ü · Ý · Þ µ¼ Figure 18: NAND/NOR gates. For example. NTHU 2005 . 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.

¼ c ­ Cheng-Wen Wu.4.  It is the dual of the NAND-NAND implementation. NTHU 2005 .  Because of the INVERT part in each case. Simplification of Boolean Functions 4-22  AND-OR NAND-NAND  The process can be done directly on the logic diagram. Lab for Reliable Computing (LaRC). Note that a 1-input NOR gate can replace an inverter.  The types of gates most often found in ICs are NAND & NOR. EE.  OR-AND NOR-NOR  The process can be done directly on the logic diagram. B OR-NAND & NOR-OR implementations: 6 Both perform the OR-AND-INVERT (OAI) function. it is convenient to use the simplification of (the complement of the function) instead of . so NAND & NOR logic implementations are the most important from a practical point of view. 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. B NAND-AND & AND-NOR implementations: 6 Both perform the AND-OR-INVERT (AOI) function.

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

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

2-38 Maps for Multiple-Variable Odd Functions Figure 21: Implementing the Odd function with XOR gates [Mano & Kime]. 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. Lab for Reliable Computing (LaRC). 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. c ­ Cheng-Wen Wu. NTHU • • • • • F=X Y C 10 1 B 1 D 2005 .4.

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]. NTHU 2005 . EE. and NOT gates to one with only NAND or NOR gates is an example of technology mapping.4.  The conversion process from an expression/schematic with AND. OR. c ­ Cheng-Wen Wu. Lab for Reliable Computing (LaRC). 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.

 Replace AND and OR gates with NAND gates by using Rules 1 and 2.4.4 1. c ­ Cheng-Wen Wu. EE. Fig 24 shows the decomposition of a 10-input AND gate into 3-input AND gates.4 xi yi ci 1.4 ci+1 1. For example.4 1.  Term decomposition: each Ò-input gate is decomposed into a tree of Ñ-input gates. where Ò Ñ. 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 xi yi ci 1.4 (d) NOR implementation Figure 23: NAND and NOR implementations of the carry function [Gajski].4 ci+1 2.  The tree has ÐÓ Ñ Ò levels and ´Ò   ½µ ´Ñ   ½µ Ñ -input gates.  Replace AND and OR gates with NOR gates by using Rules 3 and 4.4 2. NTHU 2005 .4 (c) NAND implementation xi yi ci 2.4 2.4 2. and eliminate double inverters whenever possible. and eliminate double inverters whenever possible.4 ci+1 1.4 1.4 1. Lab for Reliable Computing (LaRC). ¾ xi yi ci 2.4 ci+1 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. c ­ Cheng-Wen Wu.4 2. NTHU 2005 .4. Fig 25 shows two NAND implementations of the 4-bit carry-look-ahead function: ¿ · Ô¿ ¾ · Ô¿Ô¾ ½ · Ô¿ Ô¾Ô½ ¼ · Ô¿Ô¾Ô½ Ô¼ ¼  Carry generate function:  Carry propagate function:  Carry look-ahead function: Ô Ü Ý Ü .4 2. ·½ ·Ô  Critical path: the delay on the longest input-output path. ·Ý .4 2. Lab for Reliable Computing (LaRC).4 2.4 (b) One possible decomposition (c) Alternative decomposition Figure 24: Decomposition of a 10-input AND gate into 3-input AND gates [Gajski].4 2.4 2. EE. For example.4 2. Simplification of Boolean Functions 4-28 2.  The rule of thumb is to minimize delay on critical paths and minimize cost on non-critical paths. A technology mapping example is shown in Fig 26. .4 2.

4.8 1.8 1.8 g p 1 3 p2 p1 g0 p 3 p p1 2 p0 c0 1.8 1.4 ns (e) Performance optimized NAND implementation Figure 25: Two NAND implementations of the 4-bit carry-look-ahead function [Gajski].8 1.8 1.8 1.8 1. c ­ Cheng-Wen Wu.8 Max delay = 6. EE.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 Max delay = 9. 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.8 c4 1.8 c4 1.8 1. Lab for Reliable Computing (LaRC). NTHU 2005 .8 g p 1 3 p2 p1 g0 p 3 p p1 2 p0 c0 1.

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

 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.  It also can be eliminated by inserting a delay element. NTHU 2005 .  It occurs when the same variable value propagates through the circuit on two different paths with different delays. . 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. .  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. 28).  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.  Dynamic hazard: two signals that always have the same value (even during the transition) become different for a short period of time. dynamic hazards Figure 27: Hazards.  It is a static hazard that occurs during the output transition.  Hazards can cause malfunction.4. static 0-hazard static 1 hazard . .  See Fig. 30 for an example.  It can be eliminated by including an additional PI covering both adjacent 1-minters (called the consensus term) (Fig. c ­ Cheng-Wen Wu. EE. Lab for Reliable Computing (LaRC). 29).  It can be eliminated by introducing a redundant (consensus) PI.

Lab for Reliable Computing (LaRC).8 1.4.4 F t0 4.4 2. EE.0 t1 t 2 (c) Timing diagram Figure 28: A design with static-1 hazard [Gajski]. c ­ Cheng-Wen Wu.4 F b (b) Logic schematic x y z a 3. 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.4 b 2. NTHU 2005 .

4 F 2.4 b 2. c ­ Cheng-Wen Wu.4 c F (c) Timing diagram Figure 29: Hazard-free design [Gajski].4. NTHU 2005 . Lab for Reliable Computing (LaRC).4 2. EE.4 a b 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.4 c (b) Logic schematic x y z a 3.

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

Sign up to vote on this title
UsefulNot useful