
A survey of CORDIC algorithms for FPGA based computers Ray Andraka Andraka Consulting Group, Inc 16 Arcadia Drive North Kingstown, RI 02852 401/884-7930 FAX 401/884-7950 email:[email protected] 1. ABSTRACT efficient algorithms is a class of iterative solutions for trigonometric and other transcendental functions that use The current trend back toward hardware only shifts and adds to perform. The trigonometric intensive signal processing has uncovered a functions are based on vector rotations, while other relative lack of understanding of hardware functions such as square root are implemented using an signal processing architectures. Many incremental expression of the desired function. The trigonometric algorithm is called CORDIC, an acronym for hardware efficient algorithms exist, but these Coordinate &on&ion DIgital computer. The incremental are generally not weil known due to the functions are performedwith a very simple extensionto the dominance of software systems over the past hardware architecture, and while not CORDIC in the strict quarter century. Among these algorithms is a sense, are often included becauseof the close similarity. set of shift-add algorithms collectively known The CORDIC algorithms generally produce one additional bit of accuracyfor each iteration. as CORDIC for computing a wide range of functions including certain trigonometric, The trigonometric CORDIC algorithms were originally hyperbolic, linear and logarithmic functions. developed as a digital solution for real-time navigation problems. The original work is credited to Jack Volder While there are numerous articles covering [4,9]. Extensions to the CORDIC theory basedon work by various aspects of CORDIC algorithms, very John Wahher[l] and others provide solutions to a broader few survey more than one or two, and even class of functions. The CORDIC algorithm has found its fewer concentrate on implementation in way into diverse applications including the 8087 math FPGAs. This paper attempts to survey coprocessor[7], the HP-35 calculator, radar signal processors[3]and robotics. CORDIC rotation has also been commonly used functions that may be proposed for computing Discrete Fourier[4], Discrete accomplished using a CORDIC architecture, Cosine[4], Discrete Hartley[lO] and Chirp-Z [9] explain how the algorithms work, and explore transforms, filtering[4], Singular Value implementation specific to FPGAs. Decomposition[141, and solving linear systems[11. 1.1 Keywords This paper attempts to survey the existing CORDIC and CORDIC, sine, cosine, vector magnitude,polar conversion CORDIC-like algorithms with an eye toward implementation in Field Programmable Gate Arrays 2. INTRODUCTION (FPGAs). First a brief description of the theory behind the The digital signal processing landscape has long been algorithm and the derivation of several functions is dominated by microprocessorswith enhancementssuch as presented. Then the theory is extended to the so-called single cycle multiply-accumulate instructions and special unified CORDIC algorithms, after which implementation addressingmodes. While these processorsare low cost of FPGA CORDIC processorsis discussed. and offer extreme flexiblility, they are often not fast enough for truly demanding DSP tasks. The advent of Permissionto make digitalhrd copies of all or pti oft& material for reconfigurable logic computers permits the higher speeds Personal or chsmom use is mted without fee provided that the copies of dedicated hardware solutions at costs that are are not made or distributed for profit or commercial advantage, &e copy- competitive with the traditional software approach. right notice, the title oflhe publication and its date appear, and notice is &‘en that mpy&ht is by permission of the ACM, Inc. To copy otherwise, Unfortunately, algorithms optimized for these to republish, to post on servers or to redistribute to lists, requires specific microprocessor based systems do not usually map well permission and/or fee. into hardware. While hardware-efficient solutions often FPGA 98 Monterey CA USA exist, the dominance of the software systemshas kept those %yri&t 1998 ACM 0-89791-978~5/98101..$5.00 solutions out of the spotlight. Among these hardware- 191 3. CORDIC THEORY: AN ALGORITHM The set of all possible decision vectors is an angular FOR VECTOR ROTATION measurement system based on binary arctangents. Conversionsbetween this angular systemand any other can All of the trigonometric functions can be computed or be accomplished using a look-up. A better conversion derived from functions using vector rotations, as will be method uses an additional adder-subtractor that discussedin the following sections. Vector rotation can accumulates the elementary rotation angles at each also be used for polar to rectangular and rectangular to iteration. The elementary angles can be expressedin any polar conversions,for vector magnitude, and as a building convenient angular unit. Those angular values are supplied block in certain transformssuch as the DFT and DCT. The by a small lookup table (one entry per iteration) or are CORDIC algorithm provides an iterative method of hardwired, depending on the implementation. The angle performing vector rotations by arbitrary angles using only accumulator adds a third difference equation to the shifts and adds. The algorithm, credited to Volder[4], is CORDIC algorithm: derived from the general (Givens) rotation transform: - di . &-‘(2~‘) x1= xcos$ - ysiIl(l 2.r+l =q y’= ycos$+xsin+ Obviously, in cases where the angle is useful in the arctangentbase, this extra elementis not needed. , which rotates a vector in a Cartesianplane by the angle $. These can be rearrangedso that: The CORDIC rotator is normally operated in one of two modes. The first, called rotation by Volder[4], rotates the x’=cost#b[x-ytang]* input vector by a specified angle (given as an argument). The secondmode, called vectoring, rotatesthe input vector y’=cos~.[y+xtan~] to the x axis while recording the angle required to make So far, nothing is simplified. However, if the rotation that rotation. angles are restricted so that tan(~$)=EZ’,the multiplication In rotation mode, the angle accumulator is initialized with by the tangent term is reduced to simple shift operation. the desired rotation angle. The rotation decision at each Arbitrary angles of rotation are obtainable by performing a iteration is made to diminish the magnitude of the residual series of successivelysmaller elementary rotations. If the angle in the angle accumulator. The decision at each decision at each iteration, i, is which direction to rotate iteration is therefore basedon the sign of the residual angle rather than whether or not to rotate, then the cos(SJ term after each step. Naturally, if the input angle is already becomes a constant (because cos(Si) = cos(-6J). The expressed in the binary arctangent base, the angle iterative rotation can now be expressedas: accumulator may be eliminated. For rotation mode, the CORDIC equationsare: x,+1 &,[x, -yi .di .2-j] x.1+1 =xi -y/d,.2-’ yj+* = Ki[yi t xi -di -2”] yi+l =yj+x,-di.2-’ zj+* = zj - dj 4af’(2-‘) Ki = cos(tan-’ 2-‘) = l/J= where di =+I dF -1 if z, c 0, +l otherwise Removing the scale constant from the iterative equations which provides the following result: yields a shift-add algorithm for vector rotation. The product of the Kr’s can be applied elsewherein the system = A&, cosz,‘-y, sinz,] or treatedas part of a systemprocessing gain. That product 58 approaches 0.6073 as the number of iterations goes to Y, = An[Yo coszo + x0 sinz, infmity. Therefore, the rotation algorithm has a gain, A,,, 1 of approximately 1.647. The exact gain depends on the Zll=o number of iterations, and obeysthe relation A, =nm A, = nJl+z”” n n In the vectoring mode, the CORDIC rotator rotates the The angle of a composite rotation is uniquely defmed by input vector through whatever angle is necessaryto align the sequenceof the directions of the elementary rotations. the result vector with the x axis. The result of the vectoring That sequencecan be representedby a decision vector. operation is a rotation angle and the scaled magnitude of 192 the original vector (the x component of the result). The reduction may be more convenient when wiring is vectoring function works by seeking to minimize the y restricted, as is often the casewith FPGAs. componentof the residual vector at eachrotation. The sign The CORDIC rotator described is usable to compute of the residual y component is used to determine which several trigonometric functions directly and others direction to rotate next. If the angle accumulator is indirectly. Judicious choice of initial values and modes initialized with zero, it will contain the traversed angle at permits direct computation of sine, cosine, arctangent, the end of the iterations. In vectoring mode, the CORDIC vector magnitude and transformations between polar and equationsare: Cartesiancoordinates. =xi-y;.d,.2-’ xi+1 3.1 Sine and Cosine yi+, = yj +xi.di.2-’ The rotational mode CORDIC operation can simultaneously compute the sine and cosine of the input z.I+1 = zi - di. tan-‘(2-7 angle. Setting the y componentof the input vector to zero reducesthe rotation mode result to: where d,= +I ifx, < 0, -1 otherwise. x, = A, -x0 cosz, Then: y,, = A, ‘x0 sinz 0 By setting x0 equal to l/.-A, the rotation produces the x,, = Andxi +yi unscaled sine and cosine of the angle argument, z,. Very Y, =o often, the sine and cosine values modulate a magnitude value. Using other techniques (e.g., a look up table) requires a pair of multipliers to obtain the modulation. The CORDIC technique performs the multiply as part of the rotation operation, and therefore eliminates the need for a pair of explicit multipliers. The output of the CORDIC n rotator is scaled by the rotator gain. If the gain is not The CORDIC rotation and vectoring algorithms as stated acceptable,a single multiply by the reciprocal of the gain are limited to rotation angles between -7ri2 and 7~12.This constant placed before the CORDIC rotator will yield limitation is due to the use of 2” for the tangent in the fmt unscaled results.
Details
-
File Typepdf
-
Upload Time-
-
Content LanguagesEnglish
-
Upload UserAnonymous/Not logged-in
-
File Pages10 Page
-
File Size-