EasyManuals Logo

Texas Instruments TMS320C28x User Manual

Texas Instruments TMS320C28x
695 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Page #505 background imageLoading...
Page #505 background image
SUBCUL ACC,loc32
6-348
Example 1
; Calculate unsigned: Quot32 = Num32/Den32, Rem32 = Num32%Den32
MOVB ACC,#0 ; Zero ACC
MOVL P,@Num32 ; Load P register with Num32
RPT #31 ; Repeat operation 32 times
||SUBCUL ACC,@Den32 ; Conditional subtract with Den32
MOVL @Rem32,ACC ; Store remainder in Rem32
MOVL @Quot32,P ; Store quotient in Quot32
Example 2
; Calculate signed: Quot32 = Num32/Den32, Rem32 = Num32%Den32
CLRC TC ; Clear TC flag, used as sign flag
MOVL ACC,@Den32 ; Load ACC with contents of Den32
ABSTC ACC ; Take absolute value, TC = sign ^ TC
MOVL XT,@ACC ; Temp save denominator in XT register
MOVL ACC,@Num32 ; Load ACC register with Num32
ABSTC ACC ; Take abs value, TC = sign ^ TC
MOVL P,@ACC ; Load P register with numerator
MOVB ACC,#0 ; Zero ACC
RPT #31 ; Repeat operation 32 times
||SUBCUL ACC,@XT ; Conditional subtract with denominator
MOVL @Rem32,ACC ; Store remainder in Rem32
MOVL ACC,@P ; Load ACC with quotient
NEGTC ACC ; Negate ACC if TC=1 (negative result)
MOVL @Quot32,ACC ; Store quotient in Quot32
Example 3
; Calculate unsigned: Quot64 = Num64Den32, Rem32 = Num64%Den32
MOVB ACC,#0 ; Zero ACC
MOVL P,@Num64+2 ; Load P with high 32-bits of Num64
RPT #31 ; Repeat operation 32 times
||SUBCUL ACC,@Den32 ; Conditional subtract with Den32
MOVL @Quot64+2,P ; Store high 32 bit quotient in Quot64
MOVL P,@Num64+0 ; Load P with low 32-bits of Num64
RPT #31 ; Repeat operation 32 times
||SUBCUL ACC,@Den32 ; Conditional subtract with Den32
MOVL @Rem32,ACC ; Store remainder in Rem32
MOVL @Quot64+0,P ; Store low 32 bit quotient in Quot64

Table of Contents

Questions and Answers:

Question and Answer IconNeed help?

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

Texas Instruments TMS320C28x Specifications

General IconGeneral
BrandTexas Instruments
ModelTMS320C28x
CategoryProcessor
LanguageEnglish

Related product manuals