Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
Storage Elements
Today’s Lecture
• Homework #4 coming soon
• Building the building blocks…
Outline
• Review
• Digital building blocks
• An Arithmetic Logic Unit (ALU)
• Storage Elements
• Register File
Reading
Chapter 4.2
start reading 4.1 & 4.3
F(A, B, C) = (A * B) + (~A * C)
A B C F
0 0 0 0
0 0 1 1
0 1 0 0
0 1 1 1
1 0 0 0
1 0 1 0
1 1 0 1
1 1 1 1
a XOR(a,b) a NAND(a,b)
b b
a NOR(a,b) a XNOR(a,b)
b b
F
b
I1 I0 Q0 Q1 Q2 Q3
0 0 1 0 0 0
0 1 0 1 0 0
1 0 0 0 1 0
1 1 0 0 0 1
a y
MUX(A, B, S) = (A * S) + (B * ~S)
b
B
Gate 1
Y = (A * S) + (B * ~S)
Gate 3
A Gate 2
a 1
b 0 a 3
1 b 2
y y
0 c 1
c 1
d 0
d 0
2
s0 s1
S
S3 S2 S1 S0
Cout Full Adder Full Adder Full Adder Full Adder Cin “0”
a3 b3 a2 b2 a1 b1 a0 b0
3
a F Q
0 a+b
b 2 1 NOT b
2 a OR b
Q 3 a AND b
1
Adder 0
2
Cout
F
© Alvin R. Lebeck CPS 104 13
Subtraction
1
0 Adder 0
2
~Add/Sub
Cout
F
© Alvin R. Lebeck CPS 104 15
Overflow
Example1: Example2:
0100000 1000000
01101012 (= 5310) 10101012 (=-4310)
+01010102 (= 4210) +10010102 (=-5410)
10111112 (=-3310) 00111112 (= 3110)
Example3: Example4:
1100000 0000000
01101012 (= 5310) 00101012 (= 2110)
+11010102 (=-2210) +01010102 (= 4210)
00111112 (= 3110) 01111112 (= 6310)
© Alvin R. Lebeck CPS 104 16
Overflow Detection for 4-bit adder
OVERFLOW
S3 S2 S1 S0
Cout Full Adder Full Adder Full Adder Full Adder Cin “0”
a3 b3 a2 b2 a1 b1 a0 b0
The ALU
Overflow = Zero
Qn-1 Qn-2 Q1 Q0
ALU control
ALU Slice ALU Slice ALU Slice ALU Slice
• General structure
• Two operand inputs
ALU Operation
• Control inputs
Input A
Zero
ALU Result
Overflow
• We can build Input B
circuits for
Multiplication Carry Out
Division
They are more
complex
© Alvin R. Lebeck CPS 104 19
Set-Reset Latch
R 0 R 0
0 1
1 Q 0 Q
0 1
1 0
S 0 Q S 0 Q
R S Q
0 0 Q
0 1 1
1 0 0
1 1 - Don’t set both S & R to 1
R 0 R 0
0 1
1 Q 0 Q
0 1
1 0
S 0 Q S 1 Q
Time
1
S 0
1
R
0
1
Q
0
Enable
Q D E Q
0 1 0
1 1 1
- 0 Q
Q
Data
Time
Does not
1 affect Output
D 0
1
E
0
1
Q
0
D D Q D Q Q
D D
latch latch
E E Q Q
Register File
Tri-State Driver
The Tri-State driver is like a (one directional) switch:
When the Enable is on (E=1) it transfers the input to the output.
When the Enable is off (E=0) it disconnects the output.
E D E Q
0 1 0
Q 1 1 1
D
- 0 Z
Z :- High Impedance
E
D Q
Q Q Q Q
D D D D
D D D D
latch latch latch latch
IE E OE IE E OE IE E OE IE E OE
Q Q Q Q
One can “source” and “sink” from any cell on the bus
by activating the right controls,
IE--input enable, and OE--output enable.
Complement Q
Bus-A
DinEnable OutA OutB
EC EA EB
Bus-C
Bus-B
Bit-1
Q
Bus-A
Bus-C
Bus-B
Q
Bit-0
Bus-A
Bus-A
DEnable OutA OutB
A0
A1
EA
B0
B1
EB
C0
C1
EC
A-En
Add-A1
Add-A0
B-En
Add-B1
Add-B0
C-En
Add-C1
Add-C0
© Alvin R. Lebeck 37
Summary