Instructions
www.ti.com
Example
Calculate Y = A/B. A fast division routine similar to that shown below can be found in the
C28x FPU Fast RTS Library
).
MOVL
XAR4, #A
MOV32 R0H,
*XAR4
; Load R0H with A
MOVL
XAR4, #B
MOV32 R1H,
*XAR4
; Load R1H with B
LCR
DIV
; Calculate R0H = R0H / R1H
MOV32 *XAR4, R0H
;
....
DIV:
EINVF32
R2H, R1H
; R2H = Ye = Estimate(1/B)
CMPF32
R0H, #0.0
; Check if A == 0
MPYF32
R3H, R2H, R1H
; R3H = Ye*B
NOP
SUBF32
R3H, #2.0, R3H
; R3H = 2.0 - Ye*B
NOP
MPYF32
R2H, R2H, R3H
; R2H = Ye = Ye*(2.0 - Ye*B)
NOP
MPYF32
R3H, R2H, R1H
; R3H = Ye*B
CMPF32
R1H, #0.0
; Check if B == 0.0
SUBF32
R3H, #2.0, R3H
; R3H = 2.0 - Ye*B
NEGF32
R0H, R0H, EQ
; Fixes sign for A/0.0
MPYF32
R2H, R2H, R3H
; R2H = Ye = Ye*(2.0 - Ye*B)
NOP
MPYF32
R0H, R0H, R2H
; R0H = Y = A*Ye = A/B
LRETR
See also
Instruction Set
48
SPRUEO2A – June 2007 – Revised August 2008
Summary of Contents for TMS320C28 series
Page 2: ...2 SPRUEO2A June 2007 Revised August 2008 Submit Documentation Feedback ...
Page 12: ...Introduction 12 SPRUEO2A June 2007 Revised August 2008 Submit Documentation Feedback ...
Page 20: ...CPU Register Set 20 SPRUEO2A June 2007 Revised August 2008 Submit Documentation Feedback ...
Page 136: ...Instruction Set 136 SPRUEO2A June 2007 Revised August 2008 Submit Documentation Feedback ...