ECE 645 – Computer Arithmetic Lecture 10: Fast Dividers ECE 645—Computer Arithmetic 4/15/08.

Slides:



Advertisements
Similar presentations
ECE 645 – Computer Arithmetic Lecture 11: Advanced Topics and Final Review ECE 645—Computer Arithmetic 4/22/08.
Advertisements

Prof. John Nestor ECE Department Lafayette College Easton, Pennsylvania ECE Computer Organization Lecture 8 - Multiplication.
Multiplication Schemes Continued
Division Circuits Jan 2013 Shmuel Wimer Bar Ilan University, Engineering Faculty Technion, EE Faculty 1.
UNIVERSITY OF MASSACHUSETTS Dept
May 2007Computer Arithmetic, DivisionSlide 1 Part IV Division.
UNIVERSITY OF MASSACHUSETTS Dept
UNIVERSITY OF MASSACHUSETTS Dept
1 Lecture 8: Binary Multiplication & Division Today’s topics:  Addition/Subtraction  Multiplication  Division Reminder: get started early on assignment.
May 2012Computer Arithmetic, DivisionSlide 1 Part IV Division 28. Reconfigurable Arithmetic Appendix: Past, Present, and Future.
Copyright 2008 Koren ECE666/Koren Part.6a.1 Israel Koren Spring 2008 UNIVERSITY OF MASSACHUSETTS Dept. of Electrical & Computer Engineering Digital Computer.
COE 308: Computer Architecture (T041) Dr. Marwan Abu-Amara Integer & Floating-Point Arithmetic (Appendix A, Computer Architecture: A Quantitative Approach,
CSE 246: Computer Arithmetic Algorithms and Hardware Design Instructor: Prof. Chung-Kuan Cheng Winter 2004 Lecture 7.
DIGITAL SYSTEMS TCE1111 Representation and Arithmetic Operations with Signed Numbers Week 6 and 7 (Lecture 1 of 2)
Computer Arithmetic Integers: signed / unsigned (can overflow) Fixed point (can overflow) Floating point (can overflow, underflow) (Boolean / Character)
Ch. 21. Square-rootingSlide 1 VI Function Evaluation Topics in This Part Chapter 21 Square-Rooting Methods Chapter 22 The CORDIC Algorithms Chapter 23.
Multiplication.
Lecture 10 Fast Dividers.
ECE 645 – Computer Arithmetic Lecture 9: Basic Dividers ECE 645—Computer Arithmetic 4/1/08.
1 Arithmetic and Logical Operations - Part II. Unsigned Numbers Addition in unsigned numbers is the same regardless of the base. Given a pair of bit sequences.
Data Representation – Binary Numbers
Computer Arithmetic. Instruction Formats Layout of bits in an instruction Includes opcode Includes (implicit or explicit) operand(s) Usually more than.
Chapter 4 – Arithmetic Functions and HDLs Logic and Computer Design Fundamentals.
Introduction to Computer Organization and Architecture Lecture 10 By Juthawut Chantharamalee wut_cha/home.htm.
CH09 Computer Arithmetic  CPU combines of ALU and Control Unit, this chapter discusses ALU The Arithmetic and Logic Unit (ALU) Number Systems Integer.
Oct. 18, 2007SYSC 2001* - Fall SYSC2001-Ch9.ppt1 See Stallings Chapter 9 Computer Arithmetic.
Number Representation Part 1 Fixed-Radix Unsigned Representations ECE 645: Lecture 1.
Integer Conversion Between Decimal and Binary Bases Conversion of decimal to binary more complicated Task accomplished by –Repeated division of decimal.
Number Systems ELEC 311 Digital Logic and Circuits Dr. Ron Hayne Images Courtesy of Cengage Learning.
Sequential Multipliers Lecture 9. Required Reading Chapter 9, Basic Multiplication Scheme Chapter 10, High-Radix Multipliers Chapter 12.3, Bit-Serial.
Multiplication of signed-operands
Digital Kommunikationselektronik TNE027 Lecture 2 1 FA x n –1 c n c n1- y n1– s n1– FA x 1 c 2 y 1 s 1 c 1 x 0 y 0 s 0 c 0 MSB positionLSB position Ripple-Carry.
July 2005Computer Architecture, The Arithmetic/Logic UnitSlide 1 Part III The Arithmetic/Logic Unit.
55:035 Computer Architecture and Organization Lecture 5.
Division Harder Than Multiplication Because Quotient Digit Selection/Estimation Can Have Overflow Condition – Divide by Small Number OR even Worse – Divide.
1 Dividers Lecture 10. Required Reading Chapter 13, Basic Division Schemes 13.1, Shift/Subtract Division Algorithms 13.3, Restoring Hardware Dividers.
1 Basic Dividers Lecture 10. Required Reading Chapter 13, Basic Division Schemes 13.1, Shift/Subtract Division Algorithms 13.3, Restoring Hardware Dividers.
Lecture notes Reading: Section 3.4, 3.5, 3.6 Multiplication
Computer Architecture Lecture 32 Fasih ur Rehman.
Computer Arithmetic See Stallings Chapter 9 Sep 10, 2009
Advanced Dividers Lecture 10. Required Reading Chapter 13, Basic Division Schemes 13.4, Non-Restoring and Signed Division Chapter 15 Variation in Dividers.
Basic Dividers Lecture 10. Required Reading Chapter 13, Basic Division Schemes 13.1, Shift/Subtract Division Algorithms 13.3, Restoring Hardware Dividers.
COE 308: Computer Architecture (T032) Dr. Marwan Abu-Amara Integer & Floating-Point Arithmetic (Appendix A, Computer Architecture: A Quantitative Approach,
Lecture 11 Advanced Dividers.
Copyright 2008 Koren ECE666/Koren Part.7b.1 Israel Koren Spring 2008 UNIVERSITY OF MASSACHUSETTS Dept. of Electrical & Computer Engineering Digital Computer.
1 Basic Dividers Lecture 9. Required Reading Chapter 13, Basic Division Schemes 13.1, Shift/Subtract Division Algorithms 13.3, Restoring Hardware Dividers.
CSE 246: Computer Arithmetic Algorithms and Hardware Design Instructor: Prof. Chung-Kuan Cheng Fall 2006 Lecture 7 Division.
High-Radix Sequential Multipliers Bit-Serial Multipliers Modular Multipliers Lecture 9.
Ch. 4 Computer Arithmetic
Chapter 8 Computer Arithmetic. 8.1 Unsigned Notation Non-negative notation  It treats every number as either zero or a positive value  Range: 0 to 2.
1. Copyright  2005 by Oxford University Press, Inc. Computer Architecture Parhami2 Figure 11.1 Multiplication of 4-bit numbers in dot notation.
More Binary Arithmetic - Multiplication
CHAPTER 18 Circuits for Arithmetic Operations
UNIVERSITY OF MASSACHUSETTS Dept
CSE 575 Computer Arithmetic Spring 2003 Mary Jane Irwin (www. cse. psu
Lecture 9 Basic Dividers.
ECEG-3202 Computer Architecture and Organization
12/7/
Digital Systems and Binary Numbers
UNIVERSITY OF MASSACHUSETTS Dept
CHAPTER 18 Circuits for Arithmetic Operations
UNIVERSITY OF MASSACHUSETTS Dept
UNIVERSITY OF MASSACHUSETTS Dept
Lecture 9 Basic Dividers.
Presentation transcript:

ECE 645 – Computer Arithmetic Lecture 10: Fast Dividers ECE 645—Computer Arithmetic 4/15/08

2 Lecture Roadmap Array Dividers Sequential Dividers Revisited SRT Non-Restoring Fractional Division Sequential Dividers with Carry-Save Adders High-Radix Sequential Dividers Multiply-Divide Unit

3 Required Reading B. Parhami, Computer Arithmetic: Algorithms and Hardware Design Chapter 14, High-Radix Dividers Chapter 15, Variations in Dividers Note errata at:

Fast Dividers ECE 645 – Computer Arithmetic

5 Sequential Radix-2High-radix Restoring Non-restoring regular SRT using carry save adders SRT using carry save adders Array Dividers by Convergence Classification of Dividers

Array Dividers ECE 645 – Computer Arithmetic

7 s frac (0) = z frac s (j) = 2 s (j-1) - q -j d frac s (k) frac = 2 k s frac Sequential Fractional Division Basic Equations

8 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) Restoring Unsigned Fractional Division

9 Fig Restoring array divider composed of controlled subtractor cells. Restoring Array Divider

10 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 for if s (k-1) ≥ 0 q -k = 1 else q -k = 0 Non-Restoring Unsigned Fractional Division

11 Fig Nonrestoring array divider built of controlled add/subtract cells. Similarity to array multiplier is deceiving Critica l path Non-Restoring Array Divider

Sequential Dividers ECE 645 – Computer Arithmetic

13 s frac (0) = z frac s (j) = 2 s (j-1) - q -j d frac s (k) frac = 2 k s frac Sequential Fractional Division Basic Equations

14 s (0) = z for j = 1 to k if 2s (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 correction step Non-Restoring Fractional Division

15 z = q d + s z = (q-1) d + (s+d) z = q’ d + s’ z = (q+1) d + (s-d) z = q” d + s” Integer Division Correction Step

16 z frac = q frac d frac + s frac z frac = (q frac –2 -k ) d frac + (s frac +d frac 2 -k ) z frac = q’ frac d frac + s’ frac z frac = (q frac +2 -k ) d frac + (s frac – d frac 2 -k ) z frac = q” frac d frac + s” frac Fractional Division Correction Step

17 Fig The new partial remainder, s (j), as a function of the shifted old partial remainder, 2s (j–1), in radix-2 nonrestoring division. s (j) = 2s (j–1) – q –j d with s (0) = z s (k) = 2 k s q –j  {  1, 1} Partial Remainder in Radix-2 Non-Restoring Division

18 Fig The new partial remainder, s (j), as a function of the shifted old partial remainder, 2s (j–1), with q –j in {  1, 0, 1}. s (j) = 2s (j–1) – q –j d with s (0) = z s (k) = 2 k s q –j  {  1, 0, 1} Partial Reminder with q -j in {-1,0,1)

19 s (0) = z for j = 1 to k if 2s (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 correction step Non-Restoring Fractional Division with Shifting Over Zeros

SRT Non-Restoring Fractional Dividers ECE 645 – Computer Arithmetic

21 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 SRT Non-Restoring Fractional Division Assumptions

22 Fig The relationship between new and old partial remainders in radix-2 SRT division. We use the comparison constants  ½ and ½ for quotient digit selection 2s  +½ means 2s = (0.1xxxxxxxx) 2’s-compl 2s <  ½ means 2s = (1.0xxxxxxxx) 2’s-compl s (j) = 2s (j–1) – q –j d with s (0) = z s (k) = 2 k s s (j)  [  ½, ½ ) q –j  {  1, 0, 1} New and Old Partial Remainders in SRT Division

23 s (0) = z for j = 1 to k if 2s (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 correction steps SRT Non-Restoring Fractional Division

24 SRT Partial Remainder

25 Skipping by Shifting

26 SRT Algorithm Observations We use the comparison constants  ½ and ½ for quotient digit selection For 2s  +½ or 2s = (0.1xxxxxxxx) 2’s-compl choose q –j = 1 For 2s <  ½ or 2s = (1.0xxxxxxxx) 2’s-compl choose q –j =  1 Choose q –j = 0 in other cases, that is, for: 0  2s < +½ or 2s = (0.0xxxxxxxx) 2’s-compl  ½  2s < 0 or 2s = (1.1xxxxxxxx) 2’s-compl Observation: What happens when the magnitude of 2s is fairly small? 2s = ( xxxx) 2’s-compl 2s = (1.1110xxxxx) 2’s-compl Choosing q –j = 0 would lead to the same condition in the next step; generate 5 quotient digits Generate 4 quotient digits  1 Use leading 0s or leading 1s detection circuit to determine how many quotient digits can be spewed out at once Statistically, the average skipping distance will be 2.67 bits

27 Example Unsigned Radix-2 SRT Division Fig Example of unsigned radix-2 SRT division. ======================== z d –d ======================== s (0) s (0)  ½, so set q  1 = 1 +(  d) and subtract –––––––––––––––––––––––– s (1) s (1) In [  ½, ½), so set q  2 = 0 –––––––––––––––––––––––– s (2) = 2s (1) s (2) In [  ½, ½), so set q  3 = 0 –––––––––––––––––––––––– s (3) = 2s (2) s (3) <  ½, so set q  4 =  1 +d and add –––––––––––––––––––––––– s (4) Negative, +d so add to correct –––––––––––––––––––––––– s (4) s q  1 Uncorrected BSD quotient q Convert and subtract ulp ======================== In [  ½, ½), so okay Unsigned Radix-2 SRT Division

Sequential Dividers with Carry-Save Adders ECE 645 – Computer Arithmetic

29 Fig Block diagram of a radix-2 divider with partial remainder in stored-carry form. Partial Remainder in Stored Carry Form

30 sum = u = u 1 u 0.u -1 u -2 u -3 u -4 ….u -k carry = v = v 1 v 0.v -1 v -2 v -3 v -4 ….v -k t = u 1 u 0.u -1 u -2 + v 1 v 0.v -1 v -2 u + v - t = 00.00u -3 u -4 ….u -k v -3 v -4 ….v -k < 0  1 2 Using Carry Save Adders with Dividers

31 0 t t  0 q -j = 1 t < q -j =  u+v <  t < q -j = 0 u+v < 0 u+v  0 Using Carry-Save Adders with the Dividers

32 Sum and Carry

33 Fig Sum part of 2s (j–1) : u = (u 1 u 0. u –1 u –2...) 2’s-compl Carry part of 2s (j–1) : v = (v 1 v 0. v –1 v –2...) 2’s-compl Approximation to the partial remainder: t = u [–2,1] + v [–2,1] {Add the 4 MSBs of u and v} t := u [–2,1] + v [–2,1] if t < –½ then q –j = –1 else if t ≥ 0 then q –j = 1 else q –j = 0 endif Max error in approximation < ¼ + ¼ = ½ Error in [0, ½) Constant Thresholds Used for Quotient Digit Selection in Radix-2 Division with q k–j in {–1, 0, 1}

34 Fig A p-d plot for radix-2 division with d    [1/2,1), partial remainder in  [–d, d), and quotient digits in [–1, 1]. p-d Plot for Radix-2 Division

High-Radix Sequential Dividers ECE 645 – Computer Arithmetic

36 Radix-4 Division in Dot Notation

37 Fig New versus shifted old partial remainder in radix-4 division with q –j in [–3, 3]. Radix-4 fractional division with left shifts and q –j  [–3, 3] s (j) = 4 s (j–1) – q –j dwith s (0) = z and s (k) = 4 k s | – 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? New Versus Shifted Old Partial Remainder in Radix- 4 Division

38 Fig A p-d plot for radix-4 SRT division with quotient digit set [–3, 3]. p-d Plot for Radix-4 SRT Division with Digit Set [- 3,3]

39 Fig New versus shifted old partial remainder in radix-4 division with q –j in [–2, 2]. Radix-4 fractional division with left shifts and q –j  [–2, 2] s (j) = 4 s (j–1) – q –j dwith s (0) = z and s (k) = 4 k s | – shift – | |–– subtract ––| For this restriction to be feasible, we must have: s  [  hd, hd) for some h < 1, and 4hd – 2d  hd This yields h  2/3 (choose h = 2/3 to minimize the restriction) Radix-4 SRT Divider with the Digit Set {-2, -1, 0, 1, 2}

40 Fig A p-d plot for radix-4 SRT division with quotient digit set [–2, 2]. p-d Plot for Radix-4 SRT Division with Digit Set [- 2,2]

41 Fig Block diagram of radix-r divider with partial remainder in stored-carry form. 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 Radix r Divider

Multiply-Divide Unit ECE 645 – Computer Arithmetic

43 The control unit proceeds through necessary steps for multiplication or division (including using the appropriate shift direction) Fig Sequential radix-2 multiply/divide unit. The slight speed penalty owing to a more complex control unit is insignificant Multiply-Divide Unit