Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
Textbook referenced
[Par00] B. Parhami
Computer Arithmetic: Algorithms and Hardware Designs
Oxford University Press, 2000.
What is CORDIC?
Basic idea
sin
x x. cos( ) y. sin( )
y y. cos( ) x. sin( )
cos
Y
Rearrange as:
Note :
(x,y)
(x,y)
X
sin( )
tan( )
cos( )
tan()
atio
ot
at
io
n
r ot
(x,y) R
udo
Pse
Two components:
(x,y)
Shift operation
[ Oxford U Press]
Pre-computation of tan(i)
45.0
26.6
14.0
7.1
3.6
1.8
0.9
0.4
0.2
0.1
1
0.5
0.25
0.125
0.0625
0.03125
0.015625
0.0078125
0.00390625
0.001953125
= 2-0
= 2-1
= 2-2
= 2-3
= 2-4
= 2-5
= 2-6
= 2-7
= 2-8
= 2-9
Note: decreasing i.
Possible to write any angle = 0 1 9
as long as -99.7 99.7 (which covers 90..90)
Convergence possible: i Nj=i+1i+1 (10-5 deg accuracy)
45
30
Rotation Reduction
x cos( ).[ x y. tan( )]
y cos( ).[ y x. tan( )]
Rewrite in terms of i: (0 i n)
i
xi 1 cos( i ).[ xi yi .d i . tan( i )]
xi 1 K i .[ xi yi .d i .2 ]
Where:
K i cos( i ) cos(tan 1 (2 i ))
d i 1
What about Kis?
Note :
cos( i ) cos( i )
xi 1 K i .[ xi yi .d i .2 i ]
i
yi 1 K i .[ yi xi .d i .2 ]
Observations:
We choose to always use ALL i terms, with +/- signs
Ki = cos(i) = cos(-i)
At each step, we multiply by cos(i)
[constant?]
K Ki
i 0
Initialize x=0.607253,y=0,z=
For i=0 n
xi+1= xi di . 2-i . yi
yi+1 = yi + di . 2-i . xi
zi+1 = zi di . i
x0,y0
30
-45
Similar to
non-restorg sqrt
x2,y2
-14
+26.6
x10
x3,y3
x1,y1
[ Oxford U Press]
0.6072529350
((long int)((X) * 65536.0))
Only used:
>0, >>, +
Integer ops
CORDIC Hardware
x
y
shift
shift
Lookup
Table
[ Oxford U Press]
Application?
If start with x=1, z=0, the final z is tan-1(y)
Generalized CORDIC
Generalized CORDIC
iteration:
xi+1= xi . di . 2-i . yi
yi+1 = yi + di . 2-i . xi
zi+1 = zi di . e(i)
Variations:
A
F
W V
[ Oxford U Press]
[ Wilde]
sin z
tan z
cos z
sinh z
tanh z
cosh z
cos 1 w tan 1
1
sin w tan
w ln w
1 w2
w
w
1 w2
1 w
w 1
ln w 2 tanh
w 1
cosh 1 w ln w 1 w2
log b w K . ln w
sinh 1
w e
t
t ln w
w ( w 1 / 4) 2 ( w 1 / 4) 2
[ Wilde]
= 1
Circular
e(i) =
tan-12-i
= 0
Linear
e(i)= 2-i
x
y
z
di=sign(zi), zi 0
C
O
R
D
I
C
C
O
R
D
I
C
Vectoring mode
y + xz
C
O
R
D
I
C
K (x2 + y2)1/2
0
-1
z + tan (y/x)
C
O
R
D
I
C
x
0
di=-sign(xi yi), yi 0
0
z + y/x
Vectoring mode
di=sign(zi), zi 0
x
= -1
Hyperbolic
y
z
C
O
R
D
I
C
di=-sign(xi yi), yi 0
C
O
R
D
I
C
K(x2 - y2)1/2
0
-1
z + tanh (y/x)
xi+1= xi
. di . 2-i . yi
yi+1 = yi + di . 2-i . xi
zi+1 = zi di . e(i)
{-1,0,1}, di {-1,1}
[Par00], p. 371
[ Oxford U Press]
To Probe Further
Tutorials
http://cnmat.cnmat.berkeley.edu/~norbert/cordic/node3.html
http://www.execpc.com/~geezer/embed/cordic.htm
(including C code)
Papers
Survey paper on FPGA implementation of CORDIC algorithms:
http://www.andraka.com/files/crdcsrvy.pdf
http://www.taygeta.com/cordic_refs.html
Hardware implementations
http://www.free-ip.com/cordic/
http://www.stanford.edu/~chet/cordic.html