ARM INSTRUCTION SET
SC32442B RISC MICROPROCESSOR
3-60
Division and Remainder
A number of divide routines for specific applications are provided in source form as part of the ANSI C library
provided with the ARM Cross Development Toolkit, available from your supplier. A short general purpose divide
routine follows.
; Enter with numbers in Ra and Rb.
MOV
Rcnt,#1
; Bit to control the division.
Div1
CMP
Rb,#0x80000000
; Move Rb until greater than Ra.
CMPCC
Rb,Ra
MOVCC
Rb,Rb,ASL#1
MOVCC
Rcnt,Rcnt,ASL#1
BCC
Div1
MOV
Rc,#0
Div2
CMP
Ra,Rb
; Test for possible subtraction.
SUBCS
Ra,Ra,Rb
; Subtract if ok,
ADDCS
Rc,Rc,Rcnt
; Put relevant bit into result
MOVS
Rcnt,Rcnt,LSR#1
; Shift control bit
MOVNE
Rb,Rb,LSR#1
; Halve unless finished.
BNE
Div2
; Divide result in Rc, remainder in Ra.
Overflow Detection in the ARM920T
1. Overflow in unsigned multiply with a 32-bit result
UMULL
Rd,Rt,Rm,Rn
; 3 to 6 cycles
TEQ
Rt,#0
; +1 cycle and a register
BNE
overflow
2. Overflow in signed multiply with a 32-bit result
SMULL
Rd,Rt,Rm,Rn
; 3 to 6 cycles
TEQ
Rt,Rd ASR#31
; +1 cycle and a register
BNE
overflow
3. Overflow in unsigned multiply accumulate with a 32 bit result
UMLAL
Rd,Rt,Rm,Rn
; 4 to 7 cycles
TEQ
Rt,#0
; +1 cycle and a register
BNE
overflow
4. Overflow in signed multiply accumulate with a 32 bit result
SMLAL
Rd,Rt,Rm,Rn
; 4 to 7 cycles
TEQ
Rt,Rd, ASR#31
; +1 cycle and a register
BNE
overflow
Содержание SC32442B54
Страница 1: ...SC32442B54 USER S MANUAL Revision 1 0 ...
Страница 43: ...PRODUCT OVERVIEW SC32442B RISC MICROPROCESSOR 1 42 NOTES ...
Страница 59: ...PROGRAMMER S MODEL SC32442B RISC MICROPROCESSOR 2 16 NOTES ...
Страница 123: ...ARM INSTRUCTION SET SC32442B RISC MICROPROCESSOR 3 64 NOTES ...
Страница 167: ...THUMB INSTRUCTION SET SC32442B RISC MICROPROCESSOR 4 44 NOTES ...
Страница 187: ...MEMORY CONTROLLER SC32442B RISC MICROPROCESSOR 5 20 NOTES ...
Страница 250: ...DMA SC32442B RISC MICROPROCESSOR 8 14 NOTES ...
Страница 308: ...PWM TIMER SC32442B RISC MICROPROCESSOR 10 20 NOTES ...
Страница 330: ...UART SC32442B RISC MICROPROCESSOR 11 22 NOTES ...
Страница 417: ...SC32442B RISC MICROPROCESSOR LCD CONTROLLER 15 45 NOTES ...
Страница 427: ...ADC AND TOUCH SCREEN INTERFACE SC32442B RISC MICROPROCESSOR 16 10 NOTES ...
Страница 511: ...BUS PRIORITIES SC32442B RISC MICROPROCESSOR 24 2 NOTES ...
Страница 562: ...K5D2G13ACM D075 Revision 1 0 December 2006 7 MCP MEMORY 2Gb 256Mb x8 NAND Flash Memory A Die ...
Страница 599: ...K5D2G13ACM D075 Revision 1 0 December 2006 44 MCP MEMORY 512Mb 16Mb x32 Mobile SDRAM C Die ...