![Page 1: Advanced Dividers Lecture 10. Required Reading Chapter 13, Basic Division Schemes 13.4, Non-Restoring and Signed Division Chapter 15 Variation in Dividers](https://reader035.vdocuments.net/reader035/viewer/2022070413/5697bf931a28abf838c8f5a0/html5/thumbnails/1.jpg)
Advanced Dividers
Lecture 10
![Page 2: Advanced Dividers Lecture 10. Required Reading Chapter 13, Basic Division Schemes 13.4, Non-Restoring and Signed Division Chapter 15 Variation in Dividers](https://reader035.vdocuments.net/reader035/viewer/2022070413/5697bf931a28abf838c8f5a0/html5/thumbnails/2.jpg)
Required Reading
Chapter 13, Basic Division Schemes13.4, Non-Restoring and Signed Division
Chapter 15 Variation in Dividers15.6, Combined Multiply/Divide Units15.3, Combinational and Array Dividers
Chapter 16, Division by Convergence
Behrooz Parhami, Computer Arithmetic: Algorithms and Hardware Design
![Page 3: Advanced Dividers Lecture 10. Required Reading Chapter 13, Basic Division Schemes 13.4, Non-Restoring and Signed Division Chapter 15 Variation in Dividers](https://reader035.vdocuments.net/reader035/viewer/2022070413/5697bf931a28abf838c8f5a0/html5/thumbnails/3.jpg)
May 2012 Computer Arithmetic, Division Slide 3
Division versus MultiplicationDivision is more complex than multiplication: Need for quotient digit selection or estimation
Overflow possibility: the high-order k bits of z must be strictly less than d; this overflow check also detects the divide-by-zero condition.
Pentium III latenciesInstruction Latency Cycles/IssueLoad / Store 3 1Integer Multiply 4 1Integer Divide 36 36Double/Single FP Multiply 5 2Double/Single FP Add 3 1Double/Single FP Divide 38 38
The ratios haven’t changed much in later Pentiums, Atom, or AMD products*
*Source: T. Granlund, “Instruction Latencies and Throughput for AMD and Intel x86 Processors,” Feb. 2012
![Page 4: Advanced Dividers Lecture 10. Required Reading Chapter 13, Basic Division Schemes 13.4, Non-Restoring and Signed Division Chapter 15 Variation in Dividers](https://reader035.vdocuments.net/reader035/viewer/2022070413/5697bf931a28abf838c8f5a0/html5/thumbnails/4.jpg)
4
Classification of Dividers
Sequential
Radix-2 High-radix
RestoringNon-restoring
• regular• SRT• using carry save adders• SRT using carry save adders
ArrayDividers
Dividersby Convergence
![Page 5: Advanced Dividers Lecture 10. Required Reading Chapter 13, Basic Division Schemes 13.4, Non-Restoring and Signed Division Chapter 15 Variation in Dividers](https://reader035.vdocuments.net/reader035/viewer/2022070413/5697bf931a28abf838c8f5a0/html5/thumbnails/5.jpg)
Notation and
Basic Equations
![Page 6: Advanced Dividers Lecture 10. Required Reading Chapter 13, Basic Division Schemes 13.4, Non-Restoring and Signed Division Chapter 15 Variation in Dividers](https://reader035.vdocuments.net/reader035/viewer/2022070413/5697bf931a28abf838c8f5a0/html5/thumbnails/6.jpg)
6
Notation
z Dividend z2k-1z2k-2 . . . z2 z1 z0
d Divisor dk-1dk-2 . . . d1 d0
q Quotient qk-1qk-2 . . . q1 q0
s Remainder sk-1sk-2 . . . s1 s0
(s = z - dq)
![Page 7: Advanced Dividers Lecture 10. Required Reading Chapter 13, Basic Division Schemes 13.4, Non-Restoring and Signed Division Chapter 15 Variation in Dividers](https://reader035.vdocuments.net/reader035/viewer/2022070413/5697bf931a28abf838c8f5a0/html5/thumbnails/7.jpg)
7
Basic Equations of Division
z = d q + s
sign(s) = sign(z)
| s | < | d |
z > 00 s < | d |
z < 0- | d | < s 0
![Page 8: Advanced Dividers Lecture 10. Required Reading Chapter 13, Basic Division Schemes 13.4, Non-Restoring and Signed Division Chapter 15 Variation in Dividers](https://reader035.vdocuments.net/reader035/viewer/2022070413/5697bf931a28abf838c8f5a0/html5/thumbnails/8.jpg)
8
Sequential Integer DivisionBasic Equations
s(0) = z
s(j) = 2 s(j-1) - qk-j (2k d) for j=1..k
s(k) = 2k s
![Page 9: Advanced Dividers Lecture 10. Required Reading Chapter 13, Basic Division Schemes 13.4, Non-Restoring and Signed Division Chapter 15 Variation in Dividers](https://reader035.vdocuments.net/reader035/viewer/2022070413/5697bf931a28abf838c8f5a0/html5/thumbnails/9.jpg)
Restoring Unsigned Integer Division
![Page 10: Advanced Dividers Lecture 10. Required Reading Chapter 13, Basic Division Schemes 13.4, Non-Restoring and Signed Division Chapter 15 Variation in Dividers](https://reader035.vdocuments.net/reader035/viewer/2022070413/5697bf931a28abf838c8f5a0/html5/thumbnails/10.jpg)
10
Restoring Unsigned Integer Division
s(0) = z
for j = 1 to k
if 2 s(j-1) - 2k d > 0 qk-j = 1 s(j) = 2 s(j-1) - 2k d else qk-j = 0 s(j) = 2 s(j-1)
![Page 11: Advanced Dividers Lecture 10. Required Reading Chapter 13, Basic Division Schemes 13.4, Non-Restoring and Signed Division Chapter 15 Variation in Dividers](https://reader035.vdocuments.net/reader035/viewer/2022070413/5697bf931a28abf838c8f5a0/html5/thumbnails/11.jpg)
11
Example of restoring unsigned division
![Page 12: Advanced Dividers Lecture 10. Required Reading Chapter 13, Basic Division Schemes 13.4, Non-Restoring and Signed Division Chapter 15 Variation in Dividers](https://reader035.vdocuments.net/reader035/viewer/2022070413/5697bf931a28abf838c8f5a0/html5/thumbnails/12.jpg)
12
Shift/subtract sequential restoring divider
![Page 13: Advanced Dividers Lecture 10. Required Reading Chapter 13, Basic Division Schemes 13.4, Non-Restoring and Signed Division Chapter 15 Variation in Dividers](https://reader035.vdocuments.net/reader035/viewer/2022070413/5697bf931a28abf838c8f5a0/html5/thumbnails/13.jpg)
Non-Restoring Unsigned Integer Division
![Page 14: Advanced Dividers Lecture 10. Required Reading Chapter 13, Basic Division Schemes 13.4, Non-Restoring and Signed Division Chapter 15 Variation in Dividers](https://reader035.vdocuments.net/reader035/viewer/2022070413/5697bf931a28abf838c8f5a0/html5/thumbnails/14.jpg)
Non-Restoring Unsigned Integer Division
s(1) = 2 z - 2k dfor j = 2 to k if s(j-1) 0 qk-(j-1) = 1 s(j) = 2 s(j-1) - 2k d else qk-(j-1) = 0 s(j) = 2 s(j-1) + 2k dend forif s(k) 0 q0 = 1else q0 = 0 Correction step
![Page 15: Advanced Dividers Lecture 10. Required Reading Chapter 13, Basic Division Schemes 13.4, Non-Restoring and Signed Division Chapter 15 Variation in Dividers](https://reader035.vdocuments.net/reader035/viewer/2022070413/5697bf931a28abf838c8f5a0/html5/thumbnails/15.jpg)
15
Non-Restoring Unsigned Integer Division
Correction step
z = q d + s
z = (q-1) d + (s+d)z = q’ d + s’
z, q, d ≥ 0 s<0
s = 2-k · s(k)
![Page 16: Advanced Dividers Lecture 10. Required Reading Chapter 13, Basic Division Schemes 13.4, Non-Restoring and Signed Division Chapter 15 Variation in Dividers](https://reader035.vdocuments.net/reader035/viewer/2022070413/5697bf931a28abf838c8f5a0/html5/thumbnails/16.jpg)
16
Example of nonrestoring unsigned division
![Page 17: Advanced Dividers Lecture 10. Required Reading Chapter 13, Basic Division Schemes 13.4, Non-Restoring and Signed Division Chapter 15 Variation in Dividers](https://reader035.vdocuments.net/reader035/viewer/2022070413/5697bf931a28abf838c8f5a0/html5/thumbnails/17.jpg)
17
Partial remainder variations for restoring andnonrestoring division
![Page 18: Advanced Dividers Lecture 10. Required Reading Chapter 13, Basic Division Schemes 13.4, Non-Restoring and Signed Division Chapter 15 Variation in Dividers](https://reader035.vdocuments.net/reader035/viewer/2022070413/5697bf931a28abf838c8f5a0/html5/thumbnails/18.jpg)
18
s(j) = 2 s(j-1)
s(j+1) = 2 s(j) - 2k d = = 4 s(j-1) - 2k d
s(j) = 2 s(j-1) - 2k d
s(j+1) = 2 s(j) + 2k d = = 2 (2 s(j-1) - 2k d) + 2k d = = 4 s(j-1) - 2k d
Restoring division Non-Restoring division
Non-Restoring Unsigned Integer Division
Justification
s(j-1) ≥ 0 2 s(j-1) - 2k d < 0 2 (2 s(j-1) ) - 2k d ≥ 0
![Page 19: Advanced Dividers Lecture 10. Required Reading Chapter 13, Basic Division Schemes 13.4, Non-Restoring and Signed Division Chapter 15 Variation in Dividers](https://reader035.vdocuments.net/reader035/viewer/2022070413/5697bf931a28abf838c8f5a0/html5/thumbnails/19.jpg)
May 2012 Computer Arithmetic, Division Slide 19
Convergence of the Partial Quotient to q
In restoring division, the partial quotient converges to q from below
Example
(0 1 1 1 0 1 0 1)two / (1 0 1 0)two
(117)ten/(10)ten = (11)ten = (1011)two
In nonrestoring division, the partial quotient may overshoot q, but converges to it after some oscillations 0000
0001
0010
0011
0100
0101
0110
0111
1000
1001
1010
1011
1100
1101
1110
1111Partial quotient
Iteration0 1 2 3 4
q
q(1) q(2)
q(3)
q(4)
q(2)
Restoring
Nonrestoring
q(0)
![Page 20: Advanced Dividers Lecture 10. Required Reading Chapter 13, Basic Division Schemes 13.4, Non-Restoring and Signed Division Chapter 15 Variation in Dividers](https://reader035.vdocuments.net/reader035/viewer/2022070413/5697bf931a28abf838c8f5a0/html5/thumbnails/20.jpg)
Non-RestoringSigned Integer Division
![Page 21: Advanced Dividers Lecture 10. Required Reading Chapter 13, Basic Division Schemes 13.4, Non-Restoring and Signed Division Chapter 15 Variation in Dividers](https://reader035.vdocuments.net/reader035/viewer/2022070413/5697bf931a28abf838c8f5a0/html5/thumbnails/21.jpg)
21
Non-Restoring Signed Integer Division
s(0) = zfor j = 1 to k if sign(s(j-1)) == sign(d) qk-j = 1 s(j) = 2 s(j-1) - 2k d = 2 s(j-1) - qk-j (2k d) else qk-j = -1 s(j) = 2 s(j-1) + 2k d = 2 s(j-1) - qk-j (2k d) q = BSD_2’s_comp_conversion(q)Correction_step
![Page 22: Advanced Dividers Lecture 10. Required Reading Chapter 13, Basic Division Schemes 13.4, Non-Restoring and Signed Division Chapter 15 Variation in Dividers](https://reader035.vdocuments.net/reader035/viewer/2022070413/5697bf931a28abf838c8f5a0/html5/thumbnails/22.jpg)
22
Non-Restoring Signed Integer Division
Correction step
z = q d + s
z = (q-1) d + (s+d)z = q’ d + s’
z = (q+1) d + (s-d)z = q” d + s”
s = 2-k · s(k)
sign(s) = sign(z)
![Page 23: Advanced Dividers Lecture 10. Required Reading Chapter 13, Basic Division Schemes 13.4, Non-Restoring and Signed Division Chapter 15 Variation in Dividers](https://reader035.vdocuments.net/reader035/viewer/2022070413/5697bf931a28abf838c8f5a0/html5/thumbnails/23.jpg)
23
Example of nonrestoring signed division========================z 0 0 1 0 0 0 0 124d 1 1 0 0 1 –24d 0 0 1 1 1 ========================s(0) 0 0 0 1 0 0 0 0 1 2s(0) 0 0 1 0 0 0 0 1 sign(s(0)) sign(d),+24d 1 1 0 0 1 so set q3 = 1 and add––––––––––––––––––––––––s(1) 1 1 1 0 1 0 0 1 2s(1) 1 1 0 1 0 0 1 sign(s(1)) = sign(d), +(–24d) 0 0 1 1 1 so set q2 = 1 and subtract––––––––––––––––––––––––s(2) 0 0 0 0 1 0 1 2s(2) 0 0 0 1 0 1 sign(s(2)) sign(d),+24d 1 1 0 0 1 so set q1 = 1 and add––––––––––––––––––––––––s(3) 1 1 0 1 1 1 2s(3) 1 0 1 1 1 sign(s(3)) = sign(d), +(–24d) 0 0 1 1 1 so set q0 = 1 and subtract––––––––––––––––––––––––s(4) 1 1 1 1 0 sign(s(4)) sign(z),+(–24d) 0 0 1 1 1 so perform corrective subtraction––––––––––––––––––––––––s(4) 0 0 1 0 1 s 0 1 0 1 q
1 11 1 ========================
p = 0 1 0 1 Shift, compl MSB 1 1 0 1 1 Add 1 to correct 1 1 0 0 Check: 33/(7) = 4
![Page 24: Advanced Dividers Lecture 10. Required Reading Chapter 13, Basic Division Schemes 13.4, Non-Restoring and Signed Division Chapter 15 Variation in Dividers](https://reader035.vdocuments.net/reader035/viewer/2022070413/5697bf931a28abf838c8f5a0/html5/thumbnails/24.jpg)
24
BSD 2’s Complement Conversion
q = (qk-1 qk-2 . . . q1 q0)BSD =
= (pk-1 pk-2 . . . p1 p0 1)2’s complement
where
piqi
-1 011
Example:
1 -1 1 1qBSD
p
q2’scomp
1 0 1 1
0 0 1 1 1 = 0 1 1 1
no overflow if pk-2 = pk-1 (qk-1 qk-2)
![Page 25: Advanced Dividers Lecture 10. Required Reading Chapter 13, Basic Division Schemes 13.4, Non-Restoring and Signed Division Chapter 15 Variation in Dividers](https://reader035.vdocuments.net/reader035/viewer/2022070413/5697bf931a28abf838c8f5a0/html5/thumbnails/25.jpg)
May 2012 Computer Arithmetic, Division Slide 25
Nonrestoring Hardware Divider
Quotient
k
Partial Remainder
Divisor
add/sub
k-bit adder
k
cout cin
Complement
qk–j 2s (j–1)MSB of
Divisor Sign
Complement of Partial Remainder Sign
![Page 26: Advanced Dividers Lecture 10. Required Reading Chapter 13, Basic Division Schemes 13.4, Non-Restoring and Signed Division Chapter 15 Variation in Dividers](https://reader035.vdocuments.net/reader035/viewer/2022070413/5697bf931a28abf838c8f5a0/html5/thumbnails/26.jpg)
26
Multiply/DivideUnit
![Page 27: Advanced Dividers Lecture 10. Required Reading Chapter 13, Basic Division Schemes 13.4, Non-Restoring and Signed Division Chapter 15 Variation in Dividers](https://reader035.vdocuments.net/reader035/viewer/2022070413/5697bf931a28abf838c8f5a0/html5/thumbnails/27.jpg)
27
The control unit proceeds through necessary steps for multiplication or division (including using the appropriate shift direction)
Fig. 15.9 Sequential radix-2 multiply/divide unit.
Multiplier x or quotient q
Mux
Adder out c
0 1
Partial product p or partial remainder s
Multiplicand a or divisor d
Shift control
Shift
Enable
in c
q k–j
MSB of 2s (j–1)
k
k
k
j x
MSB of p (j+1)
Divisor sign
Multiply/ divide control
Select
Mul Div
The slight speed penalty owing to a more complex control unit is insignificant
Multiply-Divide Unit
![Page 28: Advanced Dividers Lecture 10. Required Reading Chapter 13, Basic Division Schemes 13.4, Non-Restoring and Signed Division Chapter 15 Variation in Dividers](https://reader035.vdocuments.net/reader035/viewer/2022070413/5697bf931a28abf838c8f5a0/html5/thumbnails/28.jpg)
Fractional Division
![Page 29: Advanced Dividers Lecture 10. Required Reading Chapter 13, Basic Division Schemes 13.4, Non-Restoring and Signed Division Chapter 15 Variation in Dividers](https://reader035.vdocuments.net/reader035/viewer/2022070413/5697bf931a28abf838c8f5a0/html5/thumbnails/29.jpg)
29
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-2kk bits
![Page 30: Advanced Dividers Lecture 10. Required Reading Chapter 13, Basic Division Schemes 13.4, Non-Restoring and Signed Division Chapter 15 Variation in Dividers](https://reader035.vdocuments.net/reader035/viewer/2022070413/5697bf931a28abf838c8f5a0/html5/thumbnails/30.jpg)
30
Integer vs. Fractional Division
For Integers:
z = q d + s 2-2k
z 2-2k = (q 2-k) (d 2-k) + s (2-2k)
zfrac = qfrac dfrac + sfrac
For Fractions:
wherezfrac = z 2-2k
dfrac = d 2-k
qfrac = q 2-k
sfrac = s 2-2k
![Page 31: Advanced Dividers Lecture 10. Required Reading Chapter 13, Basic Division Schemes 13.4, Non-Restoring and Signed Division Chapter 15 Variation in Dividers](https://reader035.vdocuments.net/reader035/viewer/2022070413/5697bf931a28abf838c8f5a0/html5/thumbnails/31.jpg)
31
Unsigned Fractional Division Overflow
Condition for no overflow:
zfrac < dfrac
![Page 32: Advanced Dividers Lecture 10. Required Reading Chapter 13, Basic Division Schemes 13.4, Non-Restoring and Signed Division Chapter 15 Variation in Dividers](https://reader035.vdocuments.net/reader035/viewer/2022070413/5697bf931a28abf838c8f5a0/html5/thumbnails/32.jpg)
32
Sequential Fractional DivisionBasic Equations
s(0) = zfrac
s(j) = 2 s(j-1) - q-j dfrac for j=1..k
2k · sfrac = s(k)
sfrac = 2-k · s(k)
![Page 33: Advanced Dividers Lecture 10. Required Reading Chapter 13, Basic Division Schemes 13.4, Non-Restoring and Signed Division Chapter 15 Variation in Dividers](https://reader035.vdocuments.net/reader035/viewer/2022070413/5697bf931a28abf838c8f5a0/html5/thumbnails/33.jpg)
33
Fig. 13.2 Examples of sequential division with integer and fractional operands.
![Page 34: Advanced Dividers Lecture 10. Required Reading Chapter 13, Basic Division Schemes 13.4, Non-Restoring and Signed Division Chapter 15 Variation in Dividers](https://reader035.vdocuments.net/reader035/viewer/2022070413/5697bf931a28abf838c8f5a0/html5/thumbnails/34.jpg)
34
ArrayDividers
![Page 35: Advanced Dividers Lecture 10. Required Reading Chapter 13, Basic Division Schemes 13.4, Non-Restoring and Signed Division Chapter 15 Variation in Dividers](https://reader035.vdocuments.net/reader035/viewer/2022070413/5697bf931a28abf838c8f5a0/html5/thumbnails/35.jpg)
35
Sequential Fractional DivisionBasic Equations
sfrac(0) = zfrac
s(j) = 2 s(j-1) - q-j dfrac
s(k)frac
= 2k sfrac
![Page 36: Advanced Dividers Lecture 10. Required Reading Chapter 13, Basic Division Schemes 13.4, Non-Restoring and Signed Division Chapter 15 Variation in Dividers](https://reader035.vdocuments.net/reader035/viewer/2022070413/5697bf931a28abf838c8f5a0/html5/thumbnails/36.jpg)
36
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)
![Page 37: Advanced Dividers Lecture 10. Required Reading Chapter 13, Basic Division Schemes 13.4, Non-Restoring and Signed Division Chapter 15 Variation in Dividers](https://reader035.vdocuments.net/reader035/viewer/2022070413/5697bf931a28abf838c8f5a0/html5/thumbnails/37.jpg)
May 2012 Computer Arithmetic, Division Slide 37
Restoring Array Divider
z
z
–5
–6
s s s –4 –5 –6
q
q
q
–1
–2
–3
FS
Cell
z z z z–1 –2 –3 –4
1 0
d d d –1 –2 –3
0
0
0
–1 –2 –3 –4 –5 –6 –1 –2 –3 –1 –2 –3 –4 –5 –6
Dividend z = .z z z z z z Divisor d = .d d d Quotient q = .q q q Remainder s = .0 0 0 s s s
![Page 38: Advanced Dividers Lecture 10. Required Reading Chapter 13, Basic Division Schemes 13.4, Non-Restoring and Signed Division Chapter 15 Variation in Dividers](https://reader035.vdocuments.net/reader035/viewer/2022070413/5697bf931a28abf838c8f5a0/html5/thumbnails/38.jpg)
38
Non-Restoring Unsigned Fractional Division
s(-1) = z-dfor 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) + dend forif s(k-1) > 0 q-k = 1else
q-k = 0
![Page 39: Advanced Dividers Lecture 10. Required Reading Chapter 13, Basic Division Schemes 13.4, Non-Restoring and Signed Division Chapter 15 Variation in Dividers](https://reader035.vdocuments.net/reader035/viewer/2022070413/5697bf931a28abf838c8f5a0/html5/thumbnails/39.jpg)
May 2012 Computer Arithmetic, Division Slide 39
Nonrestoring Array Divider
Dividend z = z .z z z z z z Divisor d = d .d d d Quotient q = q .q q q Remainder s = 0 .0 0 s s s s
0 –1 –2 –3 –4 –5 –6 0 –1 –2 –3 0 –1 –2 –3 –3 –4 –5 –6
z
z
z
–4
–5
–6
s s s s–3 –4 –5 –6
q
q
q
0
–1
–2
q –3
d d d d0 –1 –2 –3z z z z0 –1 –2 –3
FA
XOR
Cell
1
Similarity to array multiplier is deceiving
Critical path
![Page 40: Advanced Dividers Lecture 10. Required Reading Chapter 13, Basic Division Schemes 13.4, Non-Restoring and Signed Division Chapter 15 Variation in Dividers](https://reader035.vdocuments.net/reader035/viewer/2022070413/5697bf931a28abf838c8f5a0/html5/thumbnails/40.jpg)
40
Division by Convergence
![Page 41: Advanced Dividers Lecture 10. Required Reading Chapter 13, Basic Division Schemes 13.4, Non-Restoring and Signed Division Chapter 15 Variation in Dividers](https://reader035.vdocuments.net/reader035/viewer/2022070413/5697bf931a28abf838c8f5a0/html5/thumbnails/41.jpg)
May 2012 Computer Arithmetic, Division Slide 41
Division by Convergence
Chapter Goals
Show how by using multiplication as thebasic operation in each division step,the number of iterations can be reduced
Chapter Highlights
Digit-recurrence as convergence methodConvergence by Newton-Raphson iterationComputing the reciprocal of a numberHardware implementation and fine tuning
![Page 42: Advanced Dividers Lecture 10. Required Reading Chapter 13, Basic Division Schemes 13.4, Non-Restoring and Signed Division Chapter 15 Variation in Dividers](https://reader035.vdocuments.net/reader035/viewer/2022070413/5697bf931a28abf838c8f5a0/html5/thumbnails/42.jpg)
May 2012 Computer Arithmetic, Division Slide 42
16.1 General Convergence MethodsSequential digit-at-a-time (binary or high-radix) division can be viewed as a convergence scheme
As each new digit of q = z / d is determined, the quotient value is refined, until it reaches the final correct value
Digit
0.101101
q
0
1Meanwhile, the remainders = z – q d approaches 0; the scaled remainder is kept in a certain range, such as [– d, d)
Convergence is from below in restoring division and oscillating in nonrestoring division
![Page 43: Advanced Dividers Lecture 10. Required Reading Chapter 13, Basic Division Schemes 13.4, Non-Restoring and Signed Division Chapter 15 Variation in Dividers](https://reader035.vdocuments.net/reader035/viewer/2022070413/5697bf931a28abf838c8f5a0/html5/thumbnails/43.jpg)
May 2012 Computer Arithmetic, Division Slide 43
Elaboration on Scaled Remainder in Division
Quotient digit selection keeps the scaled remainder bounded (say, in the range –d to d) to ensure the convergence of the true remainder to 0
The partial remainder s(j) in division recurrence isn’t the true remainder but a version scaled by 2j
Division with left shifts
s(j) = 2s(j–1) – qk–j (2k d) with s(0) = z and
|–shift–| s(k) = 2ks|––– subtract –––|
Digit
0.101101
q
0
1
![Page 44: Advanced Dividers Lecture 10. Required Reading Chapter 13, Basic Division Schemes 13.4, Non-Restoring and Signed Division Chapter 15 Variation in Dividers](https://reader035.vdocuments.net/reader035/viewer/2022070413/5697bf931a28abf838c8f5a0/html5/thumbnails/44.jpg)
May 2012 Computer Arithmetic, Division Slide 44
Recurrence Formulas for Convergence Methods
u (i+1) = f(u
(i), v (i), w
(i))
v (i+1) = g(u
(i), v (i), w
(i))
w (i+1) = h(u
(i), v (i), w
(i))
u (i+1) = f(u
(i), v (i))
v (i+1) = g(u
(i), v (i))
The complexity of this method depends on two factors:
a. Ease of evaluating f and g (and h) b. Rate of convergence (number of iterations needed)
Constant
Desiredfunction
Guide the iteration such that one of the values converges to a constant (usually 0 or 1)
The other value then converges to the desired function
![Page 45: Advanced Dividers Lecture 10. Required Reading Chapter 13, Basic Division Schemes 13.4, Non-Restoring and Signed Division Chapter 15 Variation in Dividers](https://reader035.vdocuments.net/reader035/viewer/2022070413/5697bf931a28abf838c8f5a0/html5/thumbnails/45.jpg)
May 2012 Computer Arithmetic, Division Slide 45
16.2 Division by Repeated Multiplications
Remainder often not needed, but can be obtained by another multiplication if desired: s = z – qd
Motivation: Suppose add takes 1 clock and multiply 3 clocks64-bit divide takes 64 clocks in radix 2, 32 in radix 4
Divide faster via multiplications faster if 10 or fewer needed
)1()1()0(
)1()1()0(
m
m
xxdx
xxzxdz
q
Idea:
Force to 1
Converges to q
To turn the identity into a division algorithm, we face three questions:
1. How to select the multipliers x(i) ?
2. How many iterations (pairs of multiplications)? 3. How to implement in hardware?
![Page 46: Advanced Dividers Lecture 10. Required Reading Chapter 13, Basic Division Schemes 13.4, Non-Restoring and Signed Division Chapter 15 Variation in Dividers](https://reader035.vdocuments.net/reader035/viewer/2022070413/5697bf931a28abf838c8f5a0/html5/thumbnails/46.jpg)
May 2012 Computer Arithmetic, Division Slide 46
Formulation as a Convergence Computation
)1()1()0(
)1()1()0(
m
m
xxdx
xxzxdz
q
Idea:
Force to 1
Converges to q
d (i+1) = d
(i) x (i) Set d
(0) = d; make d (m) converge to 1
z (i+1) = z
(i) x (i) Set z
(0) = z; obtain z/d = q z (m)
Question 1: How to select the multipliers x (i)
? x (i) = 2 – d
(i)
This choice transforms the recurrence equations into:
d (i+1) = d
(i) (2 d
(i)) Set d (0) = d; iterate until d
(m) 1 z
(i+1) = z (i)
(2 d (i)) Set z
(0) = z; obtain z/d = q z (m)
u (i+1) = f(u
(i), v (i))
v (i+1) = g(u
(i), v (i))
Fits the general form
![Page 47: Advanced Dividers Lecture 10. Required Reading Chapter 13, Basic Division Schemes 13.4, Non-Restoring and Signed Division Chapter 15 Variation in Dividers](https://reader035.vdocuments.net/reader035/viewer/2022070413/5697bf931a28abf838c8f5a0/html5/thumbnails/47.jpg)
May 2012 Computer Arithmetic, Division Slide 47
Determining the Rate of Convergence
d (i+1) = d
(i) x (i) Set d
(0) = d; make d (m) converge to 1
z (i+1) = z
(i) x (i) Set z
(0) = z; obtain z/d = q z (m)
Question 2: How quickly does d (i)
converge to 1?
We can relate the error in step i + 1 to the error in step i:
d (i+1) = d
(i) (2 d
(i)) = 1 – (1 – d (i))2
1 – d (i+1) = (1 – d
(i))2
For 1 – d (i) , we get 1 – d
(i+1) 2: Quadratic convergence
In general, for k-bit operands, we need
2m – 1 multiplications and m 2’s complementations
where m = log2 k
![Page 48: Advanced Dividers Lecture 10. Required Reading Chapter 13, Basic Division Schemes 13.4, Non-Restoring and Signed Division Chapter 15 Variation in Dividers](https://reader035.vdocuments.net/reader035/viewer/2022070413/5697bf931a28abf838c8f5a0/html5/thumbnails/48.jpg)
May 2012 Computer Arithmetic, Division Slide 48
Quadratic Convergence
Table 16.1 Quadratic convergence in computing z/d by repeated multiplications, where 1/2 d = 1 – y < 1
––––––––––––––––––––––––––––––––––––––––––––––––––––––– i d
(i) = d (i–1)
x (i–1), with d
(0) = d x (i) = 2 – d
(i) ––––––––––––––––––––––––––––––––––––––––––––––––––––––– 0 1 – y = (.1xxx xxxx xxxx xxxx)two 1/2 1 + y 1 1 – y
2 = (.11xx xxxx xxxx xxxx)two 3/4 1 + y 2
2 1 – y 4 = (.1111 xxxx xxxx xxxx)two 15/16 1 + y
4 3 1 – y
8 = (.1111 1111 xxxx xxxx)two 255/256 1 + y 8
4 1 – y 16 = (.1111 1111 1111 1111)two = 1 – ulp
–––––––––––––––––––––––––––––––––––––––––––––––––––––––Each iteration doubles the number of guaranteed leading 1s (convergence to 1 is from below)
Beginning with a single 1 (d ½), after log2 k iterations we get as close to 1 as is possible in a fractional representation
![Page 49: Advanced Dividers Lecture 10. Required Reading Chapter 13, Basic Division Schemes 13.4, Non-Restoring and Signed Division Chapter 15 Variation in Dividers](https://reader035.vdocuments.net/reader035/viewer/2022070413/5697bf931a28abf838c8f5a0/html5/thumbnails/49.jpg)
May 2012 Computer Arithmetic, Division Slide 49
Graphical Depiction of Convergence to q
Fig. 16.1 Graphical representation of convergence in division by repeated multiplications.
1 1 – ulp
d
z
q –
Iteration i
d
z
0 1 2 3 4 5 6
(i)
(i)
q
![Page 50: Advanced Dividers Lecture 10. Required Reading Chapter 13, Basic Division Schemes 13.4, Non-Restoring and Signed Division Chapter 15 Variation in Dividers](https://reader035.vdocuments.net/reader035/viewer/2022070413/5697bf931a28abf838c8f5a0/html5/thumbnails/50.jpg)
May 2012 Computer Arithmetic, Division Slide 50
16.5 Hardware ImplementationRepeated multiplications: Each pair of ops involves the same multiplier
d (i+1) = d
(i) (2 d
(i)) Set d (0) = d; iterate until d
(m) 1 z
(i+1) = z (i)
(2 d (i)) Set z
(0) = z; obtain z/d = q z (m)
Fig. 16.6 Two multiplications fully overlapped in a 2-stage pipelined multiplier.
z x(i)(i)
d x(i)(i)
x(i)z(i)d(i+1)
d(i+1)
x(i+1)
z x(i)(i)
d x(i+1)(i+1)
z(i+1)
2's Complz(i+1) x(i+1)
z x(i+1)(i+1)
d(i+2)
d x(i+1)(i+1)
![Page 51: Advanced Dividers Lecture 10. Required Reading Chapter 13, Basic Division Schemes 13.4, Non-Restoring and Signed Division Chapter 15 Variation in Dividers](https://reader035.vdocuments.net/reader035/viewer/2022070413/5697bf931a28abf838c8f5a0/html5/thumbnails/51.jpg)
May 2012 Computer Arithmetic, Division Slide 51
16.3 Division by Reciprocation
Fig. 16.2 Convergence to a root of f(x) = 0 in the Newton-Raphson method.
The Newton-Raphson method can be used for finding a root of f (x) = 0
f(x)
xx(i+1)x
f(x )
Tangent at x(i)
Root x(i)(i+2)
(i)
(i)
Start with an initial estimate x(0) for the root
Iteratively refine the estimate via the recurrence
x(i+1) = x(i) – f (x(i)) / f (x(i))
Justification:
tan (i) = f (x(i)) = f (x(i)) / (x(i) – x(i+1))
![Page 52: Advanced Dividers Lecture 10. Required Reading Chapter 13, Basic Division Schemes 13.4, Non-Restoring and Signed Division Chapter 15 Variation in Dividers](https://reader035.vdocuments.net/reader035/viewer/2022070413/5697bf931a28abf838c8f5a0/html5/thumbnails/52.jpg)
May 2012 Computer Arithmetic, Division Slide 52
Computing 1/d by Convergence
1/d is the root of f (x) = 1/x – d
f (x) = –1/x2
Substitute in the Newton-Raphson recurrence x(i+1) = x(i) – f (x(i)) / f (x(i)) to get:
x (i+1) = x
(i) (2 x
(i)d)
One iteration = Two multiplications + One 2’s complementation
Error analysis: Let (i) = 1/d – x(i) be the error at the ith iteration
(i+1) = 1/d – x
(i+1) = 1/d – x (i)
(2 – x (i)
d) = d (1/d – x (i))2 = d (
(i))2
Because d < 1, we have (i+1) < (
(i))2
d
1/d x
f(x)
![Page 53: Advanced Dividers Lecture 10. Required Reading Chapter 13, Basic Division Schemes 13.4, Non-Restoring and Signed Division Chapter 15 Variation in Dividers](https://reader035.vdocuments.net/reader035/viewer/2022070413/5697bf931a28abf838c8f5a0/html5/thumbnails/53.jpg)
May 2012 Computer Arithmetic, Division Slide 53
Choosing the Initial Approximation to 1/d
With x(0) in the range 0 < x(0) < 2/d, convergence is guaranteed
Justification: | (0) | = | x(0) – 1/d | < 1/d
(1) = | x(1) – 1/d | = d ((0))2 = (d (0)) (0) < (0)
1
x
1/x
2
10
0
For d in [1/2, 1):
Simple choice x(0) = 1.5
Max error = 0.5 < 1/d
Better approx. x(0) = 4(3 – 1) – 2d = 2.9282 – 2d
Max error 0.1
![Page 54: Advanced Dividers Lecture 10. Required Reading Chapter 13, Basic Division Schemes 13.4, Non-Restoring and Signed Division Chapter 15 Variation in Dividers](https://reader035.vdocuments.net/reader035/viewer/2022070413/5697bf931a28abf838c8f5a0/html5/thumbnails/54.jpg)
May 2012 Computer Arithmetic, Division Slide 54
16.4 Speedup of Convergence Division
Division can be performed via 2 log2 k – 1 multiplications
This is not yet very impressive
64-bit numbers, 3-ns multiplier 33-ns division
Three types of speedup are possible:
Fewer multiplications (reduce m) Narrower multiplications (reduce the width of some x(i)s) Faster multiplications
)1()1()0(
)1()1()0(
m
m
xxdx
xxzxdz
q Compute y = 1/d
Do the multiplication yz
![Page 55: Advanced Dividers Lecture 10. Required Reading Chapter 13, Basic Division Schemes 13.4, Non-Restoring and Signed Division Chapter 15 Variation in Dividers](https://reader035.vdocuments.net/reader035/viewer/2022070413/5697bf931a28abf838c8f5a0/html5/thumbnails/55.jpg)
May 2012 Computer Arithmetic, Division Slide 55
Initial Approximation via Table Lookup
Convergence is slow in the beginning: it takes 6 multiplications to get 8 bits of convergence and another 5 to go from 8 bits to 64 bits
d x(0) x(1) x(2) = (0.1111 1111 . . . )two
Approx to 1/d
Better approx
Read this value, x(0+), directly from a table, thereby reducing 6 multiplications to 2
A 2ww lookup table is necessary and sufficient for w bits of convergence after 2 multiplications
Example with 4-bit lookup: d = 0.1011 xxxx . . . (11/16 d < 12/16)Inverses of the two extremes are 16/11 1.0111 and 16/12 1.0101 So, 1.0110 is a good estimate for 1/d1.0110 0.1011 = (11/8) (11/16) = 121/128 = 0.1111001 1.0110 0.1100 = (11/8) (3/4) = 33/32 = 1.000010
![Page 56: Advanced Dividers Lecture 10. Required Reading Chapter 13, Basic Division Schemes 13.4, Non-Restoring and Signed Division Chapter 15 Variation in Dividers](https://reader035.vdocuments.net/reader035/viewer/2022070413/5697bf931a28abf838c8f5a0/html5/thumbnails/56.jpg)
May 2012 Computer Arithmetic, Division Slide 56
Visualizing the Convergence with Table Lookup
Fig. 16.3 Convergence in division by repeated multiplications with initial table lookup.
1 1 – ulp
d
z
q –
Iterations
After table lookup and 1st pair of multiplications, replacing several iterations
After the 2nd pair of multiplications
![Page 57: Advanced Dividers Lecture 10. Required Reading Chapter 13, Basic Division Schemes 13.4, Non-Restoring and Signed Division Chapter 15 Variation in Dividers](https://reader035.vdocuments.net/reader035/viewer/2022070413/5697bf931a28abf838c8f5a0/html5/thumbnails/57.jpg)
May 2012 Computer Arithmetic, Division Slide 57
Convergence Does Not Have to Be from Below
Fig. 16.4 Convergence in division by repeated multiplications with initial table lookup and the use of truncated multiplicative factors.
1 1 ± ulp
d
z
q ±
Iterations
![Page 58: Advanced Dividers Lecture 10. Required Reading Chapter 13, Basic Division Schemes 13.4, Non-Restoring and Signed Division Chapter 15 Variation in Dividers](https://reader035.vdocuments.net/reader035/viewer/2022070413/5697bf931a28abf838c8f5a0/html5/thumbnails/58.jpg)
58
SequentialDividers
with Carry-Save Adders
![Page 59: Advanced Dividers Lecture 10. Required Reading Chapter 13, Basic Division Schemes 13.4, Non-Restoring and Signed Division Chapter 15 Variation in Dividers](https://reader035.vdocuments.net/reader035/viewer/2022070413/5697bf931a28abf838c8f5a0/html5/thumbnails/59.jpg)
59
Block diagram of a radix-2 SRT divider with partialremainder in stored-carry form
![Page 60: Advanced Dividers Lecture 10. Required Reading Chapter 13, Basic Division Schemes 13.4, Non-Restoring and Signed Division Chapter 15 Variation in Dividers](https://reader035.vdocuments.net/reader035/viewer/2022070413/5697bf931a28abf838c8f5a0/html5/thumbnails/60.jpg)
60
Pentium bug (1)October 1994
Thomas Nicely, Lynchburg Collage, Virginiafinds an error in his computer calculations, and tracesit back to the Pentium processor
Tim Coe, Vitesse Semiconductorpresents an example with the worst-case error
c = 4 195 835/3 145 727
Pentium = 1.333 739 06...Correct result = 1.333 820 44...
November 7, 1994
Late 1994
First press announcement, Electronic Engineering Times
![Page 61: Advanced Dividers Lecture 10. Required Reading Chapter 13, Basic Division Schemes 13.4, Non-Restoring and Signed Division Chapter 15 Variation in Dividers](https://reader035.vdocuments.net/reader035/viewer/2022070413/5697bf931a28abf838c8f5a0/html5/thumbnails/61.jpg)
61
Pentium bug (2)
Intel admits “subtle flaw”
Intel’s white paper about the bug and its possible consequences
Intel - average spreadsheet user affected once in 27,000 yearsIBM - average spreadsheet user affected once every 24 days
Replacements based on customer needs
Announcement of no-question-asked replacements
November 30, 1994
December 20, 1994
![Page 62: Advanced Dividers Lecture 10. Required Reading Chapter 13, Basic Division Schemes 13.4, Non-Restoring and Signed Division Chapter 15 Variation in Dividers](https://reader035.vdocuments.net/reader035/viewer/2022070413/5697bf931a28abf838c8f5a0/html5/thumbnails/62.jpg)
62
Pentium bug (3)
Error traced back to the look-up table used bythe radix-4 SRT division algorithm
2048 cells, 1066 non-zero values {-2, -1, 1, 2}
5 non-zero values not downloaded correctly to the lookup table due to an error in the C script
![Page 63: Advanced Dividers Lecture 10. Required Reading Chapter 13, Basic Division Schemes 13.4, Non-Restoring and Signed Division Chapter 15 Variation in Dividers](https://reader035.vdocuments.net/reader035/viewer/2022070413/5697bf931a28abf838c8f5a0/html5/thumbnails/63.jpg)
63
![Page 64: Advanced Dividers Lecture 10. Required Reading Chapter 13, Basic Division Schemes 13.4, Non-Restoring and Signed Division Chapter 15 Variation in Dividers](https://reader035.vdocuments.net/reader035/viewer/2022070413/5697bf931a28abf838c8f5a0/html5/thumbnails/64.jpg)
64
Follow-upCourses
![Page 65: Advanced Dividers Lecture 10. Required Reading Chapter 13, Basic Division Schemes 13.4, Non-Restoring and Signed Division Chapter 15 Variation in Dividers](https://reader035.vdocuments.net/reader035/viewer/2022070413/5697bf931a28abf838c8f5a0/html5/thumbnails/65.jpg)
DIGITAL SYSTEMS DESIGN
1. ECE 681 VLSI Design for ASICs (Fall semesters) H. Homayoun, project/lab, front-end and back-end ASIC design with Synopsys tools
2. ECE 699 Digital Signal Processing Hardware Architectures (Fall semesters) A. Cohen, project, FPGA design for DSP
3. ECE 682 VLSI Test Concepts (Spring semesters)
T. Storey, homework
![Page 66: Advanced Dividers Lecture 10. Required Reading Chapter 13, Basic Division Schemes 13.4, Non-Restoring and Signed Division Chapter 15 Variation in Dividers](https://reader035.vdocuments.net/reader035/viewer/2022070413/5697bf931a28abf838c8f5a0/html5/thumbnails/66.jpg)
NETWORK AND SYSTEM SECURITY
1. ECE 646 Cryptography and Computer Network Security (Fall semesters) K.Gaj, hardware, software, or analytical project
2. ECE 746 Advanced Applied Cryptography (Spring semesters)
J.-P. Kaps, hardware, software, or analytical project
3. ECE 899 Cryptographic Engineering (Spring semesters)
J.-P. Kaps, research-oriented project