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

CSCI 240

Digital Logic

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

Binary operations have two inputs, NOT has one unary OR AND + * ’

Dale Roberts

AND
Logic Gate: A B A*B

Truth Table: A 0 B 0 1 0 1 A*B 0 0 0 1

A Series Circuit:

B

0 1 1

A*B

Dale Roberts

OR
Logic Gate: A B A

A+B

Truth Table: A 0 0 1 B 0 1 0 1 A+B 0 1 1 1

Parallel Circuit:

B A+B

1

Dale Roberts

NOT
Logic Gate: A A’ or A

(also called an inverter)

Truth Table: a 0 1 A 1 0

Single-throw Double-pole Switch:

A A’ or A

Dale Roberts

n-input Gates
Because + and * are binary operations, they can be cascaded together to OR or AND multiple inputs.
A B A A+B+C B A B C

C

ABC

A B C

A+B+C

ABC

Dale Roberts

n-bit Inputs
For convenience, it is sometimes useful to think of the logic gates processing n-bits at a time. This really refers to n instances of the logic gate, not a single logic date with n-inputs.
1101100101 0100110111 10001111 00111100 110001 1101110111 00001100 001110 Dale Roberts

Logic Circuits ≡ Boolean Expressions
All logic circuits are equivalent to Boolean expressions and any boolean

expression can be rendered as a logic circuit.

AND-OR logic circuits are equivalent to sum-of-products form. Consider the following circuits:

A B C

abc aBc y A B C

y=aB+Bc

Y

Ab y=abc+aBc+Ab Dale Roberts

NAND and NOR Gates
NAND and NOR gates can greatly simplify circuit diagrams. As we will see, can you use these gates wherever you could use AND, OR, and NOT.
A 0 B 0 1 0 1 B 0 1 0 1 A↑B 1 1 1 0 A↓ B 1 0 0 0

NAND

0 1 1 A

NOR

0 0 1 1

Dale Roberts

XOR and XNOR Gates
XOR is used to choose between two mutually exclusive inputs. Unlike OR, XOR is true only when one input or the other is true, not both.
A 0 0 1 1 A B 0 1 0 1 B 0 1 0 1 A⊕B 0 1 1 0 A B 1 0 0 1

XOR

XNOR

0 0 1 1

Dale Roberts

Properties of NAND AND NOR
NAND and NOR have special properties, but neither satisfies the distributive or associative laws. NAND NOR
x↑1=X x ↑ 0=1 x ↑ x=X x ↑ y=X+Y X ↑ Y=x+y not (x ↑ y)=xy x↓ 0=X x ↓ 1=0 x ↓ x=X x ↓ y=XY X ↓ Y=xy not (x ↓ y)=x+y

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

NAND and NOR as Universal Logic Gates
Any logic circuit can be built using only NAND gates, or only NOR gates. They are the only logic gate needed. Here are the NAND equivalents:

Dale Roberts

NAND and NOR as Universal Logic Gates (cont) Here are the NOR equivalents: NAND and NOR can be used to reduce the number of required gates in a circuit.

Dale Roberts

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

(What kind of gate has this truth table? Dale Roberts

Example (cont)
One possible equation is the complete sum-of-products form: f(x,y) = xY + Xy x y f(x,y) Use The Most Complex Machine 0 0 0 xLogicCircuit Module to implement the 0 1 1 equation.
1 1 0 1 1 0

Dale Roberts

Acknowledgements
Eck, David. The Most Complex Machine Gersting, Judith, Mathematical Structures for Computer Science

Dale Roberts

Dale Roberts