CSE 246: Computer Arithmetic Algorithms and Hardware Design Instructor: Prof. Chung-Kuan Cheng Winter 2004 Lecture 8
CSE 2462 Topics: Midterm Radix-4 SRT Division Division by a Constant Division by a Repeated Multiplication
CSE 2463 Midterm II.RNS to Decimal conversion (2|3|4)RNS(7|6|5) = ? 1 = 4 2 = 5 3 = 3
CSE 2464 Midterm III.One ’ s Complement Adder Loop back carryout of FA7 to the carry in of FA0 FA7FA6FA5FA4FA3FA2FA1FA0 The Delay is 8.7 because the maximum carry propagation is once cycle
CSE 2465 Midterm IV.Prefix Adders I.Ripple-carry Adder
CSE 2466 Midterm IV.Prefix Adders I.Prefix Adder
CSE 2467 Project Update Come in to speak briefly about the final project Status Update 4 or 5 – 6:30 p.m. Tuesday or Thursday
CSE 2468 Radix-4 SRT Division 4s j-1 = q j d + s j where q j is in [-2,2] and s j-1 is in [-hd,+hd] h is less than or equal to 2/3 Therefore, s j-1 is in [-2d/3, 2d/3] And, 4s j-1 is in [-8d/3, 8d/3] s shifts to the left by 2 bits
CSE 2469 Radix-4 SRT Division d/3 q j =1 q j =0 q j =2 The overlap regions of q j denote a choice still allowing for recursion Anything about 8/3 goes against our assumption and is therefore the infeasible region 4s j-1 d
CSE Radix-4 SRT Division The value of q j determines the range it governs For example, q j = /3 = 5/3 1 – 2/3 = 1/3 The range is 1/3 to 5/3
CSE Division by a Constant Multiplication is O(log n) but division is linear…much slower Try to convert division to multiplication Property: Given an odd number d m such that d*m = 2 n – 1 Ex. d = 3, m = 53*5 = 2 4 – 1 d = 7, m =97*9 = 2 6 – 1 d = 11, m = * 93 = E
CSE Division by a Constant 1/d = m/(2 n – 1) 1/(1-r) = 1+r+r 2 +r 3 + … = (1+r)(1+r 2 )(1+r 3 )(1+r 4 ) … Example z/7 = mz/(2 n -1) log(n/6) operations m 1 2 n 1-2 -n = 2n2n m (1+2 -n )(1+2 -2n )(1+2 -4n ) z = z ( )( )( )
CSE Division by a Repeated Multiplication q = z/d = (z/d)*(x 0 /x 0 )*(x 1 /x 1 ) … *(x k-1 /x k-1 ) Let xi = 2-di d 1 = dx o = d(2-d) = 1-(1-d) 2 d i+1 = d i x i = d i (2-d i ) = 1-(1-d i ) 2 1-d i +1 = (1-d i ) 2 … quadratic convergence For k-bit operands, we need 2m-1 multiplications m 2 ’ s complement m = ceiling(log 2 k) with log 2 m extra bits for precision