Motorola DSP Developer's Kit | ![]() ![]() |
Y = mot###_angle( X )
Description
This function returns the inverse tangent (arctangent) of the input complex vector X
Input/Output
Input: Complex vector X (includes the real part Xr and the imaginary part Xi)
Algorithm
Use the CORDIC algorithm. For each input vector, x represents the real part, and y represents the imaginary part of the input vector.
int z = 0, X, Y, Z =0, i; if (x == (unsigned frac)0) return (frac)0; X = x = x>>2 ; Y = y = y>>2 ; /* Circular Function */ for (i = 0; i <= fracbits; ++i) { x = X >> i; y = Y >> i; z = atan[i]; if (Y <= 0) { X -= y; Y += x; Z -= z; } else { X += y; Y -= x; Z += z; } } Z = Z << 2; return Z;
Memory & Register
X0 as x
X1 as y
Y1 as z
B as Z
In the case of DSP563, R2 stores 22
In the case of DSP566, R2 stores 14
Status Register
The assembly function angle-c.asm
does not explicitly set any status registers/bits during the function execution.
Data Size Limit
The length of vector X is limited by the size of available continuous data memory.
Data Range Limit
The input vector X range is [-1.0, +1.0].
Precision
In the case of DSP563, precision is 17 bits.
In the case of DSP566, precision is 10 bits.
Performance Limit
![]() | abs-c.asm | conv-r.asm | ![]() |