computer architecture lecture 2 combinational circuits ralph grishman september 2015 nyu
TRANSCRIPT
Computer ArchitectureLecture 2
Combinational Circuits
Ralph GrishmanSeptember 2015
NYU
Computer Architecture lecture 2 2
Time and Frequency
• time = 1 / frequency• frequency = 1 / time• units of time
• millisecond = 10-3 second• microsecond = 10-6 second• nanosecond = 10-9 second• picosecond = 10-12 second
• units of frequency• kiloHertz (kHz) = 103 cycles / second• megaHertz (MHz) = 106 cycles / second• gigaHertz (GHz) = 109 cycles / second
9/9/15
Computer Architecture lecture 2 3
Today’s Problem
• The CDC 6600 delivered in 1965 had a 100 ns cycle time. What was its clock frequency?
(a) 10 kHz(b) 100 kHz(c) 10 MHz(d) 100 MHz
9/9/15
Computer Architecture lecture 2 4
Solution
• Time = 100 ns = 100 * 10-9 sec = 102 * 10 -9 sec = 10-7 sec
• Frequency = 107 Hz = 10 * 106 Hz = 10 MHz
9/9/15
Computer Architecture lecture 2 5
Exclusive-or with Relays
?
9/9/15
Exclusive OR
output
inputA inputB
Computer Architecture lecture 2 7
Combinational Circuits
• also called “combinatorial circuits”• output only a function of current inputs
• no memory
• gates: simplest combinational circuits• AND, OR, NOT, …• can be easily built from switches
9/9/15
Computer Architecture lecture 2 8
Representations of Combinational Circuits
• Truth table
• Boolean formula• D = A ^ B (also, A B)• D = A v B (also, A + B)• D = A
• Logic diagram9/9/15
A B A ^ B A v B
0 0 0 0
0 1 0 1
1 0 0 1
1 1 1 1
Computer Architecture lecture 2 9
Logic Diagram
• AND gate
• OR gate
• NOT gate (inverter)
9/9/15
Computer Architecture lecture 2 10
Examples of Combinational Circuits
• NAND and NOR• exclusive-OR (half-adder)• multiplexer• decoder• full adder
9/9/15
Computer Architecture lecture 2 11
Multiplexer
• 2-way multiplexer
9/9/15
1
0A
S
B
F
Computer Architecture lecture 2 12
Multiplexer
• conceptually, selects one of the data inputs (A or B) and sends it to the output F:
informally,if S == 0then F = Aelse F = B
F = S A + S B9/9/15
1
0
A
S
B
F
Computer Architecture lecture 2 13
Multiplexer
• 4-way multiplexer uses a 2-bit select line to select one of 4 data inputs
9/9/15
11
00
S
Computer Architecture lecture 2 14
Canonical forms
• Sum of products representation:– each term is a product which includes, for each
input xi, either xi or xi
– for example, with inputs A, B, and C,
9/9/15
F = A B C + A B C + A B C + A B C
Computer Architecture lecture 2 15
• Systematically converting truth table to a sum-of-products formula:
• for each row of truth table, construct a term which is 1 for the inputs in that row and 0 for all other rows– for example, for the row A B C = 0 0 1, the term is A B C
• keep those terms for which the output should be 1• OR together these terms
9/9/15
Computer Architecture lecture 2 16
A B C F0 0 0 00 0 1 10 1 0 10 1 1 01 0 0 11 0 1 01 1 0 01 1 1 1
9/9/15
Computer Architecture lecture 2 17
A B C F0 0 0 00 0 1 10 1 0 10 1 1 01 0 0 11 0 1 01 1 0 01 1 1 1
9/9/15
A B C
A B C
A B C
A B C
A B C
A B C
A B C
A B C
Computer Architecture lecture 2 18
A B C F0 0 0 00 0 1 10 1 0 10 1 1 01 0 0 11 0 1 01 1 0 01 1 1 1
9/9/15
A B C
A B C
A B C
A B C
A B C
A B C
A B C
A B C
Computer Architecture lecture 2 19
A B C F0 0 0 00 0 1 10 1 0 10 1 1 01 0 0 11 0 1 01 1 0 01 1 1 1
9/9/15
A B C
A B C
A B C
A B C
A B C
A B C
A B C
A B C
F = A B C + A B C + A B C + A B C
Computer Architecture lecture 2 20
Universality
• So we can convert any truth table to a Boolean formula or a logic circuit consisting of AND, OR, and NOT gates
• A truth table can represent an arbitrary combinational function
• So an arbitrary function can be constructed from AND, OR, and NOT gates
9/9/15
Computer Architecture lecture 2 21
DeMorgan’s Theorem
X + Y = X Y
• allows construction of OR from AND and NOT, or AND from OR and NOT
• so one can build any circuit using just two types of gates
• can we manage with just one type of gate?• homework #1
9/9/15