Motorola DSP Developer's Kit |
Motorola DSP Developer's Kit |
Motorola DSP Developer's Kit | ![]() ![]() |
y = mot###_mean(X)
Input/Output
Output: Y (the mean value of the elements in real vector X)
Algorithm
y = 0; for(i=0; i<size; i++) { y += X[i]; } y = div (y, size); * The algorithm of div is : fractional div ( fractional y, int size) { Bit1 = count leading bits of variable size; Bit1 += fractionlenght ; Normalize (size); Bit2 = count leading bits of variable y; Normalize (y); y = y>>1; Bit2 ++; Bit1 -= Bit2; fractional-div(y, size);//this is a standard algorithm y >>= Bit1; return y; }
Memory & Register
X memory IN start address of location of input real vector X.
Register X0 store number of items in the array
Register R7 store bits/word, used by division (24 for 56300,16 for 56600)
Status Register
The assembly function mean-r.asm does not explicitly set any status registers/bits during the function execution.
Data Size Limit
The length of vector X can't be larger than the continuous available data memory size.
Data Range Limit
Input data vector X range [-1.0, +1.0]
Precision
In the case of DSP563, precision is 23 bits.
In the case of DSP566, precision is 15 bits.
Performance Limit
![]() | max-2c.asm | mean-c.asm | ![]() |