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:

    That the mere matter of a poem, for instance—its subject, its given incidents or situation; that the mere matter of a picture—the actual circumstances of an event, the actual topography of a landscape—should be nothing without the form, the spirit of the handling, that this form, this mode of handling, should become an end in itself, should penetrate every part of the matter;Mthis is what all art constantly strives after, and achieves in different degrees.
    Walter Pater (1839–1894)

    There are a thousand hacking at the branches of evil to one who is striking at the root, and it may be that he who bestows the largest amount of time and money on the needy is doing the most by his mode of life to produce that misery which he strives in vain to relieve.
    Henry David Thoreau (1817–1862)

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