6.7 DIVFP2 (Division (FP2 Compatible))
● Calculation results are stored as follows according to the operation unit [i].
US·SS: (S1) ÷ (S2) → Quotient (D), Remainder (SD15)
UL·SL: (S1+1, S1) ÷ (S2+1, S2) → Quotient (D+1, D), Remainder (SD16, SD15)
● When an interrupt PB and interrupt program (INTPG) occur, SD15 and SD16 will be
automatically removed and then returned.
Therefore, SD15 and SD16 will not lose their contents being operated in the main program
even if the main program is interrupted by other programs containing this command. But
remember to complete using SD15 and SD16 by the end of the interrupt program.
■
Processing
Divide the calculation target data 1 by the target data 2, and set the calculation result data and
remainder.
Example 1) Operation unit: 16 bits (US, SS)
[S1]...DT2 [S2]...DT1 [D]...DT3
Example 2) Operation unit: 32 bits (UL, SL)
[S1]...DT6 [S2]...DT2 [D]...DT20
■
Precautions for programming
When a division overflow occurs, the data is output as follows. (In the case of the minimum
negative number/-1)
Operation unit SS:
Operation unit SL:
■
Flag operations
Name
SR7
SR8
6-16
[S1] = -32768(H8000)
[D] = -32768(H8000)
[S1+1, S1] = -2147483648(H80000000)
[D+1, D] =2147483648(H80000000)
Description
To be set in case of out-of-range values in indirect access (index modification).
To be set when '0' is specified for [S2].
[S2] = -1(HFFFF)
[SD15] = 0(H0000)
[S2+1, S2] = -1(HFFFFFFFF)
[SD16, SD15] =0(H00000000)
WUME-FP7CPUPGR-12