Texas Instruments TMS320C64X manual Minimum Value of Vector, DSPminval

Models: TMS320C64X

1 169
Download 169 pages 59.58 Kb
Page 93
Image 93

 

 

 

DSP_minval

 

Minimum Value of Vector

DSP_minval

Function

 

short DSP_minval (const short *x, int nx)

 

Arguments

 

x [nx]

Pointer to input vector of size nx.

 

 

nx

Length of input data vector. Must be multiple of 4 and 20.

 

 

return short

Maximum value of a vector.

Description

 

This routine finds the minimum value of a vector and returns the value.

Algorithm

 

This is the C equivalent of the assembly code without restrictions. Note that

 

 

the assembly code is hand optimized and restrictions may apply.

short DSP_minval(short x[ ], int nx)

{

int i, min; min = 32767;

for (i = 0; i < nx; i++) if (x[i] < min)

min = x[i]; return min;

}

Special Requirements nx is a multiple of 4 and greater than or equal to 20.

Implementation Notes

 

- Bank Conflicts: No bank conflicts occur.

 

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

 

- The input data is loaded using double word wide loads, and the MIN2

 

instruction is used to get to the minimum.

Benchmarks

Cycles

nx / 4 +10

 

Codesize

116 bytes

C64x+ DSPLIB Reference

4-65

Page 93
Image 93
Texas Instruments TMS320C64X manual Minimum Value of Vector, DSPminval