240 likes | 337 Views
CORDIC. COordinate Rotations DIgital Computer Real Rotation x (i+1) = R (i) cos( + (i) ) = x (i) cos (i) – y (i) sin (i) y (i+1) = R (i) sin( + (i) ) = y (i) cos (i) + x (i) sin (i). Real rotation. Real Rotation x (i+1) = x (i) cos (i) – y (i) sin (i)
E N D
CORDIC • COordinate Rotations DIgital Computer • Real Rotation • x(i+1)= R(i)cos(+(i)) = x(i)cos(i) – y(i) sin (i) • y(i+1)= R(i)sin(+(i)) = y(i)cos(i) + x(i) sin(i)
Real rotation • Real Rotation • x(i+1)= x(i)cos(i) – y(i) sin(i) • y(i+1)= y(i)cos(i) + x(i) sin(i) • z(i+1)= z(i) – (i) • z(0)=wanted rotation • z(i+1)0 • R(i+1)= R(i) in real rotation • Let x(0)= x, y(0)= y, z(0)= z
Real rotation(2) • After m iterations: • x(m)=xcos((i)) – ysin ((i)) • y(m)= ycos((i)) + xsin((i)) • z(m)= z– ((i))
Pseudo-rotation • Pseudo-Rotation • R(i+1)= R(i) (1+tan2(i))1/2 • x(i+1)= R(i+1) cos(+(i)) = x(i)– y(i) tan(i) • y(i+1)= R(i+1)sin(+(i)) = y(i) + x(i) tan(i) • z(i+1)= z(i) – (i) • Let x(0)= x, y(0)= y, z(0)= z
Pseudo-rotation(2) • After m iterations: • x(m)=(xcos((i))–ysin ((i))) (1+tan2(i))1/2 =K(xcos((i))–ysin ((i))) • y(m)=(ycos((i))+xsin((i))) (1+tan2(i))1/2 ) =K(ycos((i))+xsin((i))) • z(i+1)= z(i) – ((i))
Rotation mode Operation • CORDIC • Select (i)= di2–i • x(i+1)= x(i)–di y(i)2–i • y(i+1)= y(i)+ di x(i)2–i • z(i+1)= z(i) –di tan–12–i • Store tan–12–i at a table (right)
Rotation mode (2) • Example z(m)0 • z(0)= 30.0 • After 7 iterations: • Rotation: • x(m)=K(xcos z –ysin z) • y(m)=K(ycos z +xsin z) • z(0)=0 • Rule: di=1 s.t. z(m)0
Rotation mode (3) • K=1.646760258121... • z(k)0 (k-bit k iteration) • Compute cos z • Let x=1/K & y=0 • obtain x(m)=cos z • Computer sin z • Let y=1/K & x=0 • obtain y(m)=cos z • Rotation: • x(m)=K(xcos z –ysin z) • y(m)=K(ycos z +xsin z) • z(0)=0 • Rule: di=1 s.t. z(m)0
Rotation mode(4) • Convergence • if i large, then tan–12–i=2–i • z (m)0 possible for z(i) z(i+1) • 99.7° z – 99.7converge
Vectoring mode • y(m) 0 by selecting di= –sign (x(i)y(i)) • After m iterations: • tan((i))= – x/y • x(m)= K[xcos ( (i) ) –ysin ((i))] =K(x–ytan((i)))/ (1+tan2 ((i)))1/2 =K(x2+y2)1/2 • y(m) =0; z(m) =z+tan–1(y/x) • Rule: di=1 s.t. y(m)0
Vectoring mode(2) • Obtain tan–1y by selecting x=1 & z=0 • x(m)= K(1+y2)1/2 • y(m) =0 • z(m) = tan–1y • Obtain tan–1(1/y)= /2 – tan–1y
Generalized CORDIC • General CORDIC iteration • x(i+1)= x(i)–di y(i)2–i • y(i+1)= y(i)+ di x(i)2–i • z(i+1) = z(i) –di e(i) • =1: e(i) =tan–12–i Circular (basic) rotation • =0: e(i) =2–i Linear rotation • = –1: e(i) =tanh–12–i Hyperbolic rotation
Circular (basic) rotation (=1) • Pseudo-rotation by • *(1+tan2(i))1/2=1/(cos(i)) • angle = 2Area/r2 • x(m)=K(xcos z –ysin z) • y(m)=K(ycos z +xsin z) • z(m)=0 • Rule: di=1 s.t. z(m)0 • K=1.646760258121...
Circular vectoring mode (=1) • x(m)= K(x2+y2)1/2 • y(m)=0 • z(m)= z+tan–1(y/x) • Rule: select di=1 s.t. y(m)0
Linear Rotation mode (=0) • x(m)= x • y(m)=y+xz • z(m)= 0 • Rule: select di=1 s.t. z(m)0
Linear vectoring mode (=0) • x(m)= x • y(m)=0 • z(m)= z+y/x • Rule: select di=1 s.t. y(m)0
Linear mode (=0) • Perform MUL: rotation with y=0 • MUL&ADD: rotation • DIV: vectoring with z=0 • DIV& ADD: vectoring
Hyperbolic rotation (=–1) • R(i)=(x2–y2)1/2 • *(1 –tanh2(i))1/2 = 1/cosh(i) • angle = 2Area/r2 • x(m)=K’(xcosh z +ysinh z) • y(m)=K’(ycosh z +xsinh z) • z(m)=0 • Rule: di=1 s.t. z(m)0 • K’=0.828159360960...
Hyperbolic vectoring (=–1) • x(m)=K(x2–y2)1/2 • y(m)=0 • z(m)=z+tanh–1(y/x) • Rule: di=1 s.t. y(m)0
Hyperbolic mode(=–1) • Rotation: Hyperbolic sin, cosine • x=1/K’, y=0 • Vectoring: tanh–1 • x=1, z=0 • To ensure convergence • repeat steps 4, 13, 40,…, j, 3j+1, … • in practice stop less than 121 iterations
General CORDIC iteration • x(i+1)= x(i)–di y(i)2–i • y(i+1)= y(i)+ di x(i)2–i • z(i+1) = z(i) –di e(i) • =1: e(i) =tan–12–i Circular (basic) rotation • =0: e(i) =2–i Linear rotation • = –1: e(i) =tanh–12–i Hyperbolic rotation