Texas Instruments TMS320C64X manual Q15 to Float Conversion, DSPq15tofl

Models: TMS320C64X

1 169
Download 169 pages 59.58 Kb
Page 117
Image 117

 

 

 

DSP_q15tofl

 

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<nx;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

C64x+ DSPLIB Reference

4-89

Page 117
Image 117
Texas Instruments TMS320C64X manual Q15 to Float Conversion, DSPq15tofl