Texas Instruments TMS320C28x Reference Manual page 178

Dsp cpu and instruction set
Table of Contents

Advertisement

Example
; Calculate signed: Quot16 = Num16/Den16, Rem16 = Num16%Den16
CLRC
MOV
ABSTC
MOV
MOV
ABSTC
MOVU
RPT
||SUBCU
MOV
MOV
NEGTC
MOV
TC
ACC,@Den16 << 16
ACC
T,@AH
ACC,@Num16 << 16
ACC
ACC,@AH
#15
ACC,@T
@Rem16,AH
ACC,@AL << 16
ACC
@Quot16,AH
; Clear TC flag, used as sign flag
; AH = Den16, AL = 0
; Take abs value, TC = sign ^ TC
; Temp save Den16 in T register
; AH = Num16, AL = 0
; Take abs value, TC = sign ^ TC
; AH = 0, AL = Num16
; Repeat operation 16 times
; Conditional subtract with Den16
; Store remainder in Rem16
; AH = Quot16, AL = 0
; Negate if TC = 1
; Store quotient in Quot16
ABSTC ACC
6-21

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