21.07.2015 Views

"TMS320C55x DSP Library DSPLIB Programmer's Reference"

"TMS320C55x DSP Library DSPLIB Programmer's Reference"

"TMS320C55x DSP Library DSPLIB Programmer's Reference"

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

and16AlgorithmNot applicableOverflow Handling MethodologySaturation implemented for overflow handlingSpecial Requirements noneImplementation Notes noneExampleBenchmarksSee examples/ug subdirectory(preliminary)Cycles † Core: 7 * nx (if x[n] ==0)32 * nxOverhead: 18Code size(in bytes)124† Assumes all data is in on-chip dual-access RAM and that there is no bus conflict due to twiddletable reads and instruction fetches (provided linker command file reflects those conditions).rand16FunctionArgumentsRandom Number Generation Algorithmushort oflag= rand16 (DATA *r, ushort nr)*r Pointer to the array where the 16-bit random numbers arestorednrNumber of random numbers that are generatedoflagOverflow error flag (returned value) If oflag = 1, a 32-bit data overflow occurred in anintermediate or final result.If oflag = 0, a 32-bit overflow has not occurred.DescriptionAlgorithmThis algorithm computes an array of random numbers based on the linear congruentialmethod introduced by D. Lehmer in 1951. This is one of the fastestand simplest techniques of generating random numbers. The code shownhere generates 16-bit integers, however, if a 32-bit value is desired the codecan be modified to perform 32-bit multiplies using the defined constantsRNDMULT and RNDINC. The disadvantage of this technique is that it is verysensitive to the choice of RANDMULT and RNDINC.r [n] = [(r[n–1]*RNDMULT) + RNDINC ] % Mwhere 0 n nr and 0 M 65536Function Descriptions4-81

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!