| advertise add site services publishers database health videos | ![]() | about toolbar stats live show health store more stuff JOIN/LOGIN |
West Allis Digital-Imaging, Milwaukee Digital-Imaging, Wauwatosa... wisconsinsmiles.com | Microscope Digital SLR Camera Adaptor |Microscope Digital SLR Adaptor |... ttimedical.com | Hearing Aids, Digital Hearing aids, Open fit digital hearing aids, Canal... hearingaidscentral.com |
Several algorithms exist to perform division in digital designs. These algorithms fall into two main categories: slow division and fast division. Slow division algorithms produce one digit of the final quotient per iteration. Examples of slow division include restoring, non-performing restoring, non-restoring, and SRT division. Fast division methods start with a close approximation to the final quotient and produce twice as many digits of the final quotient on each iteration. Newton-Raphson and Goldschmidt fall into this category. The following division methods are all based on the form Q = N / D where
[edit] Slow division methodsSlow division methods are all based on a standard recurrence equation: where:
[edit] Restoring divisionRestoring division operates on fixed-point fractional numbers and depends on the following assumptions:
The quotient digits q are formed from the digit set {0,1}. The basic algorithm for binary (radix 2) restoring division is: Non-performing restoring division is similar to restoring division except that the value of [edit] Non-restoring divisionNon-restoring division uses the digit set {−1,1} for the quotient digits instead of {0,1}. The basic algorithm for binary (radix 2) non-restoring division is: P[0] := N i := 0 while i < n do if P[i] >= 0 then q[n-(i+1)] := 1 P[i+1] := 2*P[i] - D else q[n-(i+1)] := -1 P[i+1] := 2*P[i] + D end if i := i + 1 end while Following this algorithm, the quotient is in a non-standard form consisting of digits of −1 and +1. This form needs to be converted to binary to form the final quotient. Example:
[edit] SRT divisionNamed for its creators (Sweeney, Robertson, and Tocher), SRT division is a popular method for division in many microprocessor implementations. SRT division is similar to non-restoring division, but it uses a lookup table based on the dividend and the divisor to determine each quotient digit. The Intel Pentium processor's infamous divider bug was caused by an incorrectly coded lookup table. Five entries that were believed to be theoretically unreachable had been omitted from the more than one thousand table entries. [edit] Fast division methods[edit] Newton–Raphson divisionNewton–Raphson uses Newton's method to converge to the quotient. The strategy of Newton–Raphson is to find the reciprocal of D, and multiply that reciprocal by N to find the final quotient Q. The steps of Newton–Raphson are:
In order to apply Newton's method to find the reciprocal of D, it is necessary to find a function f(X) which has a zero at X = 1 / D. The obvious such function is f(X) = DX − 1, but the Newton–Raphson iteration for this is unhelpful since it cannot be computed without already knowing the reciprocal of D. A function which does work is f(X) = 1 / X − D, for which the Newton–Raphson iteration gives which can be calculated from Xi using only multiplication and subtraction. Assuming the divisor is scaled (by a bit-shift operation) so that 0.5 < D < 1, the initial estimate for the reciprocal of the divisor can be calculated using the following linear approximation: To minimize the maximum of the error of this approximation on interval [0.5,1] one should use steps is enough to calculate the value up to N binary places, for example, S = 4 steps is enough for N = 32 bits and S = 5 steps is enough for N = 64 bits. [edit] Goldschmidt divisionGoldschmidt (after Robert Elliott Goldschmidt)[1] division uses series expansion to converge to the quotient. The strategy of Goldschmidt is to repeatedly multiply the dividend and divisor by a common factor Fi to converge the divisor, D, to 1 as the dividend, N, converges to the quotient Q: The steps for Goldschmidt division are:
Assuming N/D has been scaled so 0 < D < 1, the first factor is:
Multiplying the dividend and divisor by the factor yields: After a sufficient number of iterations k: Q = Nk The Goldschmidt method is used in the divisor of the AMD Athlon CPUs and later models[2],[3]. [edit] Division by a constantDivision by a constant is equivalent to multiplication by its reciprocal. Integer division or modulo by a constant requires some adjustments round the multiply but the transformation is normally a very profitable optimization for a compiler.[4] Divisions by [edit] Rounding errorDue to differences between how decimal and binary represent the same fraction, round-off error can be introduced by division operations due to limited precision. Further information: Floating point [edit] References
|
| ↑ top of page ↑ | about thumbshots |