Download presentation
Presentation is loading. Please wait.
Published byBernice Webster Modified over 9 years ago
1
Computer Arithmetic 1 Of 23 Computer Arithmetic By: Ali Bohlooli Zefreh s8026639@ sepahan. iut. ac. ir Professor: Dr. Shadrokh Samavi Date: 1381/ 3/ 4 Square Root Algorithm
2
Computer Arithmetic 2 Of 23 Overview Digit by Digit method Restoring Non Restoring SRT –Division –Square Root
3
Computer Arithmetic 3 Of 23 Similarities between Square Root & Division The square-root and division are inverse of multiplication, therefore expect to find some similarities between them.
4
Computer Arithmetic 4 Of 23 Square-Rooting methods 1) Multiplicative methods (Convergence) 2) Subtractive methods (Digit by digit) –Use the subtraction and shift operation –Restoring, NonRestoring, SRT algorithms –Adopted in most of the recent processors –Area-effective –Use the reciprocal table –Newton-Raphson, Goldschmidt’s algorithms –Relatively high-speed
5
Computer Arithmetic 5 Of 23 Subtractive methods
6
Computer Arithmetic 6 Of 23 Restoring & Non Restoring methods Assume that Q i is partial root in step I and q n-i-1 Is I+1’bit of partial root so Next partial root=r* Q i + q n-i-1 And (r Q i + q n-i-1 ) 2 =r 2 Q i 2 +2r Q i q n-i-1 + q 2 n -i-1 Therefore 2r Q i q n-i-1 + q 2 n -i-1 Must be subtract from partial reminder If radix =2 (2 Q i + q n-i-1 ) 2 =4 Q i 2 +4 Q i q n-i-1 + q 2 n -i-1 If q n-i-1 = ‘1’ then it is sufficient to concatenate ‘01’ in the right of Q i
7
Computer Arithmetic 7 Of 23 Restoring CS q1q1 q2q2 q3q3 q4q4 r8r8 r5r5 r6r6 r7r7 r4r4 r3r3 r2r2 r1r1 R= x8x8 x6x6 x7x7 x5x5 x4x4 x3x3 x2x2 x1x1 0 0 0 0 0 0 0 0 1 1 1 1 a b Mux r ou t Borrow_out Sub control Sub 0 1 Borrow_in CS 0 0 0
8
Computer Arithmetic 8 Of 23 Non Restoring Q= =0.q 1 q 2 …q n X=Q 2 = 0.x 1 x 2 …x 2n Non Restoring Square root algorithm step 1) R 0 = 0.x 1 x 2 ; f 0 =0.01;i=1; step 2)R i =R i-1 -f i-1 step 3)if (Ri<0) then (q i ‘0’;R i R i.x 2i+1 x 2i+2 ; F i 0.0..0q 1 q 2 …q i 11; R i+1 R i +F i ); Else((q i ‘1’;R i R i.x 2i+1 x 2i+2 ; F i 0.0..0q 1 q 2 …q i 01; R i+1 R i -F i ); step 4) i i+1; step 5)if(I<n) then (go to step 3) Else (Q=0.q 1 q 2 …q n ) End
9
Computer Arithmetic 9 Of 23 Proof of Non restoring Algorithm (X11) 2 =4x+3 (X01) 2 =4x+1 In restoring algorithm R j+1 R j q j+1 2q j R j+2 4R j -(4q j+1 +1)=4R j -8q j -1 In non restoring algorithm R j+1 R j -(4q j +1) q j+1 2q j R j+2 4R j+1 +(4q j+1 +3)=4R j -8q j -1 `
10
Computer Arithmetic 10 Of 23 Non Restoring CAS r8r8 r5r5 r6r6 r7r7 r4r4 r3r3 r2r2 r1r1 R= q4q4 q3q3 q2q2 q1q1 1 10 1 1 x1x1 x2x2 x4x4 x3x3 x5x5 x6x6 x7x7 x8x8 0 0 0 CAS FA x in r out qiqi sub/add c in c out 1
11
Computer Arithmetic 11 Of 23 division & Square-root recursion formulas To find, set and evaluate Define, then R j+1 =rR j -q j+1 D (division recursion formula) (Square-root recursion formula) : the jth partial root : the (j+1)th bit of partial root the subtractive square root and division methods are closely related
12
Computer Arithmetic 12 Of 23 Assume that X is Radicand and its square root is S m = 0.s 1...s m X- S m = w m 2 -m 에서 w m = 2 m X- 2 m S m w m-1 = 2 m-1 X- 2 m-1 S m-1 2 2 22 w m -2 w m-1 = -2 m (S m -S m-1 ) = -2 m ((s m 2 -m + S m-1 ) - S m-1 ) = -2 m (2s m S m-1 2 -m + s m 2 -2m ) = -s m (2S m-1 + s m 2 -m ) 22 2 w m = 2 w m-1 - s m (2S m-1 + s m 2 -m ) 2 Why
13
Computer Arithmetic 13 Of 23 SRT Division in Non restoring division 1 if 0< 2r i-1 <D -1 if –2D < 2r i-1 <0 r i = 2 r i-1 - q i D q i = riri D2D D 2r i-1 q i =1 -D-2D -D
14
Computer Arithmetic 14 Of 23 SRT Division For q i =0 implies no addition/subtraction However, comparing 2 r i-1 with D or -D takes time if D is a normalized fraction (1/2 D < 1), then we can set q i =0 for -1/2 2 r i-1 < 1/2 1 if 2 r i-1 1/2 0 if -1/2 2 r i-1 < 1/2 1 if 2 r i-1 < -1/2 r i = 2 r i-1 - q i D (SRT division) 1.|r i | D convergence guaranteed 2.comparing 2 r i-1 with 1/2 or -1/2 is easier if 2 r i-1 = 0.1xxx 2 r i-1 1/2 if 2 r i-1 = 1.0xxx 2 r i-1 < -1/2 if |X|=|r 0 | 1/2 |2 r 0 | 1 examine three bits of 2 r i-1 q i =
15
Computer Arithmetic 15 Of 23 SRT Division 1/2 1 2r i-1 q i =1 -1/2-D -1/2 q i =0 D when |2r 0 |=|2X| 1 start with a normalized divisor normalize the partial remainder by shifting over leading 0’s if positive, and over leading 1’s if negative 2 r i-1 =0.001xxx 2 r i-1 =1.110xxx riri
16
Computer Arithmetic 16 Of 23 SRT Division (Example) X = 0.0101 = 5/16 D = 0.1100 = 3/4 r 0 =X=5/16 2r 0 Add -D=-3/4 r 1 =2r 0 -D 2r 1 r 2 2r 2 r 3 2r 3 Add D r 4 =2r 3 +D Add D r 4 (corrected) 0.0 1 0 1 0.1 0 1 0 1/2 q 1 =1 + 1.0 1 0 0 1.1 1 1 0 1.1 1 0 0 1/2 q 2 =0 1.1 0 0 0 1/2 q 3 =0 1.0 0 0 0 1/2 q 4 =1 + 0.1 1 0 0 1.1 1 0 0 r 4 0 + 0.1 1 0 0 correction 0.1 0 0 0 Q = 0.1001 – ulp( Unit in the Least Position ) = 0.0110 R = 1/2 * 2 -4 = 1/32
17
Computer Arithmetic 17 Of 23 SRT Division How to reduce the number of add/subtract operations from simulation and statistical analysis 1. Average ‘shift’ in the SRT method : 2.67 average operations : n/2.67 2. Actual number of operations depends on D The smallest number is achieved when D [17/28,3/4] with average shift of 3. Approximately D [3/5,3/4]
18
Computer Arithmetic 18 Of 23 SRT Division To reduce the number of operations, modify the SRT method when D [3/5,3/4] 1. Examine the possibility of using a multiple of D: in some of the steps during the division use 2D (one position earlier) if D is too small, or D/2 (one position later) if D is too large.
19
Computer Arithmetic 19 Of 23 Modifying the SRT method 2. Change the comparison constant K K= 1/2 if D [3/5,3/4] 0.1000 0.10010.10100.1100 0.11111 k1=3/8 k2=7/16k3=1/2 k2=5/8k3=3/4 0.0110 0.01110.10000.1010 0.1100 K= D= K= 3/8 if D [1/2,9/16] K= 7/16 if D [9/16,10/16]
20
Computer Arithmetic 20 Of 23 modifying the SRT method 3- Radix (=2 m ) # of ADD/SUB reduced # of steps = n/m r 0 =X; r i = r i–1 –q i D restoring DIV: ( –1) q i 0 Non restoring DIV: ( –1) q i –( –1) High Radix SRT DIV: q i – ( –1) ( –1) /2
21
Computer Arithmetic 21 Of 23 Compute Allowable Range of k (1) k|D| |r i | (convergence condition) r i = r i–1 –q i D= kD– D kD (1) k = /( –1)
22
Computer Arithmetic 22 Of 23 SRT Division (4) Quotient Accumulation (QA) (1) Quotient Selection (QS) q j +1 결정 q j +1 결정 (3) Partial Remainder Formation (PRF) p j +1 = rp j - q j + 1 d p j +1 = rp j - q j + 1 d (2) Divisor Multiple Formation (DMF) q j +1 d 계산 q j +1 d 계산 Steps
23
Computer Arithmetic 23 Of 23 SRT Division MUX Divisor Multiple Generator(-2D,-1D,0D,1D,2D) MUX QuotientSelector(PLA) rem P Quotient Q CPA Logic Last q Dividend Divisor QS DMF PRF QA....... Radix-4 SRT Implementation
24
Computer Arithmetic 24 Of 23 Refrences 1) “AREA AND PERFORMANCE TRADEOFFS IN FLOATING-POINT DIVIDE AND SQUARE ROOT IMPLEMENTATIONS”,Miriam Leeserl, Dept. of Electrical and Computer Engineering, Northeastern UniversityBoston, Massachusetts 02115 2) “New algorithm and vlsi architecture for SRT Divesion and square root” S.E. McQuillan, J.V. McCanny, University of Belfast 4)”Computer arithmetic”,kai Hwang 5)http://citeseer.nj.nec.com/cache/papers/cs/25930/http:zSzzSzwww3.hmc.eduzSz~harriszSzresearch zSzsrtlong.pdf/srt-division-architectures-models.pdf srt-division-architectures-models.pdf 6)http://citeseer.nj.nec.com/cache/papers/cs/3067/ftp:zSzzSzumunhum.stanford.eduzSztrzSzsrtcircuit s.pdf/harris97srt.pdf 7)http://citeseer.nj.nec.com/cache/papers/cs/4049/http:zSzzSzwww.ee.umn.eduzSzgroupszSzddpzSzdi g_serzSz..zSzPublicationszSzkuhlmannzSzsqrt.pdf/fast-low-power-shared.pdf 8)http://citeseer.nj.nec.com/cache/papers/cs/11722/http:zSzzSzwww.imada.sdu.dkzSz~kornerupzSzp aperszSzSRT-thesis.pdf/alternative-implementations-of-srt.pdf 9)http://citeseer.nj.nec.com/cache/papers/cs/16280/ftp:zSzzSztheory.lcs.mit.eduzSzpubzSzpeoplezSze delmanzSzpentiumzSzpentium.pdf/the-mathematics-of-the.pdf
25
Computer Arithmetic 25 Of 23 References 10)http://citeseer.nj.nec.com/cache/papers/cs/3067/ftp:zSzzSzumunhum.stanford.eduzSztrzSzdivalgo _TOC.pdf/oberman97division.pdf 11)http://citeseer.nj.nec.com/cache/papers/cs/3944/ftp:zSzzSzverdon.imag.frzSzpubzSzISDzSzpostscr iptzSzedtc96.pdf/asynchronous-srt-dividers-the.pdf 12)http://citeseer.nj.nec.com/cache/papers/cs/5185/http:zSzzSzweb.mit.eduzSz18.337zSzWWWzSz..z Sz1995zSzlect3zSzlect3.pdf/about-these-notes-on.pdf 13)http://citeseer.nj.nec.com/cache/papers/cs/14904/ftp:zSzzSzftp.mpi- sb.mpg.dezSzpubzSzpaperszSzreportszSzMPI-I-96-1-001.pdf/burnikel96leda.pdf 14)http://citeseer.nj.nec.com/cache/papers/cs/23982/http:zSzzSzwww.hpl.hp.comzSzpersonalzSzAlan _KarpzSzpublicationszSzsqrtdiv.pdf/alan97high.pdf 15) vlsi.yonsei.ac.kr/seminar/ Hi-Speed%20Division%20Circuit.ppt 16) piglet.uccs.edu/~cs520/S99cha.ppt 17) sdgroup.snu.ac.kr/class/digital.2000/note/302L22.ppt
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.