Boolean Algebra and Logic Gates

Boolean Algebra and Logic Gates Ranga Rodrigo July 11, 2009 Outline Contents 1 The Map Method 1.1 Tow-Variable Map . . 1.2 Three-Variable Map . 1.3 F...
11 downloads 0 Views 81KB Size
Boolean Algebra and Logic Gates Ranga Rodrigo July 11, 2009

Outline Contents 1 The Map Method 1.1 Tow-Variable Map . . 1.2 Three-Variable Map . 1.3 Four-Variable Map . 1.4 Five-Variable Map . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

1 2 3 5 6

2 Product-of-Sums Simplification

8

3 Don’t-Care Conditions

9

4 NAND and NOR Implementations

9

1 The Map Method Gate-level minimization refers to the design task of finding an optimal gate-level implementation of the Boolean function describing a digital circuit. In this section, we will discuss the manual design of dimple circuits. The complexity of a digital logic-gate circuit that implements a Boolean function directly depends on the complexity of the corresponding algebraic expression. Although the truth-table representation of a function is unique, it algebraic form can take many different, but equivalent, forms. Minimization of Boolean function using the algebraic method is awkward. The map method provides a well-structured method of minimizing Boolean functions. The map method is also known as the Karnaugh map or k-map method. The simplified expression produced by the map are always in two standard forms: sum of products or product of sums. We will assume that the simplest algebraic expression is an algebraic expression with a minimum number of terms and with the smallest possible number of literals in each term. This expression produces a circuit diagram with a minimum number of gates and the minimum number of inputs to each gate. However, this simplest expression is not unique: It is possible to sometimes find two or more expressions that satisfy the minimization criteria. In that case, each solution is satisfactory.

1

x

y

0

m0 m0

m1

0

m2

m3

1

x0 y 0

x0 y m3

m2 x y0

(a)

1 m1

xy

(b)

Figure 1: Two-variable map.

1.1 Tow-Variable Map In the two-variable map shown in Figure 1(a), there are four minterms for two variables. Hence the map consists of four squares one for each minterm. The map is redrawn in 1(b) to show the relationship between the squares and the two variables x, and y. If we mark the squares whose minterms belong to a given function, the twovariable map becomes another useful way to represent any one of the 16 Boolean functions of two variables. Example 1. Represent f = x y in a map.

Example 2. Represent f = x + y in a map.

2

x

yz

00 m0 x0 y 0 z0

0

m4 1

x y 0 z0

01

10

11 m3

m1 x0 y 0 z m5 x y0z

x0 y z m7 xyz

m2 x0 y z0 m6 x y z0

Figure 2: Three-variable map.

1.2 Three-Variable Map There are eight minterms for three binary variables; therefore the map consists of eight squares. Not that minterms are arranged not in a binary sequence but in a sequence similar to the Gray code, where only one bit changes from one adjacent column to the next. Figure 2 shows the four-variable map. Simplifying Any two adjacent squares in the map differs by only one variable. Form the postulates of Boolean algebra it follows that the sum of two minterms in adjacent squares can be simplified to a single AND term consisting of only two literals. For example, m 5 + m 7 = x y 0 z + x y z = xz(y 0 + y) = xz.

Example 3. Simplify the Boolean function F (x, y, z) =

3

P

(2, 3, 4, 5).

F (x, y, z) = x 0 y + x y 0 . In certain cases, two squares in the map are considered to be adjacent even though they do not touch each other. For example, in the three-variable map m 0 is adjacent to m 2 ,and m 4 is adjacent to m 6 , because the minterms differ by only one variable. P Example 4. Simplify the Boolean function F (x, y, z) = (3, 4, 6, 7).

Example 5. Simplify the Boolean function F (x, y, z) =

4

P

(0, 2, 5, 6).

wx

yz

00 m0

00

w 0 x y 0 z0 m 12

11

w x y 0 z0 m8

10

w x0 y 0 z0

m5

w 0 x0 y z m7

w0x y0z m 13 w x y0z m9

w0x yz

m2 w 0 x0 y z0 m6 w 0 x y z0

m 15 m 14 wxyz w x y z0 m 11

w x0 y 0 z

10

11 m3

w 0 x0 y 0 z0 w 0 x0 y 0 z m4

01

01 m1

w x0 y z

m 10 w x0 y z0

Figure 3: Four-variable map.

1.3 Four-Variable Map In the four-variable map there are 16 minterms. In addition to the columns, the rows are numbered such that only one variable changes between two adjacent rows or columns. Adjacent squares are defined to be squares next to each other. In addition, the map is considered to lie on a surface with the top and bottom edges, as well as right and left edges touching each other. Figure 3 shows the four-variable map. P Example 6. Simplify the Boolean function F (w, x, y, z) = (0, 1, 2, 4, 5, 6, 8, 9, 12, 13, 14).

5

Example 7. Simplify the Boolean function F (A, B,C , D) = A 0 B 0C 0 +B 0C D 0 + A 0 BC D 0 + AB 0C 0 .

1.4 Five-Variable Map Maps for more than four variables are not simple to use as maps for four or fewer variables. A five-variable map needs 32 squares and a six-variable map needs 64. When the number of variables become large, the number of squares become excessive and the geometry for combining adjacent squares become more involved. The five-variable map consists of 2 four-variable maps with variables A, B , C , D, and E . Variable A distinguishes between the two maps. The left-hand four-variable map represents the 16 squares in which A = 0, and the other four-variable map represents the squares in which A = 1. Minterms 0 through 15 belongs with A = 0 and

6

BC DE

00

m0

m7

m 13

m 12

m8

00

6

01

14

11

m6

m 15

m9

8

2

15 m 11

9

11

m 10 10

(a) A = 0

m 21

19 m 23

23

21 m 29

28 m 24

10

11 m 19

17

20 m 28

m 14

01 m 17

16 m 20

7

13

12

11

3

5

4

00

m 16

m2

1 m5

m4 01

BC DE

10

11 m3

0

00

10

01 m1

m 31

29 m 25

31 m 27

25

24

27

10 m 18

18 m 22

22 m 30

30 m 26

26

(b) A = 1

Figure 4: Five-variable map.

minterms 16 through 31 with A = 1. In addition to the adjacency that we already discussed, each square in the A = 0 map is adjacent to the corresponding square in the A = 1 map. Figure 4 shows the five-variable map. Maps with six or more variables need too many squares and are impractical to use. The alternative is to use computer-based methods. P Example 8. Simplify the Boolean function F (A, B,C , D, E ) = (0, 2, 4, 6, 9, 13, 21, 23, 25, 29, 31).

7

2 Product-of-Sums Simplification The minimized Boolean function derived from the map in all previous examples were expressed in sum-of-products form. With a minor modification, the productsof-sums form can be obtained. The procedure for obtaining a minimized function of product-of-sums form follows form the basic properties of Boolean functions. The minterms not included in the standard sum-of-products form of a function denote the complement of the function. From this observation, we see that the complement of the function is represented in the map by the squares not marked by 1s. If we mark the empty squares by 0s and combine them in to valid adjacent squares, we obtain a simplified expression of the complement of the function, F 0 . The complement of F 0 gives back F . Because of the generalized DeMorgan’s theorem, the function so obtained is automatically in product-of-sums form. P Example 9. Simplify the Boolean function F (A, B,C , D) = (0, 1, 2, 5, 8, 9, 10) into (a) sums-of-product form and (b) product-of-sums form.

8

3 Don’t-Care Conditions The logical sum of minterms associated with a Boolean function specifies the conditions under which the function is equal to 1. The function is equal to zero for the rest of the minterms. This assumes that all the combinations of the values for the variables of the function are valid. In some applications, the function is not specified for certain combinations of variables. Functions that have unspecified outputs for some input conditions are called incompletely specified functions. In most applications, we simply don’t care what value is assumed by the minterms of a function’s don’t-care conditions. To distinguish don’t-care conditions from 1s and 0s, an x is used. In choosing adjacent squares to simplify the function in a map, the don’t-care minterms may be assumed to be either 0 or 1. Example 10. Simplify the Boolean function X F (w, x, y, z) = (1, 3, 7, 11, 15) which has the don’t-care conditions d (w, x, y, z) =

X

(0, 2, 5).

4 NAND and NOR Implementations Digital circuits are frequently constructed with NAND or NOR gates rather than with AND or OR gates. NAND and NOR gates are easier to fabricate and are basic gates used in IC digital logic families. 9

NAND Circuits The NAND gate is said to be a universal gate, because any digital system can be implemented using NAND gates. To show that any circuit can be implemented with NAND gates we need only to show that logical operations, AND, OR, and NOT, can be obtained by NAND gates alone. A convenient way to implement a Boolean function with NAND gates is to obtain the simplified Boolean function and then convert the function to NAND logic. Two-Level Implementation The NAND implementation requires the function to be in sum-of-products form. Example 11. Implement the Boolean function F = AB +C D using NAND gates.

Example 12. Implement the following Boolean function using NAND gates: X F (x, y, z) = (1, 2, 3, 4, 5, 7).

10

NAND Implementation Procedure 1. Simplify the function and express it in sum-of-products form. 2. Draw a NAND gate for each product term of the expression that has at least two literals. The inputs to each NAND gate are the literals of the term. This procedure produces a group of first-level gates. 3. Draw a single gate using AND-invert or the invert-OR graphic symbol in the second level, with inputs coming from the outputs of the first-level gates. 4. A term with a single literal requires an inverter in the first level. However, if the single literal is complemented, it can be connected directly to an input of the second-level NAND gate. Example 13. Implement the following Boolean function using NAND gates: F = (AB 0 + A 0 B 0 )(C + D 0 ).

11

NOR Implementation The NOR operation is the dual of the NAND operation. Therefore, all procedures and rules for NOR logic gates are the duals of the corresponding procedures and rules developed for the NAND logic. The NOR gate is another universal gate that can be used to implement an y Boolean function. A two-level implementation with NOR gates require that the function be simplified into product-of-sum form. Example 14. Implement the following Boolean function using NOR gates: F = (A + B )(C + D)E .

12