SLAU846A June 2023 – October 2023 MSPM0G1105 , MSPM0G1106 , MSPM0G1107 , MSPM0G1505 , MSPM0G1506 , MSPM0G1507 , MSPM0G3105 , MSPM0G3105-Q1 , MSPM0G3106 , MSPM0G3106-Q1 , MSPM0G3107 , MSPM0G3107-Q1 , MSPM0G3505 , MSPM0G3505-Q1 , MSPM0G3506 , MSPM0G3506-Q1 , MSPM0G3507 , MSPM0G3507-Q1
Sine and Cosine (SINCOS) functions are computed using the CORDIC algorithm. The algorithm relies on expressing the angle as a sum of angles in per unit format with a configurable number of iterations to incrementally calculate the result. The sine and cosine of the given angle is computed simultaneously for the number of iterations specified in CTL.NUMITER field and stored in the RES1 and RES2 registers.
Table 5-4 shows the configuration registers for SINCOS.
Register (Bit Field) | Value | Description |
---|---|---|
OP1 | User value | Angle in degrees per unit (SQ0.31 format). The angle in per unit is calculated by n = angle/180, where n is the angle in per unit between [-1,1) and angle is between [-180,180) degrees. |
CTL.FUNC | 1h | SINCOS |
CTL.NUMITER | User value | Number of iterations |
RES1 | 32-bit result | Cosine of the angle (SQ0.31 format) |
RES2 | 32-bit result | Sine of the angle (SQ0.31 format) |
A higher number of iterations (NUMITER) calculates more accurate results but will take longer to compute.
Status, Errors, and Overflow
There are no status, error, or overflow bits for SINCOS.
Configuration
To perform SINCOS: