Texas Instruments TMS320C28x Reference Manual page 194

Dsp cpu and instruction set
Table of Contents

Advertisement

ADDL ACC,P << PM
SYNTAX OPTIONS
ADDL ACC,P << PM
Note:
This instruction is an alias for the "MOVA T,loc16" operation with "loc16 = @T" addressing mode.
Operands
ACC
P
<< PM
Description
Flags and
g
Z
Modes
N
C
V
OVC
OVM
PM
Repeat
Example
; Calculate: Y = ((M*X >> 4) + (B << 11)) >> 10
; Y, M, X, B are Q15 values
SPM
−4
SETC SXM
MOV
T,@M
MPY
P,T,@X
MOV
ACC,@B << 11
ADDL ACC,P << PM
MOVH @Y,ACC << 5
0001 0000 1010 1100
Accumulator register
Product register
Product shift mode
Add to the ACC register the contents of the P register, shifted as specified by
the product shift mode (PM):
ACC = ACC + P << PM
After the addition, the Z flag is set if the ACC value is zero, else Z is cleared.
After the addition, the N flag is set if bit 31 of the ACC is 1, else N is cleared.
If the addition generates a carry, C is set; otherwise C is cleared.
If an overflow occurs, V is set; otherwise V is not affected.
If (OVM = 0, disabled) then if the operation generates a positive overflow,
then the counter is incremented and if the operation generates a negative
overflow, then the counter is decremented. If (OVM = 1, enabled) then the
counter is not affected by the operation.
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.
If this operation is repeated, then the instruction will be executed N+1 times.
The state of the Z, N, C flags will reflect the final result. The V flag will be set if
an intermediate overflow occurs. The OVC flag will count intermediate
overflows if overflow mode is disabled.
Add Shifted P to Accumulator
OPCODE
; Set product shift to >> 4
; Enable sign extension mode
; T = M
; P = M * X
; ACC = S:B << 11
; ACC = (M*X >> 4) + (S:B << 11)
; Store Q15 result into Y
ADDL ACC,P << PM
OBJMODE
RPT
CYC
X
Y
N+1
6-37

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