CSE 246: Computer Arithmetic Algorithms and Hardware Design Instructor: Prof. Chung-Kuan Cheng Fall 2006 Lecture 7 Division.

Slides:



Advertisements
Similar presentations
Prof. John Nestor ECE Department Lafayette College Easton, Pennsylvania ECE Computer Organization Lecture 8 - Multiplication.
Advertisements

Arithmetic Intro Computer Organization 1 Computer Science Dept Va Tech February 2008 © McQuain Algorithm for Integer Division The natural (by-hand)
Integer division Pencil and paper binary division (dividend)(divisor) 1000.
Lecture 15: Computer Arithmetic Today’s topic –Division 1.
CMPT 334 Computer Organization Chapter 3 Arithmetic for Computers [Adapted from Computer Organization and Design 5 th Edition, Patterson & Hennessy, ©
Lecture Objectives: 1)Perform binary division of two numbers. 2)Define dividend, divisor, quotient, and remainder. 3)Explain how division is accomplished.
Binary Addition Rules Adding Binary Numbers = = 1
UNIVERSITY OF MASSACHUSETTS Dept
CSE 246: Computer Arithmetic Algorithms and Hardware Design Instructor: Prof. Chung-Kuan Cheng Lecture 5.
EE 382 Processor DesignWinter 98/99Michael Flynn 1 AT Arithmetic Most concern has gone into creating fast implementation of (especially) FP Arith. Under.
Computer Organization Multiplication and Division Feb 2005 Reading: Portions of these slides are derived from: Textbook figures © 1998 Morgan Kaufmann.
CSE 246: Computer Arithmetic Algorithms and Hardware Design Instructor: Prof. Chung-Kuan Cheng Fall 2006 Lecture 11 Cordic, Log, Square, Exponential Functions.
UNIVERSITY OF MASSACHUSETTS Dept
CSE 246: Computer Arithmetic Algorithms and Hardware Design Instructor: Prof. Chung-Kuan Cheng Fall 2006 Lecture 10 Floating Point Number Rounding, Polynomial.
1 Lecture 8: Binary Multiplication & Division Today’s topics:  Addition/Subtraction  Multiplication  Division Reminder: get started early on assignment.
CSE 246: Computer Arithmetic Algorithms and Hardware Design Instructor: Prof. Chung-Kuan Cheng Fall 2006 Lecture 8: Division.
CSE 246: Computer Arithmetic Algorithms and Hardware Design Instructor: Prof. Chung-Kuan Cheng Winter 2004 Lecture 8.
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.
division algorithm Before we study divisibility, we must remember the division algorithm. r dividend = (divisor ⋅ quotient) + remainder.
ECE 645 – Computer Arithmetic Lecture 10: Fast Dividers ECE 645—Computer Arithmetic 4/15/08.
Lecture 10 Fast Dividers.
ECE 645 – Computer Arithmetic Lecture 9: Basic Dividers ECE 645—Computer Arithmetic 4/1/08.
Data Representation – Binary Numbers
Integer Conversion Between Decimal and Binary Bases Conversion of decimal to binary more complicated Task accomplished by –Repeated division of decimal.
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.
Lecture 6: Multiply, Shift, and Divide
Datapath Designs CK Cheng CSE Department UC, San Diego.
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.
Lecture notes Reading: Section 3.4, 3.5, 3.6 Multiplication
Basic Dividers Lecture 10. Required Reading Chapter 13, Basic Division Schemes 13.1, Shift/Subtract Division Algorithms 13.3, Restoring Hardware Dividers.
Csci 136 Computer Architecture II – Multiplication and Division
Mohamed Younis CMCS 411, Computer Architecture 1 CMSC Computer Architecture Lecture 11 Performing Division March 5,
Department of Communication Engineering, NCTU 1 Unit 4 Arithmetic and Logic Units.
1 Basic Dividers Lecture 9. Required Reading Chapter 13, Basic Division Schemes 13.1, Shift/Subtract Division Algorithms 13.3, Restoring Hardware Dividers.
ECE/CS 552: Integer Dividers
CDA 3101 Spring 2016 Introduction to Computer Organization
CSE 8351 Computer Arithmetic Fall 2005 Instructors: Peter-Michael Seidel.
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 Lecture 5Multiplication and Division ECE 0142 Computer Organization.
Arithmetic for Computers Chapter 3 1. Arithmetic for Computers  Operations on integers  Addition and subtraction  Multiplication and division  Dealing.
More Binary Arithmetic - Multiplication
Computer Architecture & Operations I
Multiplication and Division basics
Computer Architecture & Operations I
Integer Multiplication and Division
UNIVERSITY OF MASSACHUSETTS Dept
Morgan Kaufmann Publishers
CSE 575 Computer Arithmetic Spring 2003 Mary Jane Irwin (www. cse. psu
Morgan Kaufmann Publishers
Lecture 8: Binary Multiplication & Division
CDA 3101 Summer 2007 Introduction to Computer Organization
Lecture 9 Basic Dividers.
Lecture 8: Addition, Multiplication & Division
Lecture 8: Addition, Multiplication & Division
CSCI206 - Computer Organization & Programming
Topic 3c Integer Multiply and Divide
Computer Organization and Design
Computation in Other Bases
Reading: Study Chapter (including Booth coding)
October 15 Chapter 4 – Multiplication/Division Go to the State Fair!
Montek Singh Mon, Mar 28, 2011 Lecture 11
UNIVERSITY OF MASSACHUSETTS Dept
UNIVERSITY OF MASSACHUSETTS Dept
October 5 Register to vote! Go to the State Fair! (15-24 October)
Radix –Two Division Most complex of the four arithmetic operations (addition, subtraction, multiplication and division). Requires the most in terms of.
Presentation transcript:

CSE 246: Computer Arithmetic Algorithms and Hardware Design Instructor: Prof. Chung-Kuan Cheng Fall 2006 Lecture 7 Division

CSE 2462 Topics: Division  Restoring Division  Nonrestoring Division  High Radix Division

CSE 2463 Division – Iteration effort  Pencil and paper method: (A=QB+2 -n R and R<B) 1 bit partial quotient per iteration, n iterations A =0.1110, B =0.010; Q = A / B. Q i : Partial Quotient R i : Partial Remainder R i+1 = R i – B  Q i Q = R0=AR0=A R2R R3R R4R R1R1 Q 1 = 0.1 Q 2 = 0.01 Q 3 = Q 4 =

CSE 2464 Division – Memory effort  Lookup table is the simplest way to obtain multiple partial quotient bits in each iteration.  SRT method: a lookup tables stores m-bit partial quotients decided by m bits of partial remainder and m bits of divisor. Table size: 2 2m  m  STR method is limited by memory wall.

CSE 2465 Division – Solution space Iteration Effort Memory Effort Arithmetic Effort Memory Wall Pencil-and-paper SRT Prescaling Taylor Expansion Low area Series Expansion Low latency Our target

CSE 2466 Division Division is much more complicated than multiplication MultiplicationDivision X Y Z (n bits) (2n bits) q d Z (n bits) (2n bits) s (n bits) multiplication division

CSE 2467 Division Nomenclature Z = dq + s Z: dividend d: divisor q: quotient s: remainder q = Z / d

CSE 2468 A Simple Example This is called “ restoring ” division because we compare the partial remainder to the divisor (using a subtraction) and place a zero in the quotient if the result was negative

CSE 2469 Nonrestoring Division If the partial remainder is positive, divide by +1. If the partial remainder is negative, divide by – 1. The last positive remainder is correct. q = = s = 1 1

CSE Quotient Digit Conversion 1. Replace – 1 with 0 2. Shift left by one bit Example:

CSE Faster Division The division algorithms presented are O(n log n). How do we reduce this? If we use radix-4 division, this changes to O((n/2) log n) If we use radix-4 division and carry save addition, we can achieve O(n/2)

CSE High Radix Division SRT (Sweeney, Robertson, & Tocher) 1. nonrestoring 2. redundant quotient 3. carry-save addition

CSE Radix-2 SRT Division Assumption: ½ ≤ d < 1 s (0) є [-½, ½) (If this assumption does not hold, we make it so by modifying the operands) If 2s (j-1) < -½ Then q j = -1 Else If 2s (j-1) ≥ -½ Then q j = 1 Else q j = 0 2s (j-1) qjqj 1 -½-½ ½

CSE Radix-2 SRT Example s (0) ≥ ½ ; q 1 = 1 - ½ < s (1) < ½ ; q 2 = 0 s (2) ≥ ½ ; q 3 = 1 s (3) ≥ ½ ; q 4 = 1 q = 1.010, s =

CSE Another Radix-2 SRT Example s (0) ≥ ½ ; q 1 = 1 - ½ < s (1) < ½ ; q 2 = 0 s (2) < - ½ ; q 3 = -1 q = 1.0(-1)(-1) s = ½ < s (3) < ½ ; q 4 = 0

CSE Radix-2 SRT Division Continued ½ ≤ d < 1(1) s (j-1) є [-½, ½)(2) 2s (j-1) є [-1, 1)(3) (from (2)) s (j) = 2s (j-1) – q j d є [-½, ½) (4)

CSE Radix-4 Division ½ ≤ d < 1 4s (j-1) = q j d + s (j) q j є [-3, 3] Limit the range of the quotient to q j є [-2, 2] s (j-1) є [-hd, hd] h < 1 4s (j-1) є [-4hd, 4hd] In order to have q j є [-2, 2] we need -4hd + 2d ≥ -hd  2d ≥ 3hd 4hd - 2d ≤ hd  3hd ≤ 2d or h ≤ 2/3