Logic Gates. Transistors as Switches ¡EB voltage controls whether the transistor conducts in a...

23
Logic Gates

Transcript of Logic Gates. Transistors as Switches ¡EB voltage controls whether the transistor conducts in a...

Page 1: Logic Gates. Transistors as Switches ¡EB voltage controls whether the transistor conducts in a common base configuraiton. ¡Logic circuits can be built.

Logic Gates

Page 2: Logic Gates. Transistors as Switches ¡EB voltage controls whether the transistor conducts in a common base configuraiton. ¡Logic circuits can be built.

Transistors as Switches

EB voltage controls whether the transistor conducts in a common base configuraiton.

Logic circuits can be built

Page 3: Logic Gates. Transistors as Switches ¡EB voltage controls whether the transistor conducts in a common base configuraiton. ¡Logic circuits can be built.

AND

In order for current to flow, both switches must be closed¤ Logic notation AB = C

A B C

0 0 0

0 1 0

1 0 0

1 1 1

Page 4: Logic Gates. Transistors as Switches ¡EB voltage controls whether the transistor conducts in a common base configuraiton. ¡Logic circuits can be built.

OR

Current flows if either switch is closed¤ Logic notation A + B = C

A B C

0 0 0

0 1 1

1 0 1

1 1 1

Page 5: Logic Gates. Transistors as Switches ¡EB voltage controls whether the transistor conducts in a common base configuraiton. ¡Logic circuits can be built.

Properties of AND and OR

Commutation¤ A + B = B + A¤ A B = B A

Same as

Same as

Page 6: Logic Gates. Transistors as Switches ¡EB voltage controls whether the transistor conducts in a common base configuraiton. ¡Logic circuits can be built.

Properties of AND and OR

Associative Property¤ A + (B + C) = (A + B) + C

¤ A (B C) = (A B) C

=

Page 7: Logic Gates. Transistors as Switches ¡EB voltage controls whether the transistor conducts in a common base configuraiton. ¡Logic circuits can be built.

Properties of AND and OR

Distributive Property¤ A + B C = (A + B) (A + C)¤ A + B C

A B C Q

0 0 0 0

0 0 1 0

0 1 0 0

1 0 0 1

1 0 1 1

1 1 0 1

1 1 1 1

Page 8: Logic Gates. Transistors as Switches ¡EB voltage controls whether the transistor conducts in a common base configuraiton. ¡Logic circuits can be built.

Distributive Property

(A + B) (A + C)

A B C Q

0 0 0 0

0 0 1 0

0 1 0 0

1 0 0 1

1 0 1 1

1 1 0 1

1 1 1 1

Page 9: Logic Gates. Transistors as Switches ¡EB voltage controls whether the transistor conducts in a common base configuraiton. ¡Logic circuits can be built.

Binary Addition

A B S C(arry)

0 0 0 0

1 0 1 0

0 1 1 0

1 1 0 1

Notice that the carry results are the same as AND

C = A B

Page 10: Logic Gates. Transistors as Switches ¡EB voltage controls whether the transistor conducts in a common base configuraiton. ¡Logic circuits can be built.

Inversion (NOT)

A Q

0 1

1 0Logic:

AQ

Page 11: Logic Gates. Transistors as Switches ¡EB voltage controls whether the transistor conducts in a common base configuraiton. ¡Logic circuits can be built.

Exclusive OR (XOR)

Either A or B, but not both

This is sometimes called the inequality detector, because the result will be 0 when the inputs are the same and 1 when they are different.

The truth table is the same as for S on Binary Addition. S = A B

A B S

0 0 0

1 0 1

0 1 1

1 1 0

Page 12: Logic Gates. Transistors as Switches ¡EB voltage controls whether the transistor conducts in a common base configuraiton. ¡Logic circuits can be built.

Getting the XOR

A B S

0 0 0

1 0 1

0 1 1

1 1 0

Two ways of getting S = 1

BAor BA

Page 13: Logic Gates. Transistors as Switches ¡EB voltage controls whether the transistor conducts in a common base configuraiton. ¡Logic circuits can be built.

Circuit for XOR

Accumulating our results: Binary addition is the result of XOR plus AND

BA BABA

Page 14: Logic Gates. Transistors as Switches ¡EB voltage controls whether the transistor conducts in a common base configuraiton. ¡Logic circuits can be built.

Half Adder

Called a half adder because we haven’t allowed for any carry bit on input. In elementary addition of numbers, we always need to allow for a carry from one column to the next.

18

25

4

3 (plus a carry)

Page 15: Logic Gates. Transistors as Switches ¡EB voltage controls whether the transistor conducts in a common base configuraiton. ¡Logic circuits can be built.

Full Adder

INPUTS OUTPUTS

A B CIN COUT S

0 0 0 0 0

0 0 1 0 1

0 1 0 0 1

0 1 1 1 0

1 0 0 0 1

1 0 1 1 0

1 1 0 1 0

1 1 1 1 1

Page 16: Logic Gates. Transistors as Switches ¡EB voltage controls whether the transistor conducts in a common base configuraiton. ¡Logic circuits can be built.

Full Adder Circuit

Page 17: Logic Gates. Transistors as Switches ¡EB voltage controls whether the transistor conducts in a common base configuraiton. ¡Logic circuits can be built.

Chaining the Full Adder

Possible to use the same scheme for subtraction by

noting that

A – B = A + (-B)

Page 18: Logic Gates. Transistors as Switches ¡EB voltage controls whether the transistor conducts in a common base configuraiton. ¡Logic circuits can be built.

Binary CountingUse 1 for ON

Use 0 for OFF

= 00101011

Binary Counter

So our example has 25 + 23 + 21 + 20 = 32 + 8 + 2 + 1 = 43

Page 19: Logic Gates. Transistors as Switches ¡EB voltage controls whether the transistor conducts in a common base configuraiton. ¡Logic circuits can be built.

1 1 11 1011 21 10101

2 10 12 1100 22 10110

3 11 13 1101 23 10111

4 100 14 1110 24 11000

5 101 15 1111 25 11001

6 110 16 10000 26 11010

7 111 17 10001 27 11011

8 1000 18 10010 28 11100

9 1001 19 10011 29 11101

10 1010 20 10100 30 11110

Page 20: Logic Gates. Transistors as Switches ¡EB voltage controls whether the transistor conducts in a common base configuraiton. ¡Logic circuits can be built.

NAND (NOT AND)

A B Q

0 0 1

0 1 1

1 0 1

1 1 0

BAQ

Page 21: Logic Gates. Transistors as Switches ¡EB voltage controls whether the transistor conducts in a common base configuraiton. ¡Logic circuits can be built.

NOR (NOT OR)

A B Q

0 0 1

0 1 0

1 0 0

1 1 0

BAQ

Page 22: Logic Gates. Transistors as Switches ¡EB voltage controls whether the transistor conducts in a common base configuraiton. ¡Logic circuits can be built.

Exclusive NOR

A B Q

0 0 1

0 1 0

1 0 0

1 1 1

Equality Detector

BAQ

Page 23: Logic Gates. Transistors as Switches ¡EB voltage controls whether the transistor conducts in a common base configuraiton. ¡Logic circuits can be built.

Summary

Summary for all 2-input gates

Inputs Output of each gate

 A   B  AND NAND  OR  NOR XOR XNOR

0 0 0 1 0 1 0 1

0 1 0 1 1 0 1 0

1 0 0 1 1 0 1 0

1 1 1 0 1 0 0 1