Motorola DSP Developer's Kit |
angle-c.asm
Motorola DSP Developer's Kit |
angle-c.asm
Motorola DSP Developer's Kit |
 |
angle-c.asm
MATLAB Usage
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)
Output: Vector Y
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
Memory allocation:
- Label IN stores the start address of input vector X
- Label INREAL stores the start address of real data of input vector
- Label INIMAG stores the start address of complex data of input vector
- Label OUTREAL stores the start address of output vector
- Variable X, Y is saved starting from label XYZ
X0 as x
X1 as y
Y1 as z
B as Z
Register usage:
- Register R6 stores the number of items of the input array
- Register R2 stores the fraction bits +1
In the case of DSP563, R2 stores 22
In the case of DSP566, R2 stores 14
- Register R3 stores the value of the atan table
- Registers R0 and R5 store the label IN(OUT)
- Register R7 stores the start address of label XYZ
- Register R1 stores the loop counter
- Register Y0 is mainly used as shift number register (i.e., variable 'i' in the algorithm description)
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
In the case of DSP563:
- When the input vector is a real vector, there are 25 cycles for each element of input data.
- When the input vector is a complex vector, there are 628 cycles for each element of input data.
In the case of DSP566:
- When the input vector is a real vector, there are 25 cycles for each element of input data.
- When the input vector is a complex vector, there are 609 cycles for each element of input data.
| abs-c.asm | | conv-r.asm | |