department of preparatory year, umm al qura university csci 240 digital logic

14
Department of Preparatory Year, Umm Al Qura University CSCI 240 Digital Logic

Upload: hilary-robbins

Post on 19-Jan-2018

218 views

Category:

Documents


0 download

DESCRIPTION

AND A B A*B Logic Gate: Series Circuit: ABABA*B Truth Table: A*B

TRANSCRIPT

Page 1: Department of Preparatory Year, Umm Al Qura University CSCI 240 Digital Logic

Department of Preparatory Year,Umm Al Qura University

CSCI 240

Digital Logic

Page 2: Department of Preparatory Year, Umm Al Qura University CSCI 240 Digital Logic

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 Preparatory Year, Umm Al Qura University CSCI 240 Digital Logic

ANDAND

AB

A*B

Logic Gate:

Series Circuit:A B

AA BB A*BA*B00 00 0000 11 0011 00 0011 11 11

Truth Table:A*B

Page 4: Department of Preparatory Year, Umm Al Qura University CSCI 240 Digital Logic

AB

A+B

Logic Gate:

Parallel Circuit:

A

B

AA BB A+BA+B00 00 0000 11 1111 00 1111 11 11

Truth Table:A+B

OROR

Page 5: Department of Preparatory Year, Umm Al Qura University CSCI 240 Digital Logic

NOTNOT

A

A’ or A

Logic Gate:(also called an inverter)

Single-throwDouble-poleSwitch:

A

a A0 11 0

Truth Table:A’ or A

Page 6: Department of Preparatory Year, Umm Al Qura University CSCI 240 Digital Logic

nn-input Gates-input GatesBecause + 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

C

Page 7: Department of Preparatory Year, Umm Al Qura University CSCI 240 Digital Logic

nn-bit Inputs-bit InputsFor 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 gate with gate, not a single logic gate with nn-inputs.-inputs.

11011001010100110111

1101110111

1000111100111100

00001100

110001 001110

Page 8: Department of Preparatory Year, Umm Al Qura University CSCI 240 Digital Logic

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

Aby=abc+aBc+Ab

y

ABC

Y

y=aB+Bc

Deduce the truth table for each

Page 9: Department of Preparatory Year, Umm Al Qura University CSCI 240 Digital Logic

NAND and NOR GatesNAND and NOR GatesNAND 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 AABB00 00 1100 11 1111 00 1111 11 00

AA BB AABB00 00 1100 11 0011 00 0011 11 00

Page 10: Department of Preparatory Year, Umm Al Qura University CSCI 240 Digital Logic

XOR and XNOR GatesXOR and XNOR GatesXOR 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 AABB00 00 0000 11 1111 00 1111 11 00

A B A B0 0 10 1 01 0 01 1 1

Page 11: Department of Preparatory Year, Umm Al Qura University CSCI 240 Digital Logic

Properties of NAND AND NORProperties of NAND AND NORNAND 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=Xx x 0=1 0=1 x x 1=0 1=0x x x=X x=X x x x=X x=X

x x y=X+Y y=X+Y x x y=XY y=XYX 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 Preparatory Year, Umm Al Qura University CSCI 240 Digital Logic

NAND and NOR as Universal Logic GatesNAND and NOR as Universal Logic GatesAny 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 Preparatory Year, Umm Al Qura University CSCI 240 Digital Logic

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 Preparatory Year, Umm Al Qura University CSCI 240 Digital Logic

Example ProblemExample ProblemA 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 0000 11 1111 00 1111 11 00

(What kind of gate has this truth table?

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