CORDIC Algorithm Basics
This page covers the basics of the CORDIC algorithm, including its function and common uses. CORDIC stands for Coordinate Rotation Digital Computer.
It’s a clever algorithm used to calculate trigonometric functions (like sine and cosine) and hyperbolic functions (like the inverse tangent). It relies on the concept of a lookup table.
Let’s say you want to calculate sin(φ) for some angle φ. A simple way to do this is to store all the values of sin(φ) for every possible value of φ in memory (RAM). Then, based on the input φ, you simply output the corresponding stored value.
CORDIC becomes especially useful when a hardware multiplier isn’t available. It’s frequently used in FPGAs (Field-Programmable Gate Arrays) and DSPs (Digital Signal Processors) where only subtraction, addition, table lookup, and bit-shift operations are readily available.
CORDIC is employed for operations such as sine, cosine, polar-to-rectangular coordinate conversion, general rotation, arctangent, vector magnitude, rectangular-to-polar conversion, arcsine, arccosine, and more.
It can also be adapted for linear functions, hyperbolic functions, square rooting, logarithms, and exponentials.
Operation | Mode | Initialize | Direction |
---|---|---|---|
Sine, Cosine | Rotation | x = 1/Aₙ , y = 0, z = α | Reduce z to Zero |
Polar to Rect. | Rotation | x = (1/Aₙ)X mag , y = 0, z = X phase | Reduce z to Zero |
General Rotation | Rotation | x = (1/Aₙ)X₀ , y = (1/Aₙ)y₀ , z = α | Reduce z to Zero |
Arctangent | Vector | x = (1/Aₙ)X₀ , y = (1/Aₙ)y₀ , z = 0 | Reduce y to zero |
Vector Magnitude | Vector | x = (1/Aₙ)X₀ , y = (1/Aₙ)y₀ , z = 0 | Reduce y to zero |
Rect. to Polar | Vector | x = (1/Aₙ)X₀ , y = (1/Aₙ)y₀ , z = 0 | Reduce y to zero |
Arcsine, Arccosine | Vector | x = (1/Aₙ), y = 0, arg = sin(α) or cos(α) | Reduce y to value in arg register |
CORDIC Rotation Mode and Vector Mode
There are two primary operational modes for CORDIC: rotation mode and vector mode.
Rotation Mode
Vector Mode
The following table of CORDIC rotation angles is very useful and is typically stored in a lookup table for quick retrieval when needed.