Texas Instruments TMS320C28x Reference Manual page 458

Dsp cpu and instruction set
Table of Contents

Advertisement

OVM
PM
Repeat
Example
; Calculate sum of product using 32-bit multiply and retain
; high result:
; int32 X[N];
; int32 C[N];
; int32 sum = 0;
; for(i=0; i < N; i++)
;
sum = sum + ((X[i] * C[i]) >> 32) >> 5;
MOVL
MOVL
SPM
ZAPA
RPT
||QMACL
ADDL
MOVL
If overflow mode bit is set; then the ACC value will saturate maximum
positive (0x7FFFFFFF) or maximum negative (0x80000000) if the operation
overflowed.
The value in the PM bits sets the shift mode for the output operation from the
product register. If the product shift value is positive (logical left shift
operation), then the low bits are zero filled. If the product shift value is
negative (arithmetic right shift operation), the upper bits are sign extended.
This instruction is repeatable. If the operation follows a RPT instruction, then
it will be executed N+1 times. The state of the Z, N, C and OVC flags will
reflect the final result in the ACC. The V flag will be set if an intermediate
overflow occurs in the ACC.
// Data information
// Coefficient information (located in low 4M)
XAR2,#X
XAR7,#C
−5
#(N−1)
P,*XAR2++,*XAR7++
ACC,P << PM
@sum,ACC
; XAR2 = pointer to X
; XAR7 = pointer to C
; Set product shift to ">> 5"
; Zero ACC, P, OVC
; Repeat next instruction N times
; ACC = ACC + P >> 5,
; P = (X[i] * C[i]) >> 32
; i++
; Perform final accumulate
; Store final result into sum
QMACL P,loc32,*XAR7/++
6-301

Hide quick links:

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the TMS320C28x and is the answer not in the manual?

Subscribe to Our Youtube Channel

Table of Contents

Save PDF