Professional Documents
Culture Documents
Arithmetic / Logic Unit - ALU Design
Arithmetic / Logic Unit - ALU Design
Presentation F
32-bit ALU
ALU Control
A 32
32 Result
32-bit
ALU Zero
Overflow
Carry out
B 32
1
Functioning of 32-bit ALU
ALU Control
ALU Control lines 4
Function Ainvert Binvert Operation
32
and 0 0 00 A
32 Result
or 0 0 01 32-bit
add 0 0 10 ALU Zero
Overflow
subtract 0 1 10 Carry out
B 32
slt 0 1 11
nor 1 1 00
a0
0 Result0
b0
1
a1 Result1
0
b1
1
a2
0 Result2
b2
1
a31
0 Result31
b31
1
g. babic 4
2
Designing 32-bit ALU: Principles
• A number of functions Operation = 0 and
are performed inter- = 1 or
nally, but only one
a0
result is chosen for and
0 Result0
b0
the output of ALU or 1
a1 and Result1
0
b1
• 32-bit ALU is built or 1
out of 32 identical
a2
1-bit ALU’s and
Result2
0
b2
or 1
a31 and
0 Result31
b31
or 1
g. babic 5
Input Output
a b Carry Sum Carry
Figure B.5.2 In Out
0 0 0 0 0
0 0 1 1 0
0 1 0 1 0
3
32-bit Adder
“0”
a0 Cin
sum0
b0
+
Cout
a31 Cin
sum31
b31
+
Cout
Carry out
g. babic Presentation F 7
1-bit ALU
Operation = 00 and
= 01 or
= 10 add
Figure B.5.6
Figure B.5.7
CarryOut
+ carry out
g. babic Presentation F 8
4
32-bit Subtractor
“0”
“1”
a0 Cin A – B = A + (–B)
Result0
b0
+
Cout =A+B+1
a1 Cin
Result1
b1
+
Cout
a2 Cin
Result2
b2
+
Cout
a31 Cin
Result31
b31
+
Cout
CarryOut
g. babic Presentation F 9
a0 Cin
Result0
b0
0 +
Cout
1
a1 Cin
Result1
b1 0
+
Cout
a31 Cin
Result31
b31 0
+
Cout
1 0 CarryOut
g. babic 1 10
5
32-bit ALU With 4 Functions
1-bit ALU B in v e r t O p e r a tio n
B in ve rt O pe ra tion
C a r r y In
a0 C a rryI n
b0 ALU0 R e s u l t0
a
0
C a rryO u t
1
R e s u lt
a1 C a rryI n
b 0 2 b1 ALU1 R e s u l t1
1
C a rryO u t
Figure B.5.8
C a r ry O u t
a2 C a rryI n
b2 ALU2 R e s u l t2
happens:
– if a sum of two positive a
0
numbers results in
a negative number 1
numbers results in b 0
+ 2
a positive number 1
L e ss 3
Carry Out
O v e r f lo w
O v e rflo w
d e te c tio n
Other 1-bit ALUs, i.e. non-most significant bit ALUs, are not affected.
g. babic Presentation F 12
6
32-bit ALU With 4 Functions and Overflow
B in v e r t O p e r a tio n
a0 C a rryI n
b0 ALU0 R e s u l t0
C a rryO u t
Control lines
a1 C a rryI n
Function Binvert Operation b1 ALU1 R e s u l t1
(1 line) (2 lines) C a rryO u t
and 0 00
or 0 01 a2 C a rryI n
b2 ALU2 R e s u l t2
add 0 10
C a rryO u t
subtract 1 10
C a rr y In
a3 1 C a rryI n R e s u l t3 1
b3 1 A L U 31
O v e r flo w
Missing: slt & nor functions and Zero output
Carry Out
g. babic Presentation F