Example
; Add 64-bit VarA, VarB and VarC, sat and store result in VarD:
ZAP
MOVL
ADDUL P,@VarB+0
ADDUL P,@VarC+0
MOVU
MOVB
ZAP
ADDL
ADDL
ADDL
SAT64 ACC:P
MOVL
MOVL
OVC
; Clear overflow counter
P,@VarA+0
; Load P with low 32-bits of VarA
; Add to P unsigned low 32-bits of VarB
; Add to P unsigned low 32-bits of VarC
@AL,OVC
; Store overlow (repeated carry) in the ACC
; and then add higher portion of the 64 bit
; variables
AH,#0
; Store overlow (repeated carry) in the ACC
; and then add higher portion of the 64 bit
; variables
OVC
; Clear overflow counter
ACC,@VarA+2
; Add to ACC with carry high 32-bits of VarA
ACC,@VarB+2
; Add to ACC with carry high 32-bits of VarB
ACC,@VarC+2
; Add to ACC with carry high 32-bits of VarC
; Saturate ACC:P based on OVC value
@VarD+0,P
; Store low 32-bit result into VarD
@VarD+2,ACC
; Store high 32-bit result into VarD
SAT64 ACC:P
6-315
Need help?
Do you have a question about the TMS320C28x and is the answer not in the manual?