EasyManuals Logo

Analog Devices adsp-2100 User Manual

Analog Devices adsp-2100
486 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 #450 background imageLoading...
Page #450 background image
B – 7
BDivision Exceptions
Return Values
AR = 16-bit quotient
MR0 = 16-bit remainder
AV flag set if divide would overflow
Altered Registers
AX0, AX1, AR, AF, AY0, AY1, MR, MY0
Computation Time: 30 cycles
}
.ENTRY signed_div, unsigned_div;
signed_div: MR0=AY0,AF=AX0+AY1; {Take divisor’s absolute value}
MR1=AY1, AR=ABS AX0; {See if divisor, dividend have
same magnitude}
test_1: IF NE JUMP test_2; {If divisor non-zero, do test 2}
ASTAT=0x4; {Divide by zero, so overflow}
RTS; {Return to calling program}
test_2: IF NOT AV JUMP test_3; {If divisor 0x8000, then the}
AY0=AY1, AF=ABS AY1; {quotient is simply -AY1}
IF NOT AV JUMP recover_sign;
ASTAT=0x4; {0x8000 divided by 0x8000,}
RTS; {so overflow}
test_3: AF=PASS AF; {Check for division overflow}
IF NE JUMP test_4; {Not equal, jump test 4}
AY0=0x8000; {Quotient equals -1}
ASTAT=0x0; {Clear AS bit of ASTAT}
JUMP recover_sign; {Compute remainder}
test_4: AF=ABS MR1; {Get absolute of dividend}
AR=ABS AX0; {Restore AS bit of ASTAT}
AF=AF-AR; {Check for division overflow}
IF LT JUMP do_divs; {If Divisor>Dividend do divide}
ASTAT=0x4; {Division overflow}
RTS;
Listing B.1 Division Error Routine
(continues on next page)

Table of Contents

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the Analog Devices adsp-2100 and is the answer not in the manual?

Analog Devices adsp-2100 Specifications

General IconGeneral
BrandAnalog Devices
Modeladsp-2100
CategoryComputer Hardware
LanguageEnglish

Related product manuals