beautypg.com

Texas Instruments TMS320C64X User Manual

Page 117

background image

DSP_q15tofl

4-89

C64x+ DSPLIB Reference

Q15 to Float Conversion

DSP_q15tofl

Function

void DSP_q15tofl (short *x, float *r, int nx)

Arguments

x[nx]

Pointer to Q.15 input vector of size nx.

r[nx]

Pointer to floating-point output data vector of size nx containing
the floating-point equivalent of vector x.

nx

Length of input and output data vectors. Must be multiple of 2.

Description

Converts the values stored in vector x[ ] in Q.15 format to IEEE floating point
numbers in output vector r[ ].

Algorithm

This is the C equivalent of the assembly code without restrictions. Note that
the assembly code is hand optimized and restrictions may apply.

void DSP_q15tofl(short *x, float *r, int nx)

{

int i;

for (i=0;i

r[i] = (float) x[i] / 0x8000;

}

Special Requirements nx must be a multiple of 2.

Implementation Notes

-

Bank Conflicts: No bank conflicts occur.

-

Interruptibility: The code is interrupt-tolerant but not interruptible.

-

Loop is unrolled twice

Benchmarks

Cycles

2 * nx + 14

Codesize

184 bytes