CSE 575 Computer Arithmetic Spring 2003: Mary Jane Irwin (WWW - Cse.psu - Edu/ Mji)
CSE 575 Computer Arithmetic Spring 2003: Mary Jane Irwin (WWW - Cse.psu - Edu/ Mji)
Computer Arithmetic
Spring 2003
Mary Jane Irwin
(www.cse.psu.edu/~mji)
Zi+1 zero
3 0.125000 7.125016 -1 -2.47 + 7.13 = 4.66
4 0.062500 3.576334 1 4.66 – 3.58 = 1.08
5 0.031250 1.789910 1 1.08 -1.79 = -0.71
6 0.015625 0.895174 -1 -0.71 + 0.90 = 0.19
7 0.007813 0.447614 1 0.19 - 0.45 = -0.26
8 0.003906 0.223811 -1 -0.26 + 0.22 = -0.04
9 0.001953 0.111906 -1 -0.04 + 0.11 = 0.07
Computer Arithmetic CSE575 CORDIC.6 © MJIrwin, PSU, 2003
Rotating the Angles
Illustration of the first three rotations for a
Z of 30
(X0, Y0)
(X2, Y2)
-45
-14
30
O
+26.6 (X3, Y3)
(X1, Y1)
X
shift
Xi+1 = Xi – di Yi 2-i
i counter
shift
Yi+1 = Yi – di Xi 2-i
Y
Z
lookup Zi+1 = Zi – di Ei
values of
Ei= tan-12-i table
di control
Computer Arithmetic CSE575 CORDIC.14 © MJIrwin, PSU, 2003
Generalized Cordic
Generalized Cordic defined as
Xi+1 = Xi - di Yi 2-i
Yi+1 = Yi + di Xi 2-i
Zi+1 = Zi - di Ei
vector OV
X
X Xi+1 = Xi – di Yi 2-i
shift
i counter
shift
Yi+1 = Yi + di Xi 2 -i
Y
Y
Zi+1 = Zi - di Ei
Z
Z
Ei lookup table
(tan-12-i, 2-i, tanh-12-i)
di control
CORDIC
Ciclr X K(X cosZ – Y sinZ) X K (X2 + Y2)
=1 Y K(Y cosZ + X sinZ) Y 0
Z 0 Z Z + tan -1(Y/X)
Ei = For cos & sin, set X=1/K, Y=0 For tan-1, set X=1, Z=0
tan-12-i tanZ=sinZ/cosZ cos-1W=tan-1[(1-W2)/W];sin-1W=tan-1[W/(1-W2)]
Linear X X X X
CORDIC
CORDIC
=0 Y Y + X*Z Y 0
Z 0 Z Z + Y/X
Ei = 2-i For multiply, set Y=0 For divide, set Z=0
Hprblc X K’(X coshZ – Y sinhZ) X K’ (X2 - Y2)
CORDIC
CORDIC
= -1 Y K’(Y coshZ + X sinhZ) Y 0
Z 0 Z Z + tanh -1(Y/X)
Ei = For cosh & sinh, set X=1/K’, Y=0 For tanh-1, set X=1, Z=0
tanh-1 cosh-1W=ln[W+(1-W2)];sinh-1W=ln[W+(1+W2)]
2-i tanhZ=sinhZ/coshZ; Wt=Et lnW
Ez=sinhZ+coshZ lnW=2tanh-1|(W-1)/(W+1)|;W=((W+¼)2-(W-¼)2)
In executing the iterations for = -1, steps 4, 13, 40, 121, …, j, 3j+1, … must be repeated.