460 likes | 659 Views
Lecture 10. Fast Dividers. Required Reading. Behrooz Parhami, Computer Arithmetic: Algorithms and Hardware Design. Chapter 14, High-Radix Dividers Note errata at: http://www.ece.ucsb.edu/~parhami/text_comp_arit_1ed.htm#errors. Recommended Reading. J-P. Deschamps, G. Bioul, G. Sutter,
E N D
Lecture 10 Fast Dividers
Required Reading Behrooz Parhami, Computer Arithmetic: Algorithms and Hardware Design Chapter 14, High-Radix Dividers Note errata at: http://www.ece.ucsb.edu/~parhami/text_comp_arit_1ed.htm#errors
Recommended Reading J-P. Deschamps, G. Bioul, G. Sutter, Synthesis of Arithmetic Circuits: FPGA, ASIC and Embedded Systems Chapter 6, Arithmetic Operations: Division 6.2.4, SRT Radix-2 Division 6.2.5, SRT Radix-2 Division with Stored Carry Encoding 6.2.6, P-D Diagram 6.2.7, SRT-4 Division Chapter 13, Dividers 13.2.3, SRT Dividers 13.2.4, SRT-4 Divider
Classification of Dividers Array Dividers Dividers by Convergence Sequential Radix-2 High-radix • Restoring • Non-restoring • regular • SRT • regular using carry save adders • SRT using carry save adders
Array Dividers
Unsigned Fractional Division zfrac Dividend .z-1z-2 . . . z-(2k-1)z-2k dfrac Divisor .d-1d-2 . . . d-(k-1) d-k qfrac Quotient .q-1q-2 . . . q-(k-1) q-k sfrac Remainder .000…0s-(k+1) . . . s-(2k-1) s-2k k bits
Integer vs. Fractional Division For Integers: z = q d + s 2-2k z 2-2k = (q 2-k) (d 2-k) + s (2-2k) For Fractions: zfrac = qfrac dfrac + sfrac where zfrac = z 2-2k dfrac = d 2-k qfrac = q 2-k sfrac = s 2-2k
Unsigned Fractional Division Overflow Condition for no overflow: zfrac < dfrac
Sequential Fractional Division Basic Equations s(0) = zfrac s(j) = 2 s(j-1) - q-j dfrac 2k · sfrac = s(k) sfrac = 2-k · s(k)
Restoring Unsigned Fractional Division s(0) = z for j = 1 to k if 2 s(j-1) - d > 0 q-j = 1 s(j) = 2 s(j-1) - d else q-j = 0 s(j) = 2 s(j-1)
Fig. 15.7 Restoring array divider composed of controlledsubtractor cells.
Non-Restoring Unsigned Fractional Division s(-1) = z-d for j = 0 to k-1 if s(j-1) 0 q-j = 1 s(j) = 2 s(j-1) - d else q-j = 0 s(j) = 2 s(j-1) + d end forif s(k-1) 0 q-k = 1 else q-k = 0 Correction step
Fig. 15.8 Nonrestoring array divider built of controlledadd/subtract cells.
Sequential Dividers
Sequential Fractional Division Basic Equations s(0) = zfrac s(j) = 2 s(j-1) - q-j dfrac 2k · sfrac = s(k) sfrac = 2-k · s(k)
Non-restoring Fractional Division s(0) = z for j = 1 to k if2s(j-1) 0 q-j = 1 s(j) = 2 s(j-1) - d else q-j = -1 s(j) = 2 s(j-1) + d end for q = BSD_2’s_comp_conversion(q) Correction_step
Integer Division Correction step We have: z = q d + s We need: sign(s) = sign (z) z = (q-1) d + (s+d) z = q’ d + s’ z = (q+1) d + (s-d) z = q” d + s”
Fractional Division Correction step We have: zfrac = qfrac dfrac + sfrac We need: sign(sfrac) = sign(zfrac) zfrac = (qfrac–2-k) dfrac + (sfrac+dfrac 2-k) zfrac = q’frac dfrac + s’frac zfrac = (qfrac+2-k) dfrac + (sfrac –dfrac 2-k) zfrac = q”frac dfrac + s”frac
Non-restoring Fractional Division s(0) = z for j = 1 to k if2s(j-1) 0 q-j = 1 s(j) = 2 s(j-1) - d else q-j = -1 s(j) = 2 s(j-1) + d end for q = BSD_2’s_comp_conversion(q) Correction_step
Fig. 14.3 The new partial remainder, s(j), as a function of the shifted old partial remainder, 2s(j–1), in radix-2 nonrestoring division.
Fig. 14.4 The new partial remainder s(j) as a function of 2s(j–1), with q–j in {–1, 0, 1}.
Non-restoring Fractional Division with shifting over zeros s(0) = z for j = 1 to k if2s(j-1) d q-j = 1 s(j) = 2 s(j-1) - d elseif 2s(j-1) < -d q-j = -1 s(j) = 2 s(j-1) + d else q-j = 0 s(j) = 2 s(j-1) end for Conversion of q Correction step
SRT Non-Restoring Fractional Division Assumptions d 1/2 (positive, bit-normalized divider) -d ≤ -1/2 ≤ z, s(j) < 1/2 < d If the latter condition not true: z = z >> 1 perform k+1 instead of k steps of the algorithm q = q << 1 and s = s << 1 z’=z/2 and z’=q’·d + s’ z = 2z’ = (2q’) ·d + 2s’=q ·d + s
Fig. 14.5 The relationship between new and old partial remainders in radix-2 SRT division.
SRT Non-Restoring Fractional Division s(0) = z for j = 1 to k if2s(j-1) 1/2 q-j = 1 s(j) = 2 s(j-1) - d elseif 2s(j-1) < -1/2 q-j = -1 s(j) = 2 s(j-1) + d else q-j = 0 s(j) = 2 s(j-1) end for Conversion of q Correction step
Sequential Dividers with Carry-Save Adders
Fig. 14.8 Block diagram of a radix-2 divider with partialremainder in stored-carry form.
1 2 Using Carry-Save Adders with the Dividers sum = u = u1u0.u-1u-2u-3u-4….u-k carry = v = v1v0.v-1v-2v-3v-4….v-k t = u1u0.u-1u-2 + v1v0.v-1v-2 u + v - t = 00.00u-3u-4….u-k + 00.00v-3v-4….v-k < 0
1 1 1 1 1 2 2 2 2 2 Using Carry-Save Adders with the Dividers - 0 t - t < - t < 0 t 0 - u+v < u+v 0 u+v < 0 q-j = -1 q-j = 0 q-j = 1
Fig. 14.7 Constant thresholds used for quotient digitselection in radix-2 division with qk–j in {–1, 0, 1}.
p-d Plot for Radix-2 Division Fig. 14.10 A p-d plot for radix-2 division with d[1/2,1), partial remainder in[–d, d), and quotient digits in [–1, 1].
High-Radix Sequential Dividers
New Versus Shifted Old Partial Remainder in Radix-4 Division Radix-4 fractional division with left shifts and q–j [–3, 3] s(j) = 4s(j–1)– q–jd with s(0) = z and s(k) = 4ks |–shift–| |––subtract––| Two difficulties: How do you choose from among the 7 possible values for q-j? If the choice is +3 or -3, how do you form 3d?
p-d Plot for Radix-4 SRT Division with Digit Set [-3,3] Fig. 14.12 A p-d plot for radix-4 SRT division with quotient digit set [–3, 3].
Radix-4 SRT Divider with the Digit Set {-2, -1, 0, 1, 2} Radix-4 fractional division with left shifts and q–j [–2, 2] s(j) = 4s(j–1)– q–jd with s(0) = z and s(k) = 4ks |–shift–| |––subtract––| Fig. 14.13 New versus shifted old partial remainder in radix-4 division with q–j in [–2, 2]. For this restriction to be feasible, we must have: s [-hd, hd) for some h < 1, and 4hd – 2dhd This yields h 2/3 (choose h = 2/3 to minimize the restriction)
p-d Plot for Radix-4 SRT Division with Digit Set [-2,2] Fig. 14.14 A p-d plot for radix-4 SRT division with quotient digit set [–2, 2].
Radix r Divider Process to derive the details: Radix r Digit set [–, ] for q–j Number of bits of p (v and u) and d to be inspected Quotient digit selection unit (table or logic) Multiple generation/selection scheme Conversion of redundant q to 2’s complement Fig. 14.15 Block diagram of radix-r divider with partial remainder in stored-carry form.
Multiply/Divide Unit
Multiply-Divide Unit The control unit proceeds through necessary steps for multiplication or division (including using the appropriate shift direction) The slight speed penalty owing to a more complex control unit is insignificant Fig. 15.9 Sequential radix-2 multiply/divide unit.