DSP_maxval

DSP_maxval

Maximum Value of Vector

Function

 

short DSP_maxval (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 8 and 32.

 

 

return short

Maximum value of a vector.

Description

 

This routine finds the element with maximum value in the input vector and

 

 

returns that 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_maxval(short x[ ], int nx)

{

int i, max; max = −32768;

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

max = x[i]; return max;

}

Special Requirements nx is a multiple of 8 and greater than or equal to 32.

Implementation Notes

 

- Bank Conflicts: No bank conflicts occur.

 

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

Benchmarks

Cycles

nx / 4 + 10

 

Codesize

116 bytes

4-62

Page 90
Image 90
Texas Instruments TMS320C64X manual DSPmaxval, Maximum Value of Vector