Rev. 1.50, 10/04, page 230 of 448
10.1.17 DIV1 (Divide 1 Step): Arithmetic Instruction
Format
Operation
Instruction Code
Cycle
T Bit
DIV1 Rm,Rn
1-step division
(Rn ÷ Rm)
0011nnnnmmmm0100
1
Result of
calculation
Description:
This instruction performs 1-digit division (1-step division) of the 32-bit contents of
general register Rn (dividend) by the contents of Rm (divisor). The quotient is obtained by
repeated execution of this instruction alone or in combination with other instructions. The
specified registers and the M, Q, and T bits must not be modified during these repeated
executions.
In 1-step division, the dividend is shifted 1 bit to the left, the divisor is subtracted from this, and
the quotient bit is reflected in the Q bit according to whether the result is positive or negative.
The remainder can be found as follows after first finding the quotient using the DIV1 instruction:
(Remainder) = (dividend) – (divisor)
×
(quotient)
Detection of division by zero or overflow is not provided. Check for division by zero and overflow
division before executing the division. A remainder operation is not provided. Find the remainder
by finding the product of the divisor and the obtained quotient, and subtracting this value from the
dividend.
Initial settings should first be made with the DIV0S or DIV0U instruction. DIV1 is executed once
for each bit of the divisor. If a quotient of more than 17 bits is required, place an ROTCL
instruction before the DIV1 instruction. See the examples for details of the division sequence.
Notes:
None
Operation:
DIV1(long m, long n) /* DIV1 Rm,Rn */
{
unsigned long tmp0, tmp2;
unsigned char old_q, tmp1;
old_q = Q;
Q = (unsigned char)((0x80000000 & R[n])!=0);
tmp2 = R[m];
R[n] <<= 1;
R[n] |= (unsigned long)T;
Содержание SuperH SH-4A
Страница 2: ...Rev 1 50 10 04 page ii of xx ...
Страница 8: ...Rev 1 50 10 04 page viii of xx ...
Страница 116: ...Rev 1 50 10 04 page 96 of 448 ...
Страница 178: ...Rev 1 50 10 04 page 158 of 448 ...
Страница 206: ...Rev 1 50 10 04 page 186 of 448 ...
Страница 231: ...Rev 1 50 10 04 page 211 of 448 Possible Exceptions Slot illegal instruction exception ...
Страница 235: ...Rev 1 50 10 04 page 215 of 448 Possible Exceptions Slot illegal instruction exception ...
Страница 238: ...Rev 1 50 10 04 page 218 of 448 Possible Exceptions Slot illegal instruction exception ...
Страница 408: ...Rev 1 50 10 04 page 388 of 448 Possible Exceptions Inexact Not generated when FPSCR PR 1 ...
Страница 445: ...Rev 1 50 10 04 page 425 of 448 Possible Exceptions Invalid operation Overflow Underflow Inexact ...
Страница 446: ...Rev 1 50 10 04 page 426 of 448 ...
Страница 468: ...Rev 1 50 10 04 page 448 of 448 ...
Страница 471: ......
Страница 472: ...SH 4A Software Manual ...