Pipelined CORDIC Design On FPGA For A Digital Sine and Cosine Waves Generator
Pipelined CORDIC Design On FPGA For A Digital Sine and Cosine Waves Generator
Generator
Esteban O. Garcia, Rene Cumplido, Miguel Arias
Department of Computer Science, INAOE. Puebla, Mexico
Phone +52 222 2663100 Fax +52 222 2663152 E-mail:{eomargr,rcumplido,ariasm}@inaoep.mx
Cosine is an even function, therefore cos (α) = cos (-α). Fig. 1. Microrotations with K compensation.
So (5) and (6) can be transformed into
The sum of the rotating angles gives the desired angle
xi+1 = Ki (xi – yi di 2-i ) (9)
yi+1 = Ki (yi + xi di 2-i ) (10) θn = ∑ di arctan 2-i (16)
Multiplication by Ki is avoided by considering it as a Because the first tangent value is 20=1, it is possible to
gain factor for all iterations. If n iterations are performed, rotate angles only in the range [-π/2,π/2], which is the
then K is defined as the multiplication of every Ki . convergence range. Arctan 2-i can be calculated a priori to
avoid the implementation of a arctan function on the FPGA.
K = ∏Ki = ∏ 1/√(1+2-2i) (11)
III. ARCHITECTURE
Ki is retired from (9) and (10), then it is considered at the
starting vector, which must be initialized as v0 = (|K|,0). At As it has been mentioned, a CORDIC implementation
the end of n rotations, the length of vector will be 1, so its does not need to have either sine or cosine values on
components will contain cosine and sine values of the memory, instead, it approximates the results on each step of
desired angle (Fig. 1). As the vector is initialized with the iterative process. The proposed architecture may be
constant K, the vector components for each iteration are extended for a specific resolution without a considerable
simplified to increase in the number of components used.
xi+1 = xi – yi di 2-i (12) Iterative CORDIC implementations take more than a
yi+1 = yi + xi di 2-i (13) clock cycle for each output value. It is useful when no
successive calculi are needed; such is the case of calculators.
On each iteration it is necessary to decide whether di =1 In this work, a generator needs to calculate successive
or di =-1. In order to make that decision, the difference values of sine and cosine. Therefore the proposed digital
between the desired angle and the current angle is used. So a wave generator has a pipelined CORDIC module as nucleus.
new variable known as accumulator is defined as It is composed of three adders-subtractors and two
arithmetic shifters (Fig. 2). Each adder-subtractor is
zi+1 = zi – di arctan 2-i (14) associated to one of the variables of vector component and
accumulator angle, called x, y, z. Each module has three
The value of z0 is the angle for which sine and cosine inputs and outputs of this type, a clock signal and an input to
are to be calculated. To know whether di should be positive manage cosine inversion, which is used to decide whether or
or negative, the following rule is used not to correct the quadrant in cosine function. This is
necessary due to the convergence range of CORDIC
-1 sin zi < 0 explained en section II. Details about cosine inversion will
di = +1 sin zi ≥ 0 (15) be given when angle sequencer is explained. In an iterative
implementation of CORDIC, a step control module is
necessary to adapt the shift amount to the corresponding
iteration. The first iteration there is only one move shift, for
the second there will be two moves and so on.
created to accomplish this function has been called angle
sequencer. Given than CORDIC only converges within the
first and fourth quadrant, it was needed a sequencer to
generate angles going from 0 to π/2, then from π /2 to -π/2
and finally from π/2 to 0. To solve this, a sawtooth wave
generator was build. It starts at zero and increases its output
value until 2n, where n is the angle depth in bits. As 2’s
complement logic is used, once 2n is reached the signal goes
from the top positive value to the minimum negative value,
then it increases again and repeats the cycle.
A. Pipeline
B. Angle Sequencer
Fig. 4. Angles Sequencer signal
CORDIC is a module which calculates sine and cosine
given an angle, so it is necessary to give it a sequence of Sawtooth wave is not useful by itself, it needs to be
angles in the range of CORDIC convergence. It is not a transformed into a triangle wave to feed the CORDIC
simple sequence of angles, but it must be able to change module. Triangle must represent the travel made on first and
frequency of the signal created by CORDIC. The module fourth quadrants. Sawtooth wave is transformed into triangle
wave by looking at two most significant bits because they TABLE I
indicate the current quadrant. When the two most significant SPEED OPTIMIZATION RESULTS
bits are 01 or 10, then the sawtooth signal must be
transformed. That is done by mean of inverting every single Parameter Used %
bit, without changing the sign bit (Fig. 4). This scheme had Number of Slices 1104 57
been previously explored by Norbert Lindlbauer [5] in a
Number of Flip Flops 615 16
sound synthesizer, but we have reduced one bit from the
Numer of 4 input LUTs 1748 45
sawtooth wave and applied quadrant correction on the fly.
Number of bonded IOBs 43 24
The speed of the sawtooth wave determines the frequency of Number of GCLKs 1 12
the sine and cosine waves. In fact, sine and cosine waves Maximum Frequency 154.69MHz
will have the same frequency than the triangle wave.