CORDIC - Mode of Operation: Rotation Mode

Mode of Operation: Rotation Mode

CORDIC can be used to calculate a number of different functions. This explanation shows how to use CORDIC in rotation mode to calculate the sine and cosine of an angle, and assumes the desired angle is given in radians and represented in a fixed point format. 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. Using CORDIC, we would start with the vector :

In the first iteration, this vector is rotated 45° counterclockwise to get the vector . Successive iterations 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/(2i−1)) for i = 1, 2, 3, ….

More formally, every iteration calculates a rotation, which is performed by multiplying the vector with the rotation matrix :

The rotation matrix is given by:

Using the following two trigonometric identities:

the rotation matrix becomes:

The expression for the rotated vector then becomes:

where and are the components of . Restricting the angles so that takes on the values, the multiplication with the tangent can be replaced by a division by a power of two, which is efficiently done in digital computer hardware using a bit shift. The expression then becomes:

where

and can have the values of −1 or 1, and is used to determine the direction of the rotation; if the angle is positive then is +1, otherwise it is −1.

can be ignored in the iterative process and then applied afterward with a scaling factor:

which is calculated in advance and stored in a table, or as a single constant if the number of iterations is fixed. This correction could also be made in advance, by scaling and hence saving a multiplication. Additionally it can be noted that:

to allow further reduction of the algorithm's complexity.

After a sufficient number of iterations, the vector's angle will be close to the wanted angle . For most ordinary purposes, 40 iterations (n = 40) is sufficient to obtain the correct result to the 10th decimal place.

The only task left is to determine if the rotation should be clockwise or counterclockwise at each iteration (choosing the value of ). This is done by keeping track of how much the angle was rotated at each iteration and subtracting that from the wanted angle; then in order to get closer to the wanted angle, if is positive, the rotation is clockwise, otherwise it is negative and the rotation is counterclockwise.

The values of must also be precomputed and stored. But for small angles, in fixed point representation, reducing table size.

As can be seen in the illustration above, the sine of the angle is the y coordinate of the final vector, while the x coordinate is the cosine value.

Read more about this topic:  CORDIC

Famous quotes containing the words mode of, mode and/or rotation:

    In most cases a favorite writer is more with us in his book than he ever could have been in the flesh; since, being a writer, he is one who has studied and perfected this particular mode of personal incarnation, very likely to the detriment of any other. I should like as a matter of curiosity to see and hear for a moment the men whose works I admire; but I should hardly expect to find further intercourse particularly profitable.
    Charles Horton Cooley (1864–1929)

    Sight is the least sensual of all the senses. And we strain ourselves to see, see, see—everything, everything through the eye, in one mode of objective curiosity.
    —D.H. (David Herbert)

    The lazy manage to keep up with the earth’s rotation just as well as the industrious.
    Mason Cooley (b. 1927)