Division. 1001 Quotient Divisor 1000 1001010 Dividend –1000 10 101 1010 –1000 10 Remainder.

Slides:



Advertisements
Similar presentations
Multiplication and Division
Advertisements

4.1 Friendly Numbers SRB 22.
Datorteknik IntegerMulDiv bild 1 MIPS mul/div instructions Multiply: mult $2,$3Hi, Lo = $2 x $3;64-bit signed product Multiply unsigned: multu$2,$3Hi,
CMPE 325 Computer Architecture II
Iterative Integer Division Techniques Shantanu Dutt UIC.
Prof. John Nestor ECE Department Lafayette College Easton, Pennsylvania ECE Computer Organization Lecture 8 - Multiplication.
Arithmetic Intro Computer Organization 1 Computer Science Dept Va Tech February 2008 © McQuain Algorithm for Integer Division The natural (by-hand)
÷ 2 0 = 1 0.
Integer division Pencil and paper binary division (dividend)(divisor) 1000.
THE ARITHMETIC-LOGIC UNIT. BINARY HALF-ADDER BINARY HALF-ADDER condt Half adder InputOutput XYSC
Division CPSC 321 Computer Architecture Andreas Klappenecker.
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, ©
Integer Multiplication and DivisionICS 233 – KFUPM © Muhamed Mudawar slide 1 Multiplicand and HI are sign-extended  Sign is the sign of the result Signed.
Chapter 3 Arithmetic for Computers. Multiplication More complicated than addition accomplished via shifting and addition More time and more area Let's.
361 div.1 Computer Architecture ECE 361 Lecture 7: ALU Design : Division.
Arithmetic IV CPSC 321 Andreas Klappenecker. Any Questions?
L10 – Multiplication Division 1 Comp 411 – Fall /19/2009 Binary Multipliers ×
Integer Multiplication and Division ICS 233 Computer Architecture and Assembly Language Dr. Aiman El-Maleh College of Computer Sciences and Engineering.
Computer Organization Multiplication and Division Feb 2005 Reading: Portions of these slides are derived from: Textbook figures © 1998 Morgan Kaufmann.
Integer Multiplication and Division
David Culler Electrical Engineering and Computer Sciences
1 Lecture 8: Binary Multiplication & Division Today’s topics:  Addition/Subtraction  Multiplication  Division Reminder: get started early on assignment.
Converting binary to decimal decimal to binary
EXAMPLE 1 Use polynomial long division
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.
Computer Architecture ALU Design : Division and Floating Point
Copyright 1995 by Coherence LTD., all rights reserved (Revised: Oct 97 by Rafi Lohev, Oct 99 by Yair Wiseman, Sep 04 Oren Kapah) IBM י ב מ 10-1 The ALU.
King Fahd University of Petroleum and Minerals King Fahd University of Petroleum and Minerals Computer Engineering Department Computer Engineering Department.
Multiplication of signed-operands
Lecture 6: Multiply, Shift, and Divide
Ch 11.5 Dividing Polynomials
EXAMPLE 1 Find a common monomial factor Factor the polynomial completely. a. x 3 + 2x 2 – 15x Factor common monomial. = x(x + 5)(x – 3 ) Factor trinomial.
Divisibility Rules!.
Conversion to Larger Number of Bits Ex: Immediate Field (signed 16 bit) to 32 bit Positive numbers have implied 0’s to the left. So, put 16 bit number.
Cs 152 l6 Multiply 1 DAP Fa 97 © U.C.B. ECE Computer Architecture Lecture Notes Multiply, Shift, Divide Shantanu Dutt Univ. of Illinois at.
CS61C Finishing the Datapath: Subtract, Multiple, Divide Lecture 21
Integer Multiplication and Division
Divide Calculation Latency
Integer Multiplication and Division ICS 233 Computer Architecture and Assembly Language Dr. Aiman El-Maleh College of Computer Sciences and Engineering.
Dividing Decimals by a Whole Number 3.6 ÷ 3.
Csci 136 Computer Architecture II – Multiplication and Division
Mohamed Younis CMCS 411, Computer Architecture 1 CMSC Computer Architecture Lecture 11 Performing Division March 5,
Warm up Objective: To divide polynomials Lesson 6-7 Polynomial Long Division.
Division. Just as multiplication can be expressed as a series of additions, division can be seen as a series of subtractions. 21 ÷ 7 asks how many times.
Division Check for 0 divisor Long division approach – If divisor ≤ dividend bits 1 bit in quotient, subtract – Otherwise 0 bit in quotient, bring down.
ECE/CS 552: Integer Dividers
Lab 7. Given: Two’s complement integer A single precision floating-point.
My Book of Divisibility. THE 2’s Example: 30, 42, 24, 76, 98, Must be an even number Number must end in a 0, 2, 4, 6, or 8.
Integer Multiplication and Division COE 301 Computer Organization Dr. Muhamed Mudawar College of Computer Sciences and Engineering King Fahd University.
Integer Multiplication and Division ICS 233 Computer Architecture & Assembly Language Prof. Muhamed Mudawar College of Computer Sciences and Engineering.
1 Lecture 5Multiplication and Division ECE 0142 Computer Organization.
More Binary Arithmetic - Multiplication
Computer Architecture & Operations I
Multiplication and Division basics
Dividing larger Numbers
Computer Architecture & Operations I
Integer Multiplication and Division
MIPS mul/div instructions
Morgan Kaufmann Publishers
Lecture 8: Binary Multiplication & Division
CSCI206 - Computer Organization & Programming
Topic 3c Integer Multiply and Divide
مظفر بگ محمدی دانشگاه ایلام
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
October 5 Register to vote! Go to the State Fair! (15-24 October)
1 Lecture 5Multiplication and Division ECE 0142 Computer Organization.
Presentation transcript:

Division

1001 Quotient Divisor Dividend – – Remainder

Binary division Dividend = Quotient x Divisor + Remainder See how big a number can be subtracted Binary division is simpler Create a quotient bit (0 or 1) in each step

Division hardware (Version 1)

rem = rem - div if rem < 0 then // divisor too big rem = rem + div quo <<= 1 LSB(quo) = 0 else // can divide quo <<= 1 LSB(quo) = 1 fi div >>= 1 repeat unless done

Binary division IterationStepQuotientDivisorRemainder 0 Initial values : Rem -= div 2b: Rem < 0 (+Div) Quo shift left, Q0 = 0 3: Div Shift right : Rem -= div 2b: Rem < 0 (+Div) Quo shift left, Q0 = 0 3: Div Shift right

Binary division IterationStepQuotientDivisorRemainder 3 1: Rem -= div 2b: Rem < 0 (+Div) Quo shift left, Q0 = 0 3: Div Shift right : Rem -= div 2b: Rem >= 0 Quo shift left, Q0 = 1 3: Div Shift right : Rem -= div 2b: Rem >= 0 Quo shift left, Q0 = 1 3: Div Shift right

Observations Half of the bits in divisor always 0 Half of divisor is wasted Instead of shifting divisor to the right, shift remainder to the left Shift left first to save one iteration

Division hardware (Version 2) ALU and divisor registers are reduced, remainder shifted left

3b. Restore the original value by adding the Divisor register to the left half of the Remainder register, &place the sum in the left half of the Remainder register. Also shift the Quotient register to the left, setting the new least significant bit to 0. Test Remainder Remainder < 0 Remainder > 0 2. Subtract the Divisor register from the left half of the Remainder register, & place the result in the left half of the Remainder register. 3a. Shift the Quotient register to the left setting the new rightmost bit to Shift the Remainder register left 1 bit. Done Yes: n repetitions (n = 4 here) nth repetition? No: < n repetitions Start: Place Dividend in Remainder

Observations on Divide Version 2 Eliminate Quotient register by combining with Remainder as shifted left Start by shifting the Remainder left as before. Thereafter loop contains only two steps because the shifting of the Remainder register shifts both the remainder in the left half and the quotient in the right half The consequence of combining the two registers together and the new order of the operations in the loop is that the remainder will shifted left one time too many. Thus the final correction step must shift back only the remainder in the left half of the register

rem <<= 1 rem -= (div >> 32) if rem < 0 then rem += (div >> 32) rem <<= 1 LSB(rem) = 0 else rem <<= 1 LSB(rem) = 1 fi repeat unless done Version 3

Division hardware (Version 3)