16
Department of Computer and Information Science, School of Science, IUPUI CSCI 240 Digital Logic

Department of Computer and Information Science, School of Science, IUPUI CSCI 240 Digital Logic

Embed Size (px)

Citation preview

Page 1: Department of Computer and Information Science, School of Science, IUPUI CSCI 240 Digital Logic

Department of Computer and Information Science,School of Science, IUPUI

CSCI 240

Digital Logic

Page 2: Department of Computer and Information Science, School of Science, IUPUI CSCI 240 Digital Logic

Dale Roberts

Boolean Algebra to Logic GatesBoolean Algebra to Logic Gates

Logic circuits are built from components called Logic circuits are built from components called logic gates.logic gates.The logic gates correspond to Boolean operations The logic gates correspond to Boolean operations +, *, +, *, ’.’.

Binary operations have two inputs, unary has oneBinary operations have two inputs, unary has one

OR+

AND*

NOT’’

Page 3: Department of Computer and Information Science, School of Science, IUPUI CSCI 240 Digital Logic

Dale Roberts

ANDAND

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

Page 4: Department of Computer and Information Science, School of Science, IUPUI CSCI 240 Digital Logic

Dale Roberts

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

OROR

Page 5: Department of Computer and Information Science, School of Science, IUPUI CSCI 240 Digital Logic

Dale Roberts

NOTNOT

A

A’ or A

Logic Gate:(also called an inverter)

Single-throwDouble-poleSwitch:

A

a A

0 1

1 0

Truth Table:A’ or A

Page 6: Department of Computer and Information Science, School of Science, IUPUI CSCI 240 Digital Logic

Dale Roberts

nn-input Gates-input Gates

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

AB

C

ABC

A+B+C

A+B+C

AB

ABC

ABC

ABC

Page 7: Department of Computer and Information Science, School of Science, IUPUI CSCI 240 Digital Logic

Dale Roberts

nn-bit Inputs-bit Inputs

For convenience, it is sometimes useful to think For convenience, it is sometimes useful to think of the logic gates processing of the logic gates processing nn-bits at a time. -bits at a time.

This really refers to This really refers to nn instances of the logic instances of the logic

gate, not a single logic date with gate, not a single logic date with nn-inputs.-inputs.

1101100101

01001101111101110111

10001111

0011110000001100

110001 001110

Page 8: Department of Computer and Information Science, School of Science, IUPUI CSCI 240 Digital Logic

Dale Roberts

Logic Circuits Logic Circuits ≡≡ Boolean Expressions Boolean Expressions

All logic circuits are equivalent to Boolean expressions and All logic circuits are equivalent to Boolean expressions and any boolean any boolean expression can be rendered as a logic circuit.expression can be rendered as a logic circuit.AND-OR logic circuits are equivalent to sum-of-products form.AND-OR logic circuits are equivalent to sum-of-products form.Consider the following circuits:Consider the following circuits:

A

CB abc

aBc

Ab

y=abc+aBc+Ab

y

A

B

C

Y

y=aB+Bc

Page 9: Department of Computer and Information Science, School of Science, IUPUI CSCI 240 Digital Logic

Dale Roberts

NAND and NOR GatesNAND and NOR Gates

NAND and NOR gates can greatly simplify circuit NAND and NOR gates can greatly simplify circuit diagrams. As we will see, can you use these gates diagrams. As we will see, can you use these gates wherever you could use AND, OR, and NOT.wherever you could use AND, OR, and NOT.

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 10: Department of Computer and Information Science, School of Science, IUPUI CSCI 240 Digital Logic

Dale Roberts

XOR and XNOR GatesXOR and XNOR Gates

XOR is used to choose between two mutually XOR is used to choose between two mutually exclusive inputs. Unlike OR, XOR is true only exclusive inputs. Unlike OR, XOR is true only when one input or the other is true, not both.when one input or the other is true, not both.

XOR

XNOR

AA BB AABB

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

Page 11: Department of Computer and Information Science, School of Science, IUPUI CSCI 240 Digital Logic

Dale Roberts

Properties of NAND AND NORProperties of NAND AND NOR

NAND and NOR have special properties, but NAND and NOR have special properties, but neither satisfies the distributive or associative neither satisfies the distributive or associative laws.laws.

NANDNAND NORNOR

xx1=X1=X xx0=X0=X

x x 0=1 0=1 x x 1=0 1=0

x x x=X x=X x x x=X x=X

x x y=X+Y y=X+Y x x y=XY y=XY

X X Y=x+y Y=x+y X X Y=xy Y=xy

not (x not (x y)=xy y)=xy not (x not (x y)=x+y y)=x+y

It should be clear by looking at these properties that It should be clear by looking at these properties that NAND and NOR are duals.NAND and NOR are duals.

Page 12: Department of Computer and Information Science, School of Science, IUPUI CSCI 240 Digital Logic

Dale Roberts

NAND and NOR as Universal Logic GatesNAND and NOR as Universal Logic Gates

Any logic circuit Any logic circuit can be built using can be built using only NAND gates, only NAND gates, or only NOR or only NOR gates. They are gates. They are the only logic the only logic gate needed.gate needed.

Here are the Here are the NAND NAND equivalents:equivalents:

Page 13: Department of Computer and Information Science, School of Science, IUPUI CSCI 240 Digital Logic

Dale Roberts

NAND and NOR as Universal Logic Gates (cont)NAND and NOR as Universal Logic Gates (cont)

Here are the NOR Here are the NOR equivalents:equivalents:

NAND and NOR NAND and NOR can be used to can be used to reduce the reduce the number of number of required gates in required gates in a circuit.a circuit.

Page 14: Department of Computer and Information Science, School of Science, IUPUI CSCI 240 Digital Logic

Dale Roberts

Example ProblemExample Problem

A hall light is controlled by two light switches, A hall light is controlled by two light switches, one at each end. Find (a) a truth function, (b) a one at each end. Find (a) a truth function, (b) a Boolean expression, and (c) a logic network that Boolean expression, and (c) a logic network that allows the light to be switched on or off by allows the light to be switched on or off by either switch.either switch.

xx yy f(f(xx,,yy))

00 00 00

00 11 11

11 00 11

11 11 00

(What kind of gate has this truth table?

Let Let xx and and yy be the switches: be the switches:

Page 15: Department of Computer and Information Science, School of Science, IUPUI CSCI 240 Digital Logic

Dale Roberts

Example (cont)Example (cont)

One possible equation is the complete sum-of-products form:One possible equation is the complete sum-of-products form:

f(x,y) = xY + Xyf(x,y) = xY + Xy

Use The Most Complex Machine Use The Most Complex Machine

xLogicCircuit Module to implement thexLogicCircuit Module to implement the

equation.equation.

xx yy f(f(xx,,yy))

00 00 00

00 11 11

11 00 11

11 11 00

Page 16: Department of Computer and Information Science, School of Science, IUPUI CSCI 240 Digital Logic

Dale Roberts

AcknowledgementsAcknowledgements

Eck, David. Eck, David. The Most Complex MachineThe Most Complex Machine

Gersting, Judith, Gersting, Judith, Mathematical Structures for Mathematical Structures for Computer ScienceComputer Science