Documente Academic
Documente Profesional
Documente Cultură
INSTITUT FR INFORMATIK
COMPUTER ARCHITECTURE
Lecture 10
ALU
Sommersemester 2002 Leitung: Prof. Dr. Miroslaw Malek
www.informatik.hu-berlin.de/rok/ca
CA - X - AU - 1
Logic Functions
CA - X - AU - 2
A
b n 1
....... .......
a0 z n 1 b0
+
carry
......
z0
PARALLEL
Operands are presented to the unit in parallel. To carry out the operation circuits may be:
Sequenced (ripple carry technique) Occur concurrently, e.g., carry-lookahead technique
a n 1
.......
Z
a0
b n 1
B
32 32
.......
b0
ALU
z n 1
CA - X - AU - 3
......
32
z0
3. Floating-Point Arithmetic
a. multiplication b. division c. addition and subtraction
CA - X - AU - 4
MULTIPLY DIVIDE
Square root
Software Software
CA - X - AU - 5
Example: in BCD-Code:
4739+1281=6020 0111 0010 1001 0011 1000 1011 1001 0001 1010)
N=(2 -1) - N
negation
-N
FOR FRACTION
n=0 N* =21 - N
CA - X - AU - 9
N* = 2 - N
2 = (.375) = -.375 = 10.000 - .011 1.101 .625 = 0.101 + (-.125) = 1.111 .500 =*0.100 .375 = 0.011 = 0.011 + (-.250) =-0.010 =1.110 .125 = 0.001 = 0.001
CA - X - AU - 10
ARITHMETIC OPERATIONS
1. Addition of positive numbers 2. Addition/subtraction of positive and negative numbers 3. Multiplication a. positive numbers b. signed numbers 4. Division (Integer) 5. Floating point
CA - X - AU - 11
EXECUTION TIME
Execution time = Logic Gate Delay - Assume any stage of an n-bit serial adder requires 5 ns - A 32-bit add takes 32 x 2 ns = 64 ns
- Memory access may be 5 ns (basic cycle) - We want to improve the add speed to fall below the basic cycle speed: - Faster logic - Accelerating the carry The carry causes delay, so the basic problem is to calculate the carry more rapidly by looking ahead for it. (e.g., Carry Lookahead logic facilitates increased speed of operation)
CA - X - AU - 12
x0
S=X+Y S = X + Y +1 y1 yn-1 y0
ADD/SUB control
ADD = 0 SUB = 1
xn-1 cn sn-1
x1
n-bit adder s1 s0
CA - X - AU - 13
si
i+1
ADDER (A)
i si
CA - X - AU - 14
si =
Factoring the second of these (carry-out equation) into ci +1 = xi yi + ( xi + yi )ci (2) and defining a generate function (3)
Gi = xi yi
Pi = xi + yi
ci +1 = Gi + Pi (Gi 1 + Pi 1ci 1 )
CA - X - AU - 15
(7) (8)
Pure Carry Lookahead circuit for computing the carry out cn of an n-bit adder
Gi-1 Pi-1 Gi-2 Pi-2 Gi-3 P1 G0 P0 c 0
ci
CA - X - AU - 16
BLOCK LOOKAHEAD
~ ~ GK , PK ~ Po = P3 P2 P P 1 0 ~ G0 = G3 + P3 G2 + P3 P2 G1 + P3 P2 P G0 1
x3 y3 P1 G1 c4 s3
x2 y2
x1 y1
x0 y0
Control inputs
c0 s2 s1 s0
b) The Sum
si = x i y ic i + x iy i c i + xi y i c i + x i y ic i
Ad a) A carry can be generated in three logic gate delays. 1 Compute Pi, Gi 1 AND P's, G's 1 OR resulting AND P's, G's 3 Ad b) The completion of the sum can be generated in three additional logic gate delays. 1 Form ci 1 AND x i , y i , c i , x i , y i , c i 1 OR AND Products 3
CA - X - AU - 18
LIMITATION
a) Carry Lookahead with 4 blocks (32 bit, k=8)
Gate fan-in is limited to 8 (usual circuit constraint) Generate Gi Generate Pi 1
2 2 2 2 3 delays
12 delays at 5 ns per 1 gate 60 ns for an add. b) Carry Lookahead fully integrated (32 bits, k=32)
without circuit constraints
2 2 3 delays
Generate Pk
s7
s6
s5
s4
- two additions are performed in parallel, one assuming carry 0 the other assuming carry 1 - when the carry is finally known, correct sum is selected
CA - X - AU - 20
Parallel addition
CA - X - AU - 21