digital logic basics - carleton university · chapter 2 7 2–4 by keeping one input at ‘0’, we...

37
Chapter 2 Digital Logic Basics 1

Upload: others

Post on 18-Mar-2020

0 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Digital Logic Basics - Carleton University · Chapter 2 7 2–4 By keeping one input at ‘0’, we can turn an XOR gate into a buffer that passes input to output as shown below:

Chapter 2

Digital Logic Basics

1

Page 2: Digital Logic Basics - Carleton University · Chapter 2 7 2–4 By keeping one input at ‘0’, we can turn an XOR gate into a buffer that passes input to output as shown below:

2 Chapter 2

2–1 Implementation using NAND gates: We can write the XOR logical expression A B+A B usingdouble negation as

A B+A B = A B+ A B

= A B � A B

From this logical expression, we can derive the following NAND gate implementation:

A B

Figure 2.1: 2-input XOR gate using only NAND gates.

Implementation using NOR gates: We can write the XOR logical expression as

A B+A B = A B +A B

= A + B + A + B

From this logical expression, we can derive the following NOR gate implementation:

A B

Figure 2.2: 2-input XOR gate using only NOR gates.

Page 3: Digital Logic Basics - Carleton University · Chapter 2 7 2–4 By keeping one input at ‘0’, we can turn an XOR gate into a buffer that passes input to output as shown below:

Chapter 2 3

2–2 Implementation using NAND gates: We can write the exclusive-NOR logical expression A B+

A B using double negation as

A B + A B = A B + A B

= A B � A B

From this logical expression, we can derive the following NAND gate implementation:

A B

Page 4: Digital Logic Basics - Carleton University · Chapter 2 7 2–4 By keeping one input at ‘0’, we can turn an XOR gate into a buffer that passes input to output as shown below:

4 Chapter 2

Implementation using NOR gates: We can write the exclusive-NOR logical expression as

A B + A B = A B +A B

= A + B + A + B

From this logical expression, we can derive the following NOR gate implementation:

A B

Alternative Implementations:Alternatively, we can derive the following NAND implementation by modifying the logic circuitin Figure 2.1 by adding an output inverter:

A B

Page 5: Digital Logic Basics - Carleton University · Chapter 2 7 2–4 By keeping one input at ‘0’, we can turn an XOR gate into a buffer that passes input to output as shown below:

Chapter 2 5

Similarly, we derive the following NOR implementation by modifying the logic circuit in Fig-ure 2.2 by deleting the output inverter:

A B

Page 6: Digital Logic Basics - Carleton University · Chapter 2 7 2–4 By keeping one input at ‘0’, we can turn an XOR gate into a buffer that passes input to output as shown below:

6 Chapter 2

2–3 A NOT gate can be implemented by holding one input at ‘1’ as shown below:

1

AA

Page 7: Digital Logic Basics - Carleton University · Chapter 2 7 2–4 By keeping one input at ‘0’, we can turn an XOR gate into a buffer that passes input to output as shown below:

Chapter 2 7

2–4 By keeping one input at ‘0’, we can turn an XOR gate into a buffer that passes input to output asshown below:

AA

It is clear from this and the last exercise that by controlling one input (call it control input), we canturn an XOR gate into either an inverter or a buffer. If the control input is ‘1’, the XOR gate actsas an inverter; if the control input is ‘0’, it acts as a buffer.

Page 8: Digital Logic Basics - Carleton University · Chapter 2 7 2–4 By keeping one input at ‘0’, we can turn an XOR gate into a buffer that passes input to output as shown below:

8 Chapter 2

2–5 We can write the AND logical expression (A B) using double negation as

A B = A B

= A + B

From this logical expression, we can derive the following implementation:

A

B

Page 9: Digital Logic Basics - Carleton University · Chapter 2 7 2–4 By keeping one input at ‘0’, we can turn an XOR gate into a buffer that passes input to output as shown below:

Chapter 2 9

2–6 We can write the OR logical expression (A + B) using double negation as

A + B = A + B

= A � B

From this logical expression, we can derive the following implementation:

A

B

Page 10: Digital Logic Basics - Carleton University · Chapter 2 7 2–4 By keeping one input at ‘0’, we can turn an XOR gate into a buffer that passes input to output as shown below:

10 Chapter 2

2–7 The two transistors are in series. Vout is low only when both transistors are turned on. Thishappens only when both Vin1 and Vin2 are high as shown below:

Vin1 Vin2 Vout

low low highlow high highhigh low highhigh high low

As in the text, when we interpret low as ‘0’ and high as ‘1’, it implements the NAND function.

Page 11: Digital Logic Basics - Carleton University · Chapter 2 7 2–4 By keeping one input at ‘0’, we can turn an XOR gate into a buffer that passes input to output as shown below:

Chapter 2 11

2–8 In this example, the two transistors are in parallel. Vout is low when any of the two transistors areturned on. This happens when either Vin1 or Vin2 (or both) is high as shown below:

Vin1 Vin2 Vout

low low highlow high lowhigh low lowhigh high low

As in the text, when we interpret low as ‘0’ and high as ‘1’, it implements the NOR function.

Page 12: Digital Logic Basics - Carleton University · Chapter 2 7 2–4 By keeping one input at ‘0’, we can turn an XOR gate into a buffer that passes input to output as shown below:

12 Chapter 2

2–9 We assume that input A has 50% weight. The truth table is shown below:

A B C F0 0 0 00 0 1 00 1 0 00 1 1 11 0 0 11 0 1 11 1 0 11 1 1 1

We use the Karnaugh map to derive the simplified logical expression.

0

1

00 01 11 10

01

1 1 1 1

00A

A

BCBC

From this K-map, we get the following logical expression:

A + BC

The following logic circuit implements this function:

A

B

C

Page 13: Digital Logic Basics - Carleton University · Chapter 2 7 2–4 By keeping one input at ‘0’, we can turn an XOR gate into a buffer that passes input to output as shown below:

Chapter 2 13

2–10 We assume that input A has the veto power. The truth table is shown below:

A B C F0 0 0 00 0 1 00 1 0 00 1 1 01 0 0 01 0 1 11 1 0 11 1 1 1

The sum-of-products expression for F can be simplified by replicating the term (A B C) as shownbelow:

F = A B C + A B C + A B C

= A B C + A B C + A B C + A B C

= A C + A B

= A(B + C)

You can also use the Karnaugh map method to derive the same logical expression.

The following logic circuit implements this function:

A

B

C

Page 14: Digital Logic Basics - Carleton University · Chapter 2 7 2–4 By keeping one input at ‘0’, we can turn an XOR gate into a buffer that passes input to output as shown below:

14 Chapter 2

2–11 (a) x � x = x

Let us start with x and show that it is equivalent to x � x.

x = x � 1 (Identity)

= x � (x + x) (Complement)

= (x � x) + (x � x) (Distribution)

= (x � x) + 0 (Complement)

= x � x (Identity)

(b) x+ x = x

Let us start with x and show that it is equivalent to x+ x (very similar to the last exercise).

x = x + 0 (Identity)

= x + (x � x) (Complement)

= (x + x) � (x + x) (Distribution)

= (x + x) � 1 (Complement)

= x + x (Identity)

(c) x � 0 = 0

As in the previous examples, we start with the right hand side (0) and show that it is equivalent tox � 0.

0 = x � x (Complement)

= x � (x + 0) (Identity)

= (x � x) + (x � 0) (Distribution)

= 0 + (x � 0) (Complement)

= x � 0 (Identity)

(d) x+ 1 = 1

This is the dual of the last exercise.

1 = x + x (Complement)

= x + (x � 1) (Identity)

= (x + x) � (x + 1) (Distribution)

= 1 � (x + 1) (Complement)

= x + 1 (Identity)

Page 15: Digital Logic Basics - Carleton University · Chapter 2 7 2–4 By keeping one input at ‘0’, we can turn an XOR gate into a buffer that passes input to output as shown below:

Chapter 2 15

2–12 We have to show (x � y) � (x + y) = 0 and (x � y) + (x + y) = 1.

(x � y) � (x + y) = x y x + x y y

= 0 + 0

= 0

(x � y) + (x + y) = x y + x (y + y) + y (x + x)

= x y + x y + x y + y x + y x

= (x y + x y) + (x y + y x)

= (x y + x y) + (x y + y x)

= y + y

= 1

Page 16: Digital Logic Basics - Carleton University · Chapter 2 7 2–4 By keeping one input at ‘0’, we can turn an XOR gate into a buffer that passes input to output as shown below:

16 Chapter 2

2–13 We have to show (x + y) � (x � y) = 0 and (x + y) + (x � y) = 1.

(x + y) � (x � y) = x x y + y x y

= 0 + 0

= 0

(x + y) + (x � y) = x( y + y) + y (x + x) + (x � y)

= x y + x y + y x + y x + x y

= x ( y + y + y) + x (y + y)

= x + x

= 1

Page 17: Digital Logic Basics - Carleton University · Chapter 2 7 2–4 By keeping one input at ‘0’, we can turn an XOR gate into a buffer that passes input to output as shown below:

Chapter 2 17

2–14 AND version: A � B � C = A + B + C

The truth table below verifies the AND version.

A B C A � B � C A + B + C

0 0 0 1 10 0 1 1 10 1 0 1 10 1 1 1 11 0 0 1 11 0 1 1 11 1 0 1 11 1 1 0 0

OR version: A + B + C = A � B � CThe truth table below verifies the OR version.

A B C A + B + C A � B � C0 0 0 1 10 0 1 0 00 1 0 0 00 1 1 0 01 0 0 0 01 0 1 0 01 1 0 0 01 1 1 0 0

Page 18: Digital Logic Basics - Carleton University · Chapter 2 7 2–4 By keeping one input at ‘0’, we can turn an XOR gate into a buffer that passes input to output as shown below:

18 Chapter 2

2–15 From the 3-input NAND gate shown in Figure 2.23b, we can see that each additional input needsan inverter and a 2-input NAND gate. Since we implement the inverter with a 2-input NAND gateas well, we need two 2-input NAND gates for each additional input. Thus, for an n input NANDgate, we need

1 + 2(n� 2)

2-input NAND gates. To build an 8-input NAND gate we need

1 + 2(8� 2) = 13 gates

Since there are four gates in the 7400 chip, we need four 7400 chips.

Page 19: Digital Logic Basics - Carleton University · Chapter 2 7 2–4 By keeping one input at ‘0’, we can turn an XOR gate into a buffer that passes input to output as shown below:

Chapter 2 19

2–16 (a)

(x + y) � (x + y) = (x � y) � x y (de Morgon’s law)

= 0

(b)

x + yx = x (1 + y) + yx

= x + x y + yx

= x + y (x + x)

= x + y

(c)

A B �A B = (A + B) (A + B)

= A A + A B + BA + B B

= A B + A B

Page 20: Digital Logic Basics - Carleton University · Chapter 2 7 2–4 By keeping one input at ‘0’, we can turn an XOR gate into a buffer that passes input to output as shown below:

20 Chapter 2

2–17 Truth table:

A B C F0 0 0 10 0 1 00 1 0 00 1 1 11 0 0 01 0 1 11 1 0 11 1 1 0

Sum-of-products form:A B C + A B C + A B C + A B C

Product-of-sums form:

(A + B + C) (A + B + C) (A + B + C) (A + B + C)

Page 21: Digital Logic Basics - Carleton University · Chapter 2 7 2–4 By keeping one input at ‘0’, we can turn an XOR gate into a buffer that passes input to output as shown below:

Chapter 2 21

2–18 We start with the product-of-sums expression and derive the sum-of-products expression.

(A + B + C) (A + B + C) (A + B + C) (A + B + C)

= (A + A B+ A C + A B + B C + A C +B C) (A + B + C) (A + B+C)

= (A B C +A B C+ A B + A B C + B C + A B C+ A C + A B C) (A + B+C)

= A B C + A B C + A B C + A B C

Page 22: Digital Logic Basics - Carleton University · Chapter 2 7 2–4 By keeping one input at ‘0’, we can turn an XOR gate into a buffer that passes input to output as shown below:

22 Chapter 2

2–19 Logic expression for Figure 2.10a is (A B).

Logic expression for Figure 2.10b is A + B.We show that this expression is equivalent to (A B).

A + B = A � B (de Morgon’s law)

Page 23: Digital Logic Basics - Carleton University · Chapter 2 7 2–4 By keeping one input at ‘0’, we can turn an XOR gate into a buffer that passes input to output as shown below:

Chapter 2 23

2–20 We start with the product-of-sum expression and derive the other expression.

(A + B + C) (A + B + C) (A + B + C) (A + B + C)

= (A + A B + A C + B + B C + A C+ B C) (A +B+ C) (A + B +C)

= (A + A B + A C + A B C + A C+ A B C+ A B+ A B C + A B C+ B C) (A + B +C)

= A B C + A B + A B C + A B C + B C + A C + A B C

By observing that A B + A B C + B C + A C is equivalent to (A B C), we derive the sum-of-products expression.

Page 24: Digital Logic Basics - Carleton University · Chapter 2 7 2–4 By keeping one input at ‘0’, we can turn an XOR gate into a buffer that passes input to output as shown below:

24 Chapter 2

2–21 We start with the product-of-sums expression and derive the sum-of-products expression.

(A + B + C) (A + B + C) (A + B + C) (A + B + C)

= (A + A B+ A C+ A B + B C+ A C +B C) (A + B +C) (A + B+ C)

= (A B C+A B C + A B + A B C+ B C + A B C + A C + A B C) (A + B+ C)

= A B C + A B C + A B C + A B C

Page 25: Digital Logic Basics - Carleton University · Chapter 2 7 2–4 By keeping one input at ‘0’, we can turn an XOR gate into a buffer that passes input to output as shown below:

Chapter 2 25

2–22 Replace the exercise in the book by the following:Using Boolean algebra show that the following two expressions are equivalent:

A B C + A C D + A B C + A B D + A B C + A C + A B C D

A + B D + C D + B C + B C D

Solution:

A B C + A B C + A C D + A B C + A B D + A C + A B C D

= A C (B + B) + A C D + A B C + A B D + A C + A B C D

= (A C + A C) + A C D + A B C + A B D + A B C D

= A + A C D + A (1 + C D) + A B C + A (1 + B C) +

A B D + A (1 + B D) + A B C D + A (1 + B C D)

= A + C D + B C + B D + B C D

Page 26: Digital Logic Basics - Carleton University · Chapter 2 7 2–4 By keeping one input at ‘0’, we can turn an XOR gate into a buffer that passes input to output as shown below:

26 Chapter 2

2–23 The logic circuit is shown below:

Page 27: Digital Logic Basics - Carleton University · Chapter 2 7 2–4 By keeping one input at ‘0’, we can turn an XOR gate into a buffer that passes input to output as shown below:

Chapter 2 27

2–24 We need a 7-input XOR gate to derive the parity bit. We can construct 1 7-input XOR using 2-inputXOR gates as shown below:

A0

A1

A2

A3

A4

A5

A6

P

We need to add an inverter at the output to generate odd parity bit.

Page 28: Digital Logic Basics - Carleton University · Chapter 2 7 2–4 By keeping one input at ‘0’, we can turn an XOR gate into a buffer that passes input to output as shown below:

28 Chapter 2

2–25

B D + A C D + A B D = B D (1 + A C) + A C D (B + B) + A B D

= B D + B D A C + A B C D + A B C D + A B D

= B D + A B C (D + D) + A B D (1 + C)

= B D + A B C + A B D

Page 29: Digital Logic Basics - Carleton University · Chapter 2 7 2–4 By keeping one input at ‘0’, we can turn an XOR gate into a buffer that passes input to output as shown below:

Chapter 2 29

2–26 The truth table is shown below:

A B C F0 0 0 10 0 1 00 1 0 10 1 1 01 0 0 11 0 1 01 1 0 11 1 1 0

A B C + A B C + A B C + A B C = A C(B + B) + A C(B + B)

= C(A + A)

= C

Clearly, we just need one inverter to implement this simplified logical expression.

Page 30: Digital Logic Basics - Carleton University · Chapter 2 7 2–4 By keeping one input at ‘0’, we can turn an XOR gate into a buffer that passes input to output as shown below:

30 Chapter 2

2–27 The truth table is shown below:

A B C D F0 0 0 0 10 0 0 1 00 0 1 0 00 0 1 1 00 1 0 0 10 1 0 1 00 1 1 0 00 1 1 1 01 0 0 0 11 0 0 1 01 0 1 0 01 0 1 1 01 1 0 0 11 1 0 1 01 1 1 0 01 1 1 1 0

From the following Karnaugh map

C D

1

1

1

1

0

0

0

0

0

0

0

0

0

0

0

0

00

01

11

10

00 01 11 10ABCD

we get the simplified logical expression as (C D).We just need a single NOR gate to implement this.

Page 31: Digital Logic Basics - Carleton University · Chapter 2 7 2–4 By keeping one input at ‘0’, we can turn an XOR gate into a buffer that passes input to output as shown below:

Chapter 2 31

2–28 The following table finds the prime implicants:

Column 1 Column 2 Column 3

A B C Dp

A C Dp

C D

A B C Dp

B C Dp

A B C Dp

B C Dp

A B C Dp

A C Dp

There is no need for Step 2. The simplified expression is C D.

Page 32: Digital Logic Basics - Carleton University · Chapter 2 7 2–4 By keeping one input at ‘0’, we can turn an XOR gate into a buffer that passes input to output as shown below:

32 Chapter 2

2–29 The truth table is shown below:

A B C D F0 0 0 0 00 0 0 1 00 0 1 0 00 0 1 1 00 1 0 0 00 1 0 1 10 1 1 0 10 1 1 1 11 0 0 0 11 0 0 1 11 0 1 0 11 0 1 1 01 1 0 0 01 1 0 1 01 1 1 0 01 1 1 1 0

From the following Karnaugh map

0

0

0

1

0

1

0

1

0

1

0

0

0

1

1

0

00

01

11

10

00 01 11 10ABCD

we derive the simplified expression as

A B D + A B C + A B D + A B C = A B (C + D) + A B (C + D)

The following circuit implements this logic expression:

Page 33: Digital Logic Basics - Carleton University · Chapter 2 7 2–4 By keeping one input at ‘0’, we can turn an XOR gate into a buffer that passes input to output as shown below:

Chapter 2 33

B

A

C

D

BA

C

D

Page 34: Digital Logic Basics - Carleton University · Chapter 2 7 2–4 By keeping one input at ‘0’, we can turn an XOR gate into a buffer that passes input to output as shown below:

34 Chapter 2

2–30 The following table finds the prime implicants:

Column 1 Column 2

— A B D

A B C Dp

A B C

A B C Dp

A B D

A B C Dp

A B C

A B C Dp

A B C Dp

A B C Dp

Step 2:

Primeimplicants

Input product terms

ABCD ABCD AB CD ABCD ABCD AB C D

ABD �N

A BC �N

A B DN

AB CN

The minimal expression is

A B D + A B C + A B D + A B C = A B (C + D) + A B (C + D)

Page 35: Digital Logic Basics - Carleton University · Chapter 2 7 2–4 By keeping one input at ‘0’, we can turn an XOR gate into a buffer that passes input to output as shown below:

Chapter 2 35

2–31 The truth table is shown below:

A B C D F0 0 0 0 00 0 0 1 00 0 1 0 10 0 1 1 00 1 0 0 10 1 0 1 10 1 1 0 00 1 1 1 01 0 0 0 01 0 0 1 01 0 1 0 01 0 1 1 11 1 0 0 11 1 0 1 01 1 1 0 11 1 1 1 0

From the following Karnaugh map

0

1

1

0

0

1

0

0

0

0

0

1

1

0

0

1

00

01

11

10

00 01 11 10ABCD

we derive the following simplified logic expression:

A B C D + A B C D + A B C + A B D = B C (A D + A D) + A B C + A B D

An implementation of this logic expression is shown below:

Page 36: Digital Logic Basics - Carleton University · Chapter 2 7 2–4 By keeping one input at ‘0’, we can turn an XOR gate into a buffer that passes input to output as shown below:

36 Chapter 2

AB

C

AB

D

BC

A

D

Page 37: Digital Logic Basics - Carleton University · Chapter 2 7 2–4 By keeping one input at ‘0’, we can turn an XOR gate into a buffer that passes input to output as shown below:

Chapter 2 37

2–32 The following table finds the prime implicants:

Column 1 Column 2

— —

A B C D A B C

B C D

A B C Dp

A B D

A B C Dp

A B C Dp

A B C D

A B C Dp

Step 2:

Primeimplicants

Input product terms

ABCD ABCD ABCD A BCD ABC D A B CD

ABC �N

BCD � �

A BD �N

A BCDN

ABC DN

We derive the following simplified logic expression:

A B C D + A B C D + A B C + A B D = B C (A D + A D) + A B C + A B D