Вы находитесь на странице: 1из 18

Lecture 22

The CORDIC Algorithms

CORDIC
Coordinate Rotation Digital Computer
Invented in late 1950s
Based on the observation that:
if you rotate a unit-length vector (1,0)
by an angle z
its new end-point will be at (cos z, sin z)

Can evaluate virtually all functions of interest


k iterations require for k-bits accuracy

1959

1971

1977

Rotations and Pseudo-Rotations

True Rotations

Pseudo-Rotations

After m Real Rotations


Rotate by angles
1 , 2 , L , m

After m Pseudo-Rotations
Rotate by angles
1 , 2 , L , m

Expansion Factor K

By product of pseudo-rotations
Depends on the rotation angles.
However, if we always uses the same
rotation angles (with positive and negative
signs), then
K is a constant
Can be precomputed and stored
Its reciprocal can also be computed and stored

Basic CORDIC Iterations


Pick fixed rotation angles ( i ) such that :
( i ) = tan 1 2 i
i (i ) tan ( i ) = 2 i
0 45.0 1.000
1

26.6 0.500

2 14.0 0.250
3
7.1 0.125

CORDIC Pseudo-Rotations

( i ) = tan 1 2 i
tan (i ) = 2 i

Approximate Angle Table

Table can
be done in
degrees or
radians.

CORDIC Iterations with Table

Basic CORDIC Iterations


Each CORDIC rotation requires:
2 shifts
1 table lookup
3 additions

By rotating by the same set of angles (with


+ or signs) , the expansion factor K can
be precomputed

Rotation Mode Rules


Initialize:
z=z
x=x
y=y

Iterate with di = sign(z(i))


Finally (after m steps):

Example

Example
(First 3 Rotations)

Trig Function Computation


Initialize:
z=z
x = 1/K = 0.607 252 935 .
y=0

Iterate with di = sign(z(i))


Finally (after m steps):

z0
x cos(z)
y sin (z)
y/x tan (z)

10

Precision in CORDIC
For k bits of precision in trig functions,
k iterations are needed.
For large i, tan(2i) 2i
For i > k , change in z < ulp
Convergence is guaranteed for angles in
range 99.7 z 99.7
(99.7 is sum of all angles in the table)

For angles outside this range, use standard trig


identities to convert angle to one in the range

Vectoring Mode Rules


Initialize: z = z, x = x, y = y
Iterate with di = sign( x(i) y(i) )

Forces y(m) to 0

Finally (after m steps):

11

Trig Function Computation


Initialize:
z=0
x=1
y=y

Iterate with di = sign(x(i) y(i)) = sign(y(i))


Finally (after m steps):
z tan1(y)
Use identity:
to limit range of fixed-point numbers

CORDIC Hardware

12

Bit-Serial CORDIC
For low cost, low speed application (hand
held calculators) bit-serial implementations
are possible.

Generalized CORDIC

13

Circular
Circular Rotation Mode

Circular Vectoring Mode

Linear
Linear Rotation Mode

Linear Vectoring Mode

14

Hyperbolic
Hyperbolic Rotation Mode

Hyperbolic Vectoring Mode

Vector Length and Rotation Angle


Circular

Linear

Hyperbolic

15

Convergence
Circular and Linear CORDIC converge for
suitably restricted values of x, y, and z.
Hyperbolic will not converge for all cases.
A simple solution to this problem is to
repeat steps:
i = 4, 13, 40, 121, . , j, 3j+1, .
With these precautions, hyperbolic will
converge for suitable restricted values of x,
y, and z

Using CORDIC
Directly computes :

Also directly computes :

sin

tan 1 ( y x)
y + xz

cos
tan 1
sinh
cosh
tanh 1

x2 + y2
x2 y2
e z = sinh z + cosh z

16

Using CORDIC
Indirectly Computes :
sin z
tan z =
cos z
sinh z
tanh z =
cosh z
w 1
w +1
log b w = K ln w

ln w = 2 tanh 1

w =e
t

t ln w

cos w = tan

sin 1 w = tan 1

(
= ln (w +

1 w2
w
w
1 w2

)
1+ w )

cosh 1 = ln w + 1 w 2
sinh 1

w = ( w + 1 4) 2 ( w 1 4) 2

Summary
Table of
CORDIC
Algorithms

17

Variable Factor CORDIC


Allows termination of CORDIC before m
iterations
Allows digit set {-1, 0, 1}
Must compute expansion factor via recurrence:
At the end, must divide results by the square
root of (K(m))2.
Constant-factor CORDIC is almost always
preferred.

High Speed CORDIC


Do first k/2 iterations as normal.
z becomes very small

Combine remain k/2 iterations into one step.

K doesnt change.

18

Вам также может понравиться