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

International Journal of Emerging Technologies and Engineering (IJETE)

Volume 1 Issue 5, June 2014, ISSN 2348 8050


106
www.ijete.org
CORDIC Algorithm for Sinusoidal Calculations
Ms. Ankita Sharma
1
, Mrs. Neha Sharma
2
, Mr. Jitender Chhabra
3
1
M.Tech. Scholar, SGTIET, Gurgaon.
2
Asst. Professor, SGTIET, Gurgaon
3
Asst. Professor, AKGEC, Ghaziabad.
ABSTRACT
This paper describes the application of the CORDIC
Algorithms to find the sine and cosine of an angle in
integer form. The only operations it requires are
addition, subtraction, bit shift and table lookup which
makes it the first choice if the hardware multiplier is
not available. The algorithm is implemented here for
an angle of 30
o
and the Active-HDL results are shown
along with sine and cosine values in the tabular form
for different rotation angles.
Keywords CORDIC, Cosine, HDL, Sine, Vector-
rotation.
1. INTRODUCTION
Trigonometric Functions are widely used in analysis
and design of various mathematical models.
Trigonometric functions are needed to be calculated in
various industrial, mechanical and computational
applications. These functions are calculated mainly
using two techniques mainly the Polynomial
Approximation Method & Look up Table method.
Both these methods have their relative advantages and
disadvantages and are used accordingly in the
applications favoring the preferences. In the recent
years a new computation technique named CORDIC
came in to existence which combined the merits of
both the methods and provides a much more efficient
computation technique which also extends its
advantages even in the hardware VLSI
Implementations. This CORDIC algorithm was
devised by Jack E. Volder in 1959 for the computation
of Trigonometric functions, Multiplication, Division,
Logarithms and other complex calculations.[1]
2. MATHEMATICAL ANALYSIS
General equations for a vector rotation lay the
foundation for derivation of the Volder's CORDIC
algorithm. If a vector V with coordinates (x, y) is
rotated through an angle then a new vector V ' can be
obtained with coordinates (x', y') where x' and y' can be
obtained using x, y and by the following method.[2]
As shown in Fig. 1.
X = r cos , Y = r sin (1)
(x) = (x. cos () y.sin ()) (2)
(y) = (y.cos () +x.sin ()) (3)
Fig. 1: Rotation of a vector V by angle
x = cos()[x - y.tan()] (4)
y = cos()[y + x.tan()] (5)
Now if tan() =2
-i
the value inside the bracket can
besimplified.In digital hardware this denotes a simple
shift operation. Furthermore, if those rotations are
performed iteratively and in both directions every
value of tan () is presentable with = arctan(2
-i
) the
cosine term could also be simplified and since cos() =
cos(-) it is a constant for a fixed number of iterations.
This iterative rotation can now be expressed as:
x
i+1
= k
i
[x
i
y
i
.d
i
.2
-i
] (6)
y
i+1
= k
i
[y
i
x
i
.d
i
.2
-i
] (7)
where, i denotes the number of rotation required to
reach the required angle of the required vector,
cos(arctan(2
-i
)) and d
i
= 1. The product of the K
i
s
represents the so-called K factor :
k = (8)
where = cos
0
cos
1
cos
2
cos
3
cos
4
.................cos
n-1
( is the angle of rotation here for n times rotation).
K
i
is the gain and its value changes as the number of
International Journal of Emerging Technologies and Engineering (IJETE)
Volume 1 Issue 5, June 2014, ISSN 2348 8050
107
www.ijete.org
iteration increases. For 8-bit hardware CORDIC
approximation method the value of k
i
is given as:
k
i
= cos = cos
0
. cos
1
. cos
2
. cos
3
. cos
4
.
cos
5
. cos
6
. cos
7
=cos45.cos26.565.. cos0.04469 = 0.6073 (9)
TABLE 1 Values of Angles for 8-bit CORDIC H/W
i d
-i
=
2
-i
=tan
i

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.

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