Upload
jhgjhjbnmj
View
215
Download
0
Embed Size (px)
Citation preview
7/31/2019 16f03-cordic
1/22
CORDIC AlgorithmCOordinate Rotation DIgital Computer
Method for Elementary Function Evaluation (e.g.,sin( z ), cos( z ), tan -1(y ))
Originally Used for Real-time Navigation (Volder 1956)
Idea is to Rotate a Vector in Cartesion Plane bySome Angle
Complexity Comparable to Division
7/31/2019 16f03-cordic
2/22
CORDIC AlgorithmKey Ideas
If we have a computationally efficient way of rotating a vector, we can
evaluate cos, sin, and tan
1 functionsRotation by an arbitrary angle is difficult, so we perform psuedorotations
Use special angles to synthesize a desired angle z
z = (1) + (2) + . . . + (m )
7/31/2019 16f03-cordic
3/22
CORDIC AlgorithmKey Ideas
Rotate the vector OE(i )
with end point at ( x (i )
, y (i )
) by(i )
x (i +1) = x (i )cos (i ) y (i ) sin (i ) = (x (i ) y (i ) tan (i ))/(1 + tan 2 (i ))1/2
y (i +1) = y (i ) cos (i ) + x (i ) sin (i ) = (y (i ) + x (i ) tan (i ))/(1 + tan 2 (i ) ) 1/2
z (i +1) = z (i ) (i )
Goal: eliminate the divisions by (1 + tan2 (i )) 1/2 and choose (i ) so thattan (i ) is a power of 2
7/31/2019 16f03-cordic
4/22
Elimination of Division by (1 + tan2 (i ))1/2
Whereas a real rotation does not change the length R (i ) of the vector, a pseudorotation step increases its length to:
R (i +1) = R (i ) (1 + tan 2 (i ))1/2
The coordinates of the new end point E (I+ 1) after
pseudorotation is derived by multiplying the coordinates of
E (i +1) by the expansion factor
x (i +1) = x (i ) y (i ) tan (i )
y (i +1) = y (i ) + x (i ) tan (i ) [Pseudorotation]
z (i +1) = z (i ) (i )
7/31/2019 16f03-cordic
5/22
Elimination of Division by (1 + tan2 (i ))1/2
Assuming x (0)
= x , y (0)
= y , and z (0)
= z , after m realrotations by the angles (1) , (2) , . . . , (m ), we have:
x (m ) = x cos( (i )) y sin( (i ))
y (m )
= y cos((i )
) + x sin((i )
)z (m ) = z ( (i ))
After m pseudorotations by the angles (1) , (2) , . . . , (m ):
x (m ) = K (x cos( (i )) y sin( (i )))y (m ) = K (y cos( (i )) + x sin( (i ))) [*]
z (m ) = z ( (i ))
where K = (1 + tan 2 (i ))1/2
7/31/2019 16f03-cordic
6/22
Basic CORDIC Iterations
Pick(i )
such that tan(i )
= d i 2 i
, d i {
1, 1}x (i +1) = x (i ) d i y (i )2
i
y (i +1) = y (i ) + d i x (i )2 i [CORDIC iteration]
z (i +1) = z (i ) d i tan 1 2 i
If we always pseudorotate by the same set of angles (with
+ or signs), then the expansion factor K is a constant
that can be precomputed
Example : pseudorotation for 30 degrees30.0 45.0 26.6 + 14.0 7.1 + 3.6 + 1.8 0.9
+ 0.4 0.2 + 0.1 = 30.1
e (i ) = tan 1 2 -i
7/31/2019 16f03-cordic
7/22
Basic CORDIC Iteration
7/31/2019 16f03-cordic
8/22
CORDIC Rotation Mode
7/31/2019 16f03-cordic
9/22
CORDIC Rotation Mode
7/31/2019 16f03-cordic
10/22
CORDIC Vectoring Mode
7/31/2019 16f03-cordic
11/22
CORDIC Vectoring Mode
7/31/2019 16f03-cordic
12/22
CORDIC Hardware
7/31/2019 16f03-cordic
13/22
Generalized CORDIC
7/31/2019 16f03-cordic
14/22
Rotation Modes
7/31/2019 16f03-cordic
15/22
Binary Angular Measurement - BAM Angle Accumulator can Represent Angles as BAM
Encode d i ={-1,+1} as Bit Values {0,1}
Example: -1 Represented by 0 and +1 Represented by 1
LSb Represents d 0
Content z =01011
z =+45 +26.6 -14.0 +7.1 -3.6 =61.1
Can Simplify CORDIC Circuitry for Some Modes May Need BAM encode/decode Can Use Lookup Table
7/31/2019 16f03-cordic
16/22
Review - CORDIC - Rotation Mode
Input is Angle, Initialized in Angle Accumulator Vector Initialized to Lie on x -axis Each Iteration d i Chosen by Sign of Angle Attempt to Bring Angle to Zero Result is x Register Contains ~cos Result is y Register Contains ~sin Also Polar to Rectangular if x Register Initialized to
Magnitude
7/31/2019 16f03-cordic
17/22
Review - CORDIC - Vector Mode
Input is (Pre-scaled) Vector in ( x ,y ) Registers Angle, Initialized to Zero
Each Iteration d i Chosen to Move Vector to Lie AlongPositive x -axis (Want to Reduce y Register to Zero)
Result is Original Vector Angle in Angle Accumulator Can be Used for sin -1 and cos -1 Also Rectangular to Polar Conversion Magnitude in x Register
7/31/2019 16f03-cordic
18/22
CORDIC Rotation/Vector Modes
Rotation Mode:
1
1
1
1
2
2
tan (2 )
ii i i i
ii i i i
i
i i i
x x y d
y y x d
z z d
0 0 0 0
0 0 0 0
2
0
cos sin
cos sin0
1 2
1, 0
1, otherwise
n n
n n
n
ni
ni
i
i
x A x z y z
y A y z x z z
A
zd
Vector Mode:
1
1
11
2
2
tan (2 )
ii i i i
ii i i i
ii i i
x x y d
y y x d
z z d
2 2
0 0
00
0
2
0
0
ta n 1
1 2
1, 0
1, o the rw i se
n n
n
n
ni
ni
ii
x A x y
y
y z z x
A
yd
7/31/2019 16f03-cordic
19/22
Rotation Angle Limits
Rotation/Vector Algorithms Limited to 90 Due to Use of = tan(2 0) for First Iteration Several Ways to Extend Range
Can use trig identities to covert the problem to one that is withinthe domain of convergence
One Way is to Use Additional Rotation for Angles Outside Range
This Rotation is Initial 90 Rotation
'
'' 2
1, 0
1, otherwisei
x d y
y d x z z d
yd
7/31/2019 16f03-cordic
20/22
CORDIC Uses
OPERATION MODE INITIALIZE DIRECTIONSine, Cosine Rotation x=1/ A n, y=0, z= Reduce z to ZeroPolar to Rect. Rotation x=(1/ A n) X mag , y=0, z= X phase Reduce z to ZeroGeneral Rotation Rotation x=(1/ A n) x0, y=(1/ A n) y0, z= Reduce z to ZeroArctangent Vector x=(1/ A n) x0, y=(1/ A n) y0, z=0 Reduce y to ZeroVector Magnitude Vector x=(1/ A n) x0, y=(1/ A n) y0, z=0 Reduce y to ZeroRect. to Polar Vector x=(1/ A n) x0, y=(1/ A n) y0, z=0 Reduce y to ZeroArcsine, Arccosine Vector x=(1/ A n), y=0,
arg =sin or cos Reduce y to Valuein arg Register
Can Use CORDIC For Others Also: Linear Functions Hyperbolic Functions Square Rooting Logarithms, Exponentials
7/31/2019 16f03-cordic
21/22
Iterative CORDIC Structure*
*Taken from A Survey of CORDIC Algorithms for FPGABased Computers, R. Andraka, FPGA98
7/31/2019 16f03-cordic
22/22
Bit-serial CORDIC Structure*
*Taken from A Survey of CORDIC Algorithms for FPGA
Based Computers, R. Andraka, FPGA98