CORDIC Algorithm For Sinusoidal Calculations
CORDIC Algorithm For Sinusoidal Calculations
CORDIC Algorithm For Sinusoidal Calculations
i
=
arctan(2
-i
)
inradian
0 1
45
o 0.7854
1 0.5
26.565
o 0.4636
2 0.25
14.036
o 0.2450
3 0.125
7.125
o 0.1244
4 0.0625
3.576
o 0.0624
5 0.03125
1.7876
o 0.0312
6 0.015625
0.8938
o 0.0156
7 0.0078125
0.4469
o 0.0078
From the TABLE 1 it can be seen that precision up to
0.4469 is possible for 8-bit CORDIC hardware.To
simplify each rotation, picking
i
(angle of rotation in
ith iteration) such that
i
= d
i
. 2-i . d
i
is such that it has
value +1 or -1 depending upon the rotation i. e.
d
i
{+1,-1} . Then
x
i+1
= x
i
- d
i
y
i
2
i
(9)
y
i+1
= y
i
- d
i
x
i
2
-I
(10)
z
i+1
= z
i
- d
i
tan
-1
2
-I
(11)
The computation of x
i+1
or y
i+1
requires an i-bit right
shift and an add/subtract. If the function tan
-1
2
-i
is pre
computed and stored in table (TABLE 1) for different
values of i, a single add/subtract suffices to compute
z
i+1
. Each CORDIC iteration thus involves two shifts, a
table lookup and three additions. If the rotation is done
by the same set of angles (with + or - signs), then the
expansion factor K, is a constant, and can be pre
computed.[3] For example to rotate by 30 degrees, the
following sequence of angles be followed that add up
to 30 degree.
30.0 45.0 - 26.6 + 14.0 - 7.1 + 3.6 + 1.8 - 0.9 + 0.4 -
0.2 + 0.1
= 30.1
In effect, what actually happens in CORDIC is that z is
initialized to 30 degree and then, in each step, the sign
of the next rotation angle is selected to try to change
the sign of z; that is, d
i
= sign ( z
i
) is chosen, where the
sign function is defined to be -1 or +1 depending on
whether the argument is negative or non-negative.[4]-
[7] Table 2 shows the process of selecting the signs of
the rotation anglesfor a desired rotation of +30 degree.
TABLE 2Choosing the signs of the rotation angles to
force z to zero
i z
i
-
i
z
i+1
0 +30.0-45.0 -15
1 -15.0+26.6 11.6
2 +11.6-14.0 -2.4
3 -2.4+7.1 4.7
4 +4.7-3.6 1.1
5 +1.1-1.8 -0.7
6 -0.7+0.9 0.2
7 +0.2-0.4 -0.2
8 -0.2+0.2 0
9 +0.0-0.1 -0.1
Fig. 2 depicts the initial 3 iterationsin the process of
vector rotation.
Figure 2: First 3 of 10 iterations leading from (x
0
,y
0
)
to ( x
3
,y
3
) in rotating by +30, rotation mode.
3. ALGORITHMIC APPROACH
This approach shows how to use CORDIC in rotation
mode to calculate sine and cosine of an angle, and
assumes the desired angle is given in radians and
represented in a fixed point format. Referring to
determine the sine or cosine for an angle , the y or x
coordinate of a point on the unit circle corresponding
to the desired angle must be found. (Refer Fig. 3)
45
o
26.6
o
14
o
x
1
, y
1
xo, yo
x
2
, y
2
x
3
, y
3
International Journal of Emerging Technologies and Engineering (IJETE)
Volume 1 Issue 5, June 2014, ISSN 2348 8050
108
www.ijete.org
Fig. 3 Flowchart for CORDIC Algorithm
Yes
Rotate vector
clockwise
Rotate vector
counterclockwise
Start
Enter the value of
Draw a unit circle with radius = stating vector v
0
= [1, 0]
For 1
st
iteration rotate the vector by 45
o
to get the vector v
1
Make next iteration to rotate the vector to in the direction of achieving the desired angle using
the step angle
i
= tan
-1
(2
-i
)
Calculate updated value of using
i
=
i-1
- d
i
i
Is
i
positive?
Find the updated vector v
i
by making next iteration
Is the updated
angle close to
Measure the value of x-coordinate to get the value of cos& measure the value of y-
coordinate to get the value of sin
Stop
No Yes
No
International Journal of Emerging Technologies and Engineering (IJETE)
Volume 1 Issue 5, June 2014, ISSN 2348 8050
109
www.ijete.org
Using CORDIC, we would start with the vector v
o
:
v
o=
[1,0] (12)
In the first iteration, this vector would be rotated 45
counterclockwise to get the vector v
1
. Successive
iterations will rotate the vector in one or the other
direction by size decreasing steps, until the desired
angle has been achieved. Step i size is arctan(1/(2
i1
))
for i = 1, 2, 3, .
4. RESULTS
Fig. 4, 5, 6, and 7 shows the Active HDL simulation
results in the form of a continuous waveform with ten
Timing states for an integer input angle of 30
o
. TABLE
3 consist of the end results of the simulation for three
different angles: 30
o
, 40
o
, and 60
o
Fig. 4 Waveform for States m0, m1, m2 and m3
Fig. 5 Waveform for States m4, m5 and m6
International Journal of Emerging Technologies and Engineering (IJETE)
Volume 1 Issue 5, June 2014, ISSN 2348 8050
110
www.ijete.org
Fig. 6 Waveform for States m7 and m8
Fig. 7 Magnitude of sine and cosine of angle 30
TABLE 3 Sine and Cosine values of some angles
S. No. Input angle in derges Sine value
(sfloat2)
Cosine value
(cfloat2)
1. 30
o
0.50781 0.85156
2. 45
o
0.70313 0.69531
3. 60
o
0.86719 0.49219
International Journal of Emerging Technologies and Engineering (IJETE)
Volume 1 Issue 5, June 2014, ISSN 2348 8050
111
www.ijete.org
5. CONCLUSION
This paper presents mathematical and analytical
aspects of implementing the CORDIC algorithm for
sinusoidal calculations. This method can provide n-bit
accuracy for n iterations. This method is much simpler
than the conventional methods as the computations are
reduced to only shift and add operations instead of the
complex multiplication operations. On the other hand,
when a hardware multiplier is available (e.g. in a DSP
microprocessor), table-lookup methods and power
series are generally faster than CORDIC.
REFERENCES
[1] R.Andraka,A Survey of CORDIC Algorithms for
FPGA Based Computers, CM/SIGDA Sixth
International Symposium on FPGAs, February1998,
Monterey, CA, pp.191-200.
[2] J.Volder,The CORDIC Computing Technique, IRE
Trans. Comput.,Sept.1959, pp.330-334.
[3] Nuha A.S. Alwan, A Fully Pipelined Systolic
Array forSinusoidal Sequence Generation, IEEE
Transactions on Computers, Vol. 55, No. 5, May 2006,
636-639.
[4]AmitAcharyya, KoushikMaharatna, Coordinate
Rotation Based Low Complexity N-DFastICA
Algorithm and Architecture, IEEE Transactions on
Signal Processing, Vol. 59, No. 8, August 2011, 3997-
4011.
[5] Alvaro Vazquez, Julio Villalba, Redundant
Floating-point Decimal CORDICAlgorithm, IEEE
Transactions on Computers, Vol. 52, No. 6, July 2011,
1012-1025.
[6] Pramod Kumar Meher, CORDIC Designs for Fixed
Angle of Rotation, IEEE Transactions on Very Large
Scale Integration (VLSI)Ssystems, Vol. 21, No. 2,
February 2013, 217-228
[7] Hai Huang and Liyi Xiao, CORDIC Based Fast
Radix-2 DCT Algorithm, IEEE Signal Processing
Letters, Vol. 20, No. 5, May 2013, 483-486.