Digital Logic: Tutorial CPSC 401
Digital Logic: Tutorial CPSC 401
OR AND NOT
+ * ’
A*B
OR
A
Logic Gate: A+B Truth Table:
B
A B A+B
A
0 0 0
0 1 1
Parallel Circuit: 1 0 1
B 1 1 1
A+B
NOT
Logic Gate: A A’ or A
(also called an inverter)
Truth Table:
a A
0 1
1 0
n-input Gates
• Because + and * are binary operations, they can be
cascaded together to OR or AND multiple inputs.
A A
B A+B+C B ABC
C
A A
B A+B+C B ABC
C C
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 ?
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 abc
C
aBc
y
Ab
y=abc+aBc+Ab
Find Output ?
B Y
C
Find output ?
x
y
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 B AB
0 0 1
NAND 0 1 1
1 0 1
1 1 0
A B AB
NOR 0 0 1
0 1 0
1 0 0
1 1 0
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 B AB
0 0 0
XOR 0 1 1
1 0 1
1 1 0
A B A B
XNOR 0 0 1
0 1 0
1 0 0
1 1 1
Properties of NAND AND NOR
• NAND and NOR have special properties, but
neither satisfies the distributive or associative
laws.
NAND NOR
x1=X x0=X
x 0=1 x 1=0
x x=X x x=X
x y=X+Y x y=XY
X Y=x+y X Y=xy
not (x y)=xy not (x y)=x+y