Morgan Kaufmann Publishers

Slides:



Advertisements
Similar presentations
Morgan Kaufmann Publishers Arithmetic for Computers
Advertisements

Chapter 3 Arithmetic for Computers. Exam 1 CSCE
Arithmetic for Computers
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
Prof. John Nestor ECE Department Lafayette College Easton, Pennsylvania ECE Computer Organization Lecture 8 - Multiplication.
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.
CML CML CS 230: Computer Organization and Assembly Language Aviral Shrivastava Department of Computer Science and Engineering School of Computing and Informatics.
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.
Lecture 9 Sept 28 Chapter 3 Arithmetic for Computers.
ECE 15B Computer Organization Spring 2010 Dmitri Strukov Lecture 4: Arithmetic / Data Transfer Instructions Partially adapted from Computer Organization.
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
1 Lecture 8: Binary Multiplication & Division Today’s topics:  Addition/Subtraction  Multiplication  Division Reminder: get started early on assignment.
ECE 15B Computer Organization Spring 2010 Dmitri Strukov Lecture 6: Logic/Shift Instructions Partially adapted from Computer Organization and Design, 4.
COMPUTER ARCHITECTURE & OPERATIONS I Instructor: Hao Ji.
COMPUTER ARCHITECTURE & OPERATIONS I Instructor: Hao Ji.
Lecture Objectives: 1)Explain the relationship between addition and subtraction with twos complement numbering systems 2)Explain the concept of numeric.
Lecture 12: Computer Arithmetic Today’s topic –Numerical representations –Addition / Subtraction –Multiplication / Division 1.
Multiplication CPSC 252 Computer Organization Ellen Walker, Hiram College.
Lec 13Systems Architecture1 Systems Architecture Lecture 13: Integer Multiplication and Division Jeremy R. Johnson Anatole D. Ruslanov William M. Mongan.
Lecture 6: Multiply, Shift, and Divide
Chapter 3 Arithmetic for Computers (Integers). Florida A & M University - Department of Computer and Information Sciences Arithmetic for Computers Operations.
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.
05/03/2009CA&O Lecture 8,9,10 By Engr. Umbreen sabir1 Computer Arithmetic Computer Engineering Department.
Integer Multiplication and Division
Integer Multiplication and Division ICS 233 Computer Architecture and Assembly Language Dr. Aiman El-Maleh College of Computer Sciences and Engineering.
Csci 136 Computer Architecture II – Multiplication and Division
Mohamed Younis CMCS 411, Computer Architecture 1 CMSC Computer Architecture Lecture 11 Performing Division March 5,
Chapter 3 Arithmetic for Computers. Chapter 3 — Arithmetic for Computers — 2 Arithmetic for Computers Operations on integers Addition and subtraction.
C OMPUTER O RGANIZATION AND D ESIGN The Hardware/Software Interface 5 th Edition Chapter 3 Arithmetic for Computers.
Division Check for 0 divisor Long division approach – If divisor ≤ dividend bits 1 bit in quotient, subtract – Otherwise 0 bit in quotient, bring down.
CDA 3101 Spring 2016 Introduction to Computer Organization
Integer Multiplication, Division Arithmetic shift Twice the number of places MIPS multiply unit. mult, multu Significant bits Mfhi, mflo, div, divu Arithmetic.
Integer Multiplication and Division COE 301 Computer Organization Dr. Muhamed Mudawar College of Computer Sciences and Engineering King Fahd University.
By Wannarat Computer System Design Lecture 3 Wannarat Suntiamorntut.
Integer Multiplication and Division ICS 233 Computer Architecture & Assembly Language Prof. Muhamed Mudawar College of Computer Sciences and Engineering.
Arithmetic for Computers Chapter 3 1. Arithmetic for Computers  Operations on integers  Addition and subtraction  Multiplication and division  Dealing.
/ Computer Architecture and Design
Computer System Design Lecture 3
More Binary Arithmetic - Multiplication
Computer Architecture & Operations I
Integer Multiplication, Division Arithmetic shift
Computer Architecture & Operations I
Integer Multiplication and Division
MIPS mul/div instructions
Morgan Kaufmann Publishers Arithmetic for Computers
Morgan Kaufmann Publishers
Part II : Lecture III By Wannarat.
Morgan Kaufmann Publishers
/ Computer Architecture and Design
Lecture 8: Binary Multiplication & Division
Multiplication & Division
CDA 3101 Summer 2007 Introduction to Computer Organization
CDA 3101 Spring 2016 Introduction to Computer Organization
CS352H: Computer Systems Architecture
Lecture 8: Addition, Multiplication & Division
Lecture 8: Addition, Multiplication & Division
CSCI206 - Computer Organization & Programming
Topic 3c Integer Multiply and Divide
Systems Architecture I
CDA 3101 Summer 2007 Introduction to Computer Organization
Computer Arithmetic Multiplication, Floating Point
Morgan Kaufmann Publishers Arithmetic for Computers
Presentation transcript:

Morgan Kaufmann Publishers August 8, 2018 3.3: Multiplication Instructor: Robert Utterback Lecture 29 Chapter 1 — Computer Abstractions and Technology

Sequential Version of Multiplication Algorithm and Hardware Morgan Kaufmann Publishers Sequential Version of Multiplication Algorithm and Hardware 8 August, 2018 Start with long-multiplication approach multiplicand 1000 × 1001 0000 1001000 multiplier product Length of product is the sum of operand lengths Which is the multiplier, which is multiplicand? Chapter 3 — Arithmetic for Computers

Multiplication Hardware Morgan Kaufmann Publishers 8 August, 2018 Multiplication Hardware First version of Multiplication Hardware 32-bit multiplier 64-bit ALU 64-bit product (initialized to 0) Unsigned numbers! Chapter 3 — Arithmetic for Computers

Multiplication Hardware Morgan Kaufmann Publishers 8 August, 2018 Multiplication Hardware Try an example: 2 * 3 with just 4 bits Table: Iteration #, Step (1a,2,3), Multiplier, Multiplicand, Product Initially 0 Chapter 3 — Arithmetic for Computers — 4 Chapter 3 — Arithmetic for Computers

Morgan Kaufmann Publishers August 8, 2018 Example 2*3 Now do an example with 8 bits: 0x62 * 0x12 Chapter 1 — Computer Abstractions and Technology

Signed Multiplication Option 1: Multiply with absolute value Compute the correct sign at end Option 2: Previously algorithm almost works “Sign extend” when shifting Chapter 1 — Computer Abstractions and Technology — 6

Morgan Kaufmann Publishers 8 August, 2018 Optimized Multiplier Refined Multiplier 32-bit multiplicand and ALU Multiplier is placed in the right half of the product register 64-bit product register Chapter 3 — Arithmetic for Computers

Morgan Kaufmann Publishers 8 August, 2018 Optimized Multiplier Perform steps in parallel: add/shift Multiplier is in the right half of the product register. One cycle per partial-product addition That’s ok, if frequency of multiplications is low Chapter 3 — Arithmetic for Computers — 8 Chapter 3 — Arithmetic for Computers

Alternative Multiplier One 32-bit adder for each bit of multiplier Input1 is multiplicand AND multiplier bit Input2 is output of previous adder “Chain” of adders, 32 high Chapter 1 — Computer Abstractions and Technology — 9

Morgan Kaufmann Publishers 8 August, 2018 Faster Multiplier Uses multiple adders Cost/performance tradeoff Not correct! Can be pipelined Several multiplication performed in parallel Chapter 3 — Arithmetic for Computers — 10 Chapter 3 — Arithmetic for Computers

Morgan Kaufmann Publishers 8 August, 2018 MIPS Multiplication Two 32-bit registers for product HI: most-significant 32 bits LO: least-significant 32-bits Instructions mult rs, rt / multu rs, rt 64-bit product in HI/LO mfhi rd / mflo rd Move from HI/LO to rd Can test HI value to see if product overflows 32 bits mul rd, rs, rt Least-significant 32 bits of product –> rd This last is a pseudoinstruction Chapter 3 — Arithmetic for Computers — 11 Chapter 3 — Arithmetic for Computers

Back to the Example A better way to do 2*3? 3 << 1 using SLL Almost all compilers will perform a strength reduction optimization by replacing multiplication of power of 2 by shifting

Morgan Kaufmann Publishers 8 August, 2018 Division §3.4 Division Check for 0 divisor Long division approach If divisor ≤ dividend bits 1 bit in quotient, subtract Otherwise 0 bit in quotient, bring down next dividend bit Restoring division Do the subtract, and if remainder goes < 0, add divisor back Signed division Divide using absolute values Adjust sign of quotient and remainder as required quotient dividend 1001 1000 1001010 -1000 10 101 1010 divisor remainder n-bit operands yield n-bit quotient and remainder Chapter 3 — Arithmetic for Computers — 13 Chapter 3 — Arithmetic for Computers

Morgan Kaufmann Publishers 8 August, 2018 Division Hardware First version of Division Hardware 32-bit quotient 64-bit ALU 64-bit remainder Initially divisor in left half Divisor starts in left half of divisor register, remainder initialized to dividend Initially dividend Chapter 3 — Arithmetic for Computers

First Version Division Hardware Morgan Kaufmann Publishers 8 August, 2018 First Version Division Hardware Initially divisor in left half Example: Fill out a table for 7/2 Table: Iteration, Step (1,2b,3), Quotient, Divisor, Remainder Initially dividend Chapter 3 — Arithmetic for Computers

Example 7/2