Motorola DSP Developer's Kit    
sort-c.asm

MATLAB Usage

Description

This function sorts the complex input vector X

Input/Output

Input: Complex vector X (includes the real part Xr, and the imaginary part Xi)

Output: Complex vector Y, and vector I (index)

Algorithm

Algorithm

Sort vector R using heap sort algorithm, and then adjust vector X according to the index of vector R.

Generate vector R (and its index vector starting from 1), and then put the results in the address:

    #IN+SIZE    (X and Y memory, respectively)

Sort vector R and adjust its index vector accordingly.

Adjust the complex data according to the index.

Please refer to sort-r1.asm for the heap sort algorithm.

Intermediate vector:

Start address of Vector R, and Vector I (index) will be calculated by the assembly code.

Vector I is located in Y memory.

Memory & Register

Memory allocation:

Register usage:

Status Register

The assembly function sort-c.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.


 sort-r2.asm sqrt-sr.asm