11.07.2015 Views

section 7 - Index of

section 7 - Index of

section 7 - Index of

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

DIV Divide Interation DIVThe DIV instruction calculates one quotient bit based on the divisor and the previous partialremainder. To produce an N-bit quotient, the DIV instruction is executed N timeswhere N is the number <strong>of</strong> bits <strong>of</strong> precision desired in the quotient, 1 ;leN;le24. Thus, for afull-precision (24 bit) quotient, 24 DIV iterations are required. In general, executing theDIV instruction N times produces an N-bit quotient and a 48-bit remainder which has(48-N) bits <strong>of</strong> precision and whose N MS bits are zeros. The partial remainder is not atrue remainder and must be corrected due to the nonrestoring nature <strong>of</strong> the division algorithmbefore it may be used. Therefore, once the divide is complete, it is necessary toreverse the last DIV operation and restore the remainder to obtain the true remainder.The DIV instruction uses a nonrestoring fractional division algorithm which consists <strong>of</strong>the following operations (see the previous Operation diagram):1. Compare the source and destination operand sign bits: An exclusive ORoperation is performed on bit 55 <strong>of</strong> the destination operand D and bit 23 <strong>of</strong> thesource operand S;2. Shift the partial remainder and the quotient: The 55-bit destination accumulatorD is shifted one bit to the left. The carry bit C is moved into the LS bit (bit0) <strong>of</strong> the accumulator;3. Calculate the next quotient bit and the new partial remainder: The 24-bitsource operand S (signed divisor) is either added to or subtracted from theMSP portion <strong>of</strong> the destination accumulator (A1 or 81), and the result is storedback into the MSP portion <strong>of</strong> that destination accumulator. If the result <strong>of</strong> theexclusive OR operation previously described was a "1" (Le., the sign bits weredifferent), the source operand S is added to the accumulator. If the result <strong>of</strong> theexclusive OR operation was a "0" (Le., the sign bits were the same), thesource operand S is subtracted from the accumulator. Due to the automaticsign extension <strong>of</strong> the 24-bit signed divisor, the addition or subtraction operationcorrectly sets the carry bit C <strong>of</strong> the condition code register with the nextquotient bit.-

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!