28
Page 1 Logic Gates 1

LOGIC GATES

Embed Size (px)

Citation preview

Page 1: LOGIC GATES

Page 1

Logic Gates

1

Page 2: LOGIC GATES

Page 22

Logic• Formal logic is a branch of mathematics that deals with true and false valuesinstead of numbers.

• In 1840’s, George Boole developed many Logic ideas.

•A logic gate performs a logical operation on one or more logic inputs and produces a single logic output.

Page 3: LOGIC GATES

Page 3

The logic normally performed is Boolean logic and is most commonly found in digital circuits.

Logic gates are primarily implemented electronically using diodes or transistors, but can also be constructed using electromagnetic relays (relay logic), fluidic logic, pneumatic logic, optics, molecules, or even mechanical elements.

In electronic logic, a logic level is represented by a voltage or current, depending on the type of electronic logic in use.

Page 4: LOGIC GATES

Page 4

Logic Signals        

There are a number of different systems for representing binary information in physical systems.  Here are a few.

A voltage signal with zero (0) corresponding to 0 volts and one (1) corresponding to five or three volts.

A sinusoidal signal with zero corresponding to some frequency, and one corresponding to some other frequency.

A current signal with zero corresponding to 4 milliamps and one corresponding to 20 milliamps.

And one last way is to use switches, OPEN for "0" and CLOSED for "1".(And there are more ways!)

Page 5: LOGIC GATES

Page 5

Boolean algebra is the algebra of two values. These are usually taken to be 0 and 1, as we shall do here, although F and T, false and true, etc. are also in common use.

Whereas elementary algebra is based on numeric operations multiplication xy, addition x + y, and negation −x, Boolean algebra is customarily based on logical counterparts to those operations, namely :(1) conjunction x∧y (AND)

(2) disjunction x∨y (OR)

(3) complement or negation ¬x (NOT).

In electronics:AND is represented as a multiplicationOR is represented as an additionNOT is represented with an overbar

xy

xy

x+yxy

xx

Page 6: LOGIC GATES

Page 6

Basic logic gates

• Not

• And

• Or

• Nand

• Nor

• Xor6

xx

xy

xy xy

xyz

zx+yx

yxy

x+y+z

z

xy

xy

x+yxy

xÅyxy

Page 7: LOGIC GATES

Page 7

Truth Table

A truth table is a good way to show the function of a logic gate. It shows the output states for every possible combination of input states. The symbols 0 (false) and 1 (true) are usually used in truth tables.

Page 8: LOGIC GATES

Page 8

Aa A

0 1

1 0

Truth Table:

A

The output A is true when the input a is NOT true, the output is the inverse of the input: a = NOT A

A NOT gate can only have one input. A NOT gate is also called an inverter.

NOT

Page 9: LOGIC GATES

Page 9

AND

A

B

A*B

Logic Gate:

Series Circuit:

A B

AA BB A*BA*B

00 00 00

00 11 00

11 00 00

11 11 11

Truth Table:A*B

"If A AND B are both 1, then Q should be 1.“(All or nothing.)

Page 10: LOGIC GATES

Page 10

Three Input AND Gate

A B C ABC

0 0 0 0

0 0 1 0

0 1 0 0

0 1 1 0

1 0 0 0

1 0 1 0

1 1 0 0

1 1 1 1

Page 11: LOGIC GATES

Page 11

A

B

A+B

Logic Gate:

Parallel Circuit:

A

B

AA BB A+BA+B

00 00 00

00 11 11

11 00 11

11 11 11

Truth Table:A+B

OR"If A is 1 OR B is 1 (or both are 1), then Q is 1."

Page 12: LOGIC GATES

Page 12

• Because + and * are binary operations, they can be cascaded together to OR or AND multiple inputs.

AB

C

ABC

A+B+C

A+B+C

AB

ABC

ABC

ABC

Page 13: LOGIC GATES

Page 13

NAND and NOR Gates• NAND and NOR gates can greatly simplify circuit diagrams.

NAND inverts the output of AND.• NOR inverts the output of OR.

NAND

NOR

AA BB AABB

00 00 11

00 11 11

11 00 11

11 11 00

AA BB AABB

00 00 11

00 11 00

11 00 00

11 11 00

Page 14: LOGIC GATES

Page 14

XOR and XNOR Gates

XOR

XNOR

AA BB AAÅÅBB

00 00 00

00 11 11

11 00 11

11 11 00

A B A B

0 0 1

0 1 0

1 0 0

1 1 1

XOR (exclusive OR) :"If either A OR B is 1, but NOT both, Q is 1."

XNOR (exclusive NOR) : invert output of XOR

Page 15: LOGIC GATES

Page 15

• Find the output of the following circuit

• Answer: (x+y)y

15

xy

x+y

y

(x+y)y

____

Page 16: LOGIC GATES

Page 16

• Find the output of the following circuit

• Answer: xy

x

y

x

y

x y x y

_ __ _ ______

Page 17: LOGIC GATES

Page 17

Give the Boolean expression of the given circuit

17

xy

x+y

xy xy

(x+y)(xy)

Answer: (x+y)(xy)

Page 18: LOGIC GATES

Page 18

• Write the circuits for the following Boolean algebraic expressions

a) x+y

18

xy

____

x

x+y

Page 19: LOGIC GATES

Page 19

• Write the circuits for the following Boolean algebraic expressions

b) (x+y)x

19

xyxyxy

______________

xy

x+yx+y (x+y)x

Page 20: LOGIC GATES

Page 20

More about logic gates

• To implement a logic gate in hardware, you use a transistor

• Transistors are all enclosed in an “IC”, or integrated circuit

• The current Intel Pentium IV processors have 55 million transistors!

20

Page 21: LOGIC GATES

Page 21

Flip-flops

• Consider the following circuit:

• What does it do?

21

Page 22: LOGIC GATES

Page 22

• A flip-flop holds a single bit of memory• In reality, flip-flops are a bit more

complicated– Have 5 (or so) logic gates (transistors) per flip-

flop

• Consider a 1 Gb memory chip– 1 Gb = 8,589,934,592 bits of memory– That’s about 43 million transistors!

• In reality, those transistors are split into 9 ICs of about 5 million transistors each

22

If you arrange the gates correctly, they will remember an input value. MEMORYThis simple concept is the basis of RAM (random access memory) in computers, and also makes it possible to create a wide variety of other useful circuits. Memory relies on a concept called feedback. That is, the output of a gate is fed back into the input.

Page 23: LOGIC GATES

Page 23

Exercises:1.Give the Boolean expression of the given gate.

3.Draw a logic circuit for AB + AC.

2.Give the Boolean expression of the given gate.

Answer: (A + B)C

Answer: A + BC + D

Page 24: LOGIC GATES

Page 24

Exercises:4.Draw a logic circuit for (A + B)(C + D) C.

5. Give the truth table for a 3-input (A,B & C) OR gate.

6. What type of logic gate's behavior does this truth table represent?

7.Give the Boolean expression of the given gate.

Page 25: LOGIC GATES

Page 25

8.Give the output expressions of the given gates.

Exercises:

a.

b.

c.

d.

e.

f.

Page 26: LOGIC GATES

Page 26

Answers to Exercises:3. AB + AC.

4. (A + B)(C + D)C.

5. 3-input OR gate

ABC

6. 3-input OR gate

7.

Page 27: LOGIC GATES

Page 27

Answers to Exercises:

8. a.) (ABC)(DE).

b.) (ABC)+(DE).

c.) (R+S+T) (X+Y+Z).

d.) (R+S+T)+(X+Y+Z).

e.) (JK)(M + N).

f.) (AB) (M + N) (X + Y).

Page 28: LOGIC GATES

Page 28

---the end– 8-)