HDL Implementation of Sine--Cosine Function Using ...

140 downloads 0 Views 3MB Size Report
The Jack E Voider's ... The original work is credited to Jack VoIder [I]. ..... Andraka R (1998), "A Survey of CORDIC Algorithm for FPGA Based Computers",.
HDL Implementation of Sine--Cosine Function Using CORDIC Algorithm in 32--Bit Floating Point Format Ashutosh Gupta*, Manoj Duhan** and Solomon Raju Kota***

This paper proposes a novel way to implement sine and cosine function in Coordinate Rotation Digital Computer (CORDIC) algorithm with efficient architectures. It is a class of shift-add algorithms for rotating vectors in a plane, which is usually used for the calculation of trigonometric functions, multiplication, division and conversion between binary and mixed radix number systems of DSP applications, such as Fourier transform. The Jack E Voider's CORDIC algorithm is derived from the general equations for vector rotation. The values of sine and cosine functions are calculated in IEEE-754-1985 standardized single precision floating point format for achieving better precision, accuracy and portability in the result. A normalization scheme is used which reduces error and requires no extra hardware. The algorithm has been implemented in FPGA using VHDL.

Introduction Coordinate Rotation Digital Computer (CORDIC) is a method for computing elementary functions using minimal hardware such as shifts, adds/subs and compares. CORDIC works by rotating the coordinate system through a constant angle until the angle reduces to zero. The angle offsets are selected such that the operations on X and Yare only shifts and adds. The trigonometric CORDIC algorithms were originally developed as a digital solution for real time navigation problems. The original work is credited to Jack VoIder [I]. The trigonometric algorithm is called CORDIC which is based on rotation mode, while other functions such as square root are implemented using an incremental expression of the desired function. The CORDIC algorithm has found its way into diverse applications including the 8,087 math coprocessor [2]. The HP-35 calculator, radar signal processor [3] and robotics. CORDIC rotation has also been proposed for computing discrete Fourier [4], discrete cosine [4], discrete Hartley [5], Chirp-Z transform [6], filtering [4], singular value decomposition [7] and solving linear systems [8]. The study of coordinate rotation algorithms indicates that *

Postgraduate Student, Department of Electronics and Communications, Guru Jambheshwar & Technology (GJUS&T), Hisar, India. E-mail: [email protected]

**

Chairman, Department of Electronics and Communications, Guru Jambheshwar Technology (GJUS&T), Hisar, India. E-mail: [email protected]

University of Science

University

of Science

&

* * * Scientist, Digital System Group Central Electronics Engineering Research Institute (CEERI), Pilani 333031, India. E-mail: [email protected]

© 2009 The Icfai University

Press. All Rights Reserved.

HDL Implementation of Sine-Cosine Function Using CORDIC

Algorithm in 32-Bit Floating Point Format

specialized VLSI could be designed to perform the eigenvalue--eigenvector decomposition [9], and explain how it works and its implementation specific to FPGAs [10]. We first give a brief description of the theory behind the algorithm and the IEEE-754 single precision 32-bit floating point format.

2. CORDIC Rotation All the trigonometric functions can be computed or derived from functions using vector rotations. Vector rotation can also be used for polar to rectangular and rectangular to polar conversions, for vector magnitude and as a building block in certain transforms such as the OFT and OCT (Figure 1). The CORDIC algorithm uses only shifts and adds for performing vector rotations. The algorithm, credited to VoIder [4] is derived from the general (Givens) rotation transform: y

Figure 1: Vector Rotation XV

l

=

x cos a -

sin

a

=

y

cos a + x sin

a

y

These can be rearranged so that XV

l

= cos a [x -

y

tan a]

= cos a (y + x tan a]

The lcfai University Journal of Science

& Technology, Vo\. 5,

No.2, 2009

41

If the decision at each iteration, i, is in which direction to rotate rather than whether or not to rotate, then the cos (a) term becomes a constant. The iterative rotation can DDW be expressed as: Xi + 1

= K[ Xi

_ yi .

di

' Z-i]

where,

and d.= ±1 I

The CORDIC rotator is normally operated in one of the two modes. The first called rotation by Volder [4], rotates the input vector by a specific angle (given as argument). The second mode, called vectoring, rotates the input vector to the x-axis while recording the angle required for making that rotation. In rotation mode, the angle accumulator is initialized with the desired rotation angle. The rotation decision at each iteration is made to diminish the magnitude of the residual angle in the angle accumulator. The sign of d.I decides the direction of rotation based on the sign of z.,Naturally, if the input angle is already expressed in the binary arctangent base, the I angle accumulator may be eliminated. For rotation mode, the CORDIC equation is:

i

(i

i

X + 1 =X-f.1'Y"i'

Zi + 1

= Zi

-

2-i)

d

d i" tan -1 (2-i)

where, d.I = -1 if Z I < 0,

+ 1otherwise

Thus the direction of rotation is decided by the sign of di• If the angle accumulator is initialized with zero, it will contain the traverse d angle at the end of the iterations. In vectoring mode, the CORDIC equations are: XH

1

Yi + 1

= Xi =

-

"

Yi - Xi '

Zi + 1 = Zi -

42

f.1

Yi "

di

'

Z-i

di ' Z-i

di ' tan -1 (Z-i) The lcfai University Journal of Science

& Technology,

Vol. 5, No, 2, 2009

HDL Implementation of Sine-Cosine Function Using CORDlC

Algorithm in 32-Bit Floating Point Format

where, dI

= + 1 ify. I