Signed Multiplication Multiply the positives Negate result if signs of operand are different

Similar documents
Floating Point. The World is Not Just Integers. Programming languages support numbers with fraction

Computer Architecture Chapter 3. Fall 2005 Department of Computer Science Kent State University

Chapter 3: Arithmetic for Computers

COMP2611: Computer Organization. Data Representation

ECE331: Hardware Organization and Design

Arithmetic for Computers

Arithmetic for Computers. Hwansoo Han

CSCI 402: Computer Architectures. Arithmetic for Computers (3) Fengguang Song Department of Computer & Information Science IUPUI.

Divide: Paper & Pencil

Chapter Three. Arithmetic

Lecture 13: (Integer Multiplication and Division) FLOATING POINT NUMBERS

Thomas Polzer Institut für Technische Informatik

Chapter 03: Computer Arithmetic. Lesson 09: Arithmetic using floating point numbers

Floating Point Arithmetic

3.5 Floating Point: Overview

CO212 Lecture 10: Arithmetic & Logical Unit

Number Systems and Their Representations

COMPUTER ORGANIZATION AND DESIGN

Chapter 3. Arithmetic Text: P&H rev

Lecture 8: Addition, Multiplication & Division

Floating Point Arithmetic. Jin-Soo Kim Computer Systems Laboratory Sungkyunkwan University

Computer Organization and Structure. Bing-Yu Chen National Taiwan University

Floating-point Arithmetic. where you sum up the integer to the left of the decimal point and the fraction to the right.

FLOATING POINT NUMBERS

CS Computer Architecture. 1. Explain Carry Look Ahead adders in detail

MIPS Integer ALU Requirements

Arithmetic. Chapter 3 Computer Organization and Design

Chapter 3 Arithmetic for Computers (Part 2)

Computer Architecture and IC Design Lab. Chapter 3 Part 2 Arithmetic for Computers Floating Point

TDT4255 Computer Design. Lecture 4. Magnus Jahre

Computer Architecture. Chapter 3: Arithmetic for Computers

CPS 104 Computer Organization and Programming

Module 2: Computer Arithmetic

Rui Wang, Assistant professor Dept. of Information and Communication Tongji University.

Math in MIPS. Subtracting a binary number from another binary number also bears an uncanny resemblance to the way it s done in decimal.

Chapter 3 Arithmetic for Computers

Number Systems and Computer Arithmetic

ECE 30 Introduction to Computer Engineering

Floating-Point Data Representation and Manipulation 198:231 Introduction to Computer Organization Lecture 3

Review: MIPS Organization

ECE232: Hardware Organization and Design

Floating Point Numbers

COSC 243. Data Representation 3. Lecture 3 - Data Representation 3 1. COSC 243 (Computer Architecture)

ECE260: Fundamentals of Computer Engineering

Chapter 2 Data Representations

Floating Point Arithmetic

Chapter 3. Arithmetic for Computers

IEEE Standard for Floating-Point Arithmetic: 754

Floating Point Numbers. Lecture 9 CAP

Number Systems Standard positional representation of numbers: An unsigned number with whole and fraction portions is represented as:

Integer Arithmetic. Jinkyu Jeong Computer Systems Laboratory Sungkyunkwan University

Data Representations & Arithmetic Operations

Inf2C - Computer Systems Lecture 2 Data Representation

Number Systems. Both numbers are positive

Floating Point COE 308. Computer Architecture Prof. Muhamed Mudawar. Computer Engineering Department King Fahd University of Petroleum and Minerals

Integer Multiplication and Division

Homework 3. Assigned on 02/15 Due time: midnight on 02/21 (1 WEEK only!) B.2 B.11 B.14 (hint: use multiplexors) CSCI 402: Computer Architectures

Numeric Encodings Prof. James L. Frankel Harvard University

NUMBER OPERATIONS. Mahdi Nazm Bojnordi. CS/ECE 3810: Computer Organization. Assistant Professor School of Computing University of Utah

xx.yyyy Lecture #11 Floating Point II Summary (single precision): Precision and Accuracy Fractional Powers of 2 Representation of Fractions

ECE331: Hardware Organization and Design

Chapter 2 Float Point Arithmetic. Real Numbers in Decimal Notation. Real Numbers in Decimal Notation

Computer (Literacy) Skills. Number representations and memory. Lubomír Bulej KDSS MFF UK

Floating-point representations

Floating-point representations

IT 1204 Section 2.0. Data Representation and Arithmetic. 2009, University of Colombo School of Computing 1

Tailoring the 32-Bit ALU to MIPS

Chapter 3. Arithmetic for Computers

Computer Arithmetic Floating Point

COMPUTER ORGANIZATION AND DESIGN. 5 th Edition. The Hardware/Software Interface. Chapter 3. Arithmetic for Computers

Chapter 3. Arithmetic for Computers

Floating Point Arithmetic

IEEE Standard 754 for Binary Floating-Point Arithmetic.

The ALU consists of combinational logic. Processes all data in the CPU. ALL von Neuman machines have an ALU loop.

5DV118 Computer Organization and Architecture Umeå University Department of Computing Science Stephen J. Hegner. Topic 3: Arithmetic

Outline. EEL-4713 Computer Architecture Multipliers and shifters. Deriving requirements of ALU. MIPS arithmetic instructions

ECE331: Hardware Organization and Design

Computer Architecture Set Four. Arithmetic

Representing and Manipulating Floating Points. Jo, Heeseung

Organisasi Sistem Komputer

CS61C : Machine Structures

EE260: Logic Design, Spring n Integer multiplication. n Booth s algorithm. n Integer division. n Restoring, non-restoring

Boolean Algebra. Chapter 3. Boolean Algebra. Chapter 3 Arithmetic for Computers 1. Fundamental Boolean Operations. Arithmetic for Computers

Introduction to Computers and Programming. Numeric Values

Floating Point Representation in Computers

Number Systems. Decimal numbers. Binary numbers. Chapter 1 <1> 8's column. 1000's column. 2's column. 4's column

CS 261 Fall Floating-Point Numbers. Mike Lam, Professor.

CHW 261: Logic Design

NAME: 1a. (10 pts.) Describe the characteristics of numbers for which this floating-point data type is well-suited. Give an example.

Chapter 5 : Computer Arithmetic

The Sign consists of a single bit. If this bit is '1', then the number is negative. If this bit is '0', then the number is positive.

Number Systems and Binary Arithmetic. Quantitative Analysis II Professor Bob Orr

Floating Point January 24, 2008

Floating point. Today! IEEE Floating Point Standard! Rounding! Floating Point Operations! Mathematical properties. Next time. !

CS 261 Fall Floating-Point Numbers. Mike Lam, Professor.

Chapter 3. Arithmetic for Computers

CS 265. Computer Architecture. Wei Lu, Ph.D., P.Eng.

Integers and Floating Point

Recap from Last Time. CSE 2021: Computer Organization. It s All about Numbers! 5/12/2011. Text Pictures Video clips Audio

Data Representation in Computer Memory

Transcription:

Another Improvement Save on space: Put multiplier in product saves on speed: only single shift needed Figure: Improved hardware for multiplication

Signed Multiplication Multiply the positives Negate result if signs of operand are different

Multiplication and Division in MIPS mult, multu; div, divu Result in LO and HI Use mflo and mfhi for result

Floating Point Real numbers 3.14159 (π) 0.00000000001(1.0 10 9 ) 2.71828 (e)

Floating Point Real numbers 3.14159 (π) 0.00000000001(1.0 10 9 ) 2.71828 (e) Floating numbers: position of binary point is not fixed. Just like float in C. vs. fixed-point systems

Floating Point Real numbers 3.14159 (π) 0.00000000001(1.0 10 9 ) 2.71828 (e) Floating numbers: position of binary point is not fixed. Just like float in C. vs. fixed-point systems Scientific notation

Floating Point Real numbers 3.14159 (π) 0.00000000001(1.0 10 9 ) 2.71828 (e) Floating numbers: position of binary point is not fixed. Just like float in C. vs. fixed-point systems Scientific notation Normalized no leading 0

Floating Point Real numbers 3.14159 (π) 0.00000000001(1.0 10 9 ) 2.71828 (e) Floating numbers: position of binary point is not fixed. Just like float in C. vs. fixed-point systems Scientific notation Normalized no leading 0 Exponent no. of positions to move the point in the fraction

Binary Floating Numbers Binary point (analogous to decimal point) 1.101 two 2 4

Binary Floating Numbers Binary point (analogous to decimal point) 1.101 two 2 4 In general 1.xxxxxxx two 2 yyyy

Binary Floating Numbers Binary point (analogous to decimal point) 1.101 two 2 4 In general 1.xxxxxxx two 2 yyyy Why 1 in fraction? (Will use exponent in decimal for simplicity)

Binary Floating Numbers In design: compromise between sizes of fraction and exponent between precision and range since fixed word size

Binary Floating Numbers In design: compromise between sizes of fraction and exponent between precision and range since fixed word size Represent in (floating) binary word as: S (sign bit): 1 bit (31st bit) ( 1) S F 2 E E (exponent): 8 bits (bits 23 to 30) F (significand, fraction): 23 bits (bits 0 to 22)

Binary Floating Numbers In design: compromise between sizes of fraction and exponent between precision and range since fixed word size Represent in (floating) binary word as: S (sign bit): 1 bit (31st bit) ( 1) S F 2 E E (exponent): 8 bits (bits 23 to 30) F (significand, fraction): 23 bits (bits 0 to 22) Not just MIPS formats: IEEE 754 floating-point standard

Overflow & Underflow Range: 2.0 ten 10 38 to 2.0 ten 10 38

Overflow & Underflow Range: 2.0 ten 10 38 to 2.0 ten 10 38 Overflow: Too large to represent exponent too large to fit in 8 bits

Overflow & Underflow Range: 2.0 ten 10 38 to 2.0 ten 10 38 Overflow: Too large to represent exponent too large to fit in 8 bits Underflow: Too accurate to represent Negative exponent too large to fit

double format double-precision floating-point

double format double-precision floating-point vs. single-precision

double format double-precision floating-point vs. single-precision Uses two MIPS words

double format double-precision floating-point vs. single-precision Uses two MIPS words S: 31st bit of 1st register E: bits 30 to 20 of 1st register F: rest 20 bits of 1st register + 32 bits of 2nd

double format double-precision floating-point vs. single-precision Uses two MIPS words S: 31st bit of 1st register E: bits 30 to 20 of 1st register F: rest 20 bits of 1st register + 32 bits of 2nd Increased range: 2.0 ten 10 308 to 2.0 ten 10 308

Another Optimization Normalized Make leading 1-bit implicit

Another Optimization Normalized Make leading 1-bit implicit 24 bits for significand 53 bits for double-precision

Another Optimization Normalized Make leading 1-bit implicit 24 bits for significand 53 bits for double-precision Also use biased notation for exponent instead of two s complement

Another Optimization Normalized Make leading 1-bit implicit 24 bits for significand 53 bits for double-precision Also use biased notation for exponent instead of two s complement Subtract 127 from actual value 1023 for double precision

Another Optimization Normalized Make leading 1-bit implicit 24 bits for significand 53 bits for double-precision Also use biased notation for exponent instead of two s complement Subtract 127 from actual value 1023 for double precision 0000 0000 is for 0 1111 1111 is for infinity

Another Optimization Normalized Make leading 1-bit implicit 24 bits for significand 53 bits for double-precision Also use biased notation for exponent instead of two s complement Subtract 127 from actual value 1023 for double precision 0000 0000 is for 0 1111 1111 is for infinity

IEEE 754 Representation Final representation: ( 1) S (1 + F) 2 ( E 127)

Advantages of Normalized Scientific Notation Simplifies exchange of floating point data Simplifies arithmetic Increases accuracy: unnecessary leading 0 s are replaced by real numbers on the right