CORDIC co-processor (CORDIC)
16.3
CORDIC functional description
16.3.1
General description
The CORDIC is a cost-efficient successive approximation algorithm for evaluating
trigonometric and hyperbolic functions.
In trigonometric (circular) mode, the sine and cosine of an angle θ are determined by
rotating the unit vector [1, 0] through decreasing angles until the cumulative sum of the
rotation angles equals the input angle θ. The x and y cartesian components of the rotated
vector then correspond respectively to the cosine and sine of θ. Inversely, the angle of a
vector [x, y], corresponding to arctangent (y / x), is determined by rotating [x, y] through
successively decreasing angles to obtain the unit vector [1, 0]. The cumulative sum of the
rotation angles gives the angle of the original vector.
The CORDIC algorithm can also be used for calculating hyperbolic functions (sinh, cosh,
atanh), by replacing the successive circular rotations by steps along a hyperbole.
Other functions can be derived from the basic functions described above.
16.3.2
CORDIC functions
The first step when using the co-processor is to select the required function, by
programming the FUNC field of the CORDIC_CR register accordingly.
The following functions are supported by the CORDIC co-processor
Function
Cosine
Phase
Modulus
Arctangent
Hyperbolic cosine
Hyperbolic sine
Hyperbolic arctangent
Natural logarithm
Square root
Several functions take two input arguments, ARG1 and ARG2, and some generate two
results simultaneously, RES1 and RES2. This is a side-effect of the algorithm and means
426/2083
Primary
argument (ARG1)
angle θ
angle θ
Sine
Table 91. CORDIC functions
Secondary
argument (ARG2)
modulus m
modulus m
x
y
x
y
x
none
x
none
x
none
x
none
x
none
x
none
RM0440 Rev 1
(Table
91):
Primary
Secondary
result (RES1)
result (RES2)
⋅
θ
⋅
m
cos
m
⋅
θ
⋅
m
sin
m
2
atan2(y,x)
x
atan2(y,x)
2
2
x
y
+
-1
tan
x
none
cosh x
sinh x
sinh x
cosh x
-1
tanh
x
none
ln x
none
none
x
RM0440
θ
sin
θ
cos
2
+
y
Need help?
Do you have a question about the STM32G4 Series and is the answer not in the manual?