Multipliers CPSC 321 Computer Architecture Andreas Klappenecker.

Slides:



Advertisements
Similar presentations
Arithmetic for Computers
Advertisements

Datorteknik ArithmeticCircuits bild 1 Computer arithmetic Somet things you should know about digital arithmetic: Principles Architecture Design.
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
Computer Architecture ECE 361 Lecture 6: ALU Design
Prof. John Nestor ECE Department Lafayette College Easton, Pennsylvania ECE Computer Organization Lecture 8 - Multiplication.
CMPT 334 Computer Organization Chapter 3 Arithmetic for Computers [Adapted from Computer Organization and Design 5 th Edition, Patterson & Hennessy, ©
CML CML CS 230: Computer Organization and Assembly Language Aviral Shrivastava Department of Computer Science and Engineering School of Computing and Informatics.
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?
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.
Chap 3.3~3.5 Construction an Arithmetic Logic Unit (ALU) Jen-Chang Liu, Spring 2006.
Integer Multiplication and Division
Contemporary Logic Design Arithmetic Circuits © R.H. Katz Lecture #24: Arithmetic Circuits -1 Arithmetic Circuits (Part II) Randy H. Katz University of.
1 Lecture 8: Binary Multiplication & Division Today’s topics:  Addition/Subtraction  Multiplication  Division Reminder: get started early on assignment.
Review CPSC 321 Andreas Klappenecker. Administrative Issues Midterm is on October 12 Allen Parish’s help session Friday 10:15-12:15.
Arithmetic III CPSC 321 Andreas Klappenecker. Any Questions?
1 Lecture 4: Arithmetic for Computers (Part 4) CS 447 Jason Bakos.
ECE 232 L9.Mult.1 Adapted from Patterson 97 ©UCBCopyright 1998 Morgan Kaufmann Publishers ECE 232 Hardware Organization and Design Lecture 9 Computer Arithmetic.
Lecture Objectives: 1)Explain the relationship between addition and subtraction with twos complement numbering systems 2)Explain the concept of numeric.
Multiplication CPSC 252 Computer Organization Ellen Walker, Hiram College.
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.
Lec 13Systems Architecture1 Systems Architecture Lecture 13: Integer Multiplication and Division Jeremy R. Johnson Anatole D. Ruslanov William M. Mongan.
King Fahd University of Petroleum and Minerals King Fahd University of Petroleum and Minerals Computer Engineering Department Computer Engineering Department.
Lecture 6: Multiply, Shift, and Divide
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.
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
Orange Coast College Business Division Computer Science Department CS 116- Computer Architecture Arithmetic: Part II.
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.
Two’s and one’s complement arithmetic CLOCK ARITHMETIC.
Integer Multiplication and Division COE 301 Computer Organization Dr. Muhamed Mudawar College of Computer Sciences and Engineering King Fahd University.
COMPUTER ARITHMETIC Arithmetic with Signed-2's Complement Numbers
Integer Operations Computer Organization and Assembly Language: Module 5.
Ch. 4 Computer Arithmetic
Multipliers. More complicated than addition accomplished via shifting and addition More time and more area Multiplication What should be the length of.
Arithmetic Intro Computer Organization 1 Computer Science Dept Va Tech February 2008 © McQuain Multiplication Design 1.0 Multiplicand Shift left.
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.
1 Lecture 5Multiplication and Division ECE 0142 Computer Organization.
Computer System Design Lecture 3
COMPUTER ARITHMETIC Arithmetic with Signed-2's Complement Numbers
Multiplication and Division basics
Somet things you should know about digital arithmetic:
Computer Architecture & Operations I
Integer Multiplication and Division
MIPS mul/div instructions
CSCI206 - Computer Organization & Programming
Part II : Lecture III By Wannarat.
Morgan Kaufmann Publishers
Lecture 8: Binary Multiplication & Division
Multiplication & Division
CDA 3101 Summer 2007 Introduction to Computer Organization
CDA 3101 Spring 2016 Introduction to Computer Organization
Lecture 8: Addition, Multiplication & Division
Lecture 8: Addition, Multiplication & Division
CDA 3101 Summer 2007 Introduction to Computer Organization
Computer Organization and Design
Arithmetic Logical Unit
A.R. Hurson 323 CS Building, Missouri S&T
October 15 Chapter 4 – Multiplication/Division Go to the State Fair!
Computer Architecture EECS 361 Lecture 6: ALU Design
October 5 Register to vote! Go to the State Fair! (15-24 October)
1 Lecture 5Multiplication and Division ECE 0142 Computer Organization.
Presentation transcript:

Multipliers CPSC 321 Computer Architecture Andreas Klappenecker

Multiplication

Multiplication: Implementation

Multiplication  If each step took a clock cycle, this algorithm would use almost 100 clock cycles to multiply two 32-bit numbers.  Requires 64-bit wide adder  Multiplicand register 64-bit wide

Variations on a Theme Product register has to be 64-bit Can we take advantage of that fact? Yes! Add multiplicand to 32 MSBs product = product >> 1 Repeat last steps New algorithm needs fewer resources

Second Version

Critique Registers needed for multiplicand multiplier product Use lower 32 bits of product register: place multiplier in lower 32 bits add multiplicand to higher 32 bits product = product >> 1 repeat

Final Version

Multiplying Signed Numbers If sign(a)!=sign(b) then s = true a = abs(a) b = abs(b) p = a*b /* multiply as before */ negate p if s = true Algorithm is straightforward but awkward

Some observations = 14 = = 16 – 2 Runs of 1s (current bit, bit to the right): 10 beginning of run 11 middle of a run 01 end of a run of 1s 00 middle of a run of 0s

Booth’s multiplication Booth’s algorithm looks at 2 bits of the multiplier and modifies the previous algorithm as follows: 00 middle of 0s run, no arithmetic op 01 end of a string of 1s, add multiplicand to left part of product 11 middle of 1s run, no arithmetic op 10 start of run of 1s, subtract multiplicand from left part of product

Example: 0010 x 0110 IterationMcandStepProduct Initial values : no op arith>> : prod-=Mcand arith>> : no op arith>> : prod+=Mcand arith>>

Why Booth’s algorithm works a=(a 31 a 30 a 29 a 28 … a 3 a 2 a 1 a 0.a -1 ) 2 Express a*b as (a -1 – a 0 ) x b x 2 0 (a 0 – a 1 ) x b x 2 1 (a 1 – a 2 ) x b x 2 2 … (a 29 – a 30 ) x b x (a 30 – a 31 ) x b x 2 31 b x (- a a …+ a a ) 01: 1-0 = add 10: 0-1 = sub 11: 1-1 = nop 00: 0-0 = nop

Conclusions The Booth multiplication works for two’s complement numbers In MIPS assembly language mult or multu Result contained in registers Hi and Lo mflo = move the lower 32 bits mfhi = move the higher 32 bits