Lecture 12: Integer Arithmetic and Floating Point CS 2011 Fall 2014, Dr. Rozier.

Slides:



Advertisements
Similar presentations
Spring 2013 Advising Starts this week! CS2710 Computer Organization1.
Advertisements

Lecture 11 Oct 12 Circuits for floating-point operations addition multiplication division (only sketchy)
Computer Organization CS224 Fall 2012 Lesson 19. Floating-Point Example  What number is represented by the single-precision float …00 
Computer Engineering FloatingPoint page 1 Floating Point Number system corresponding to the decimal notation 1,837 * 10 significand exponent A great number.
Lecture 16: Computer Arithmetic Today’s topic –Floating point numbers –IEEE 754 representations –FP arithmetic Reminder –HW 4 due Monday 1.
Datorteknik FloatingPoint bild 1 Floating point Number system corresponding to the decimal notation 1,837 * 10 significand exponent a great number of corresponding.
Floating Point Numbers
Faculty of Computer Science © 2006 CMPUT 229 Floating Point Representation Operating with Real Numbers.
University of Washington Today Topics: Floating Point Background: Fractional binary numbers IEEE floating point standard: Definition Example and properties.
CS 447 – Computer Architecture Lecture 3 Computer Arithmetic (2)
Computer ArchitectureFall 2007 © September 5, 2007 Karem Sakallah CS 447 – Computer Architecture.
CMPE12cCyrus Bazeghi 1 What do floating-point numbers represent? Rational numbers with non-repeating expansions in the given base within the specified.
CMPE12cGabriel Hugh Elkaim 1 What do floating-point numbers represent? Rational numbers with non-repeating expansions in the given base within the specified.
ECE 15B Computer Organization Spring 2010 Dmitri Strukov Lecture 11: Floating Point Partially adapted from Computer Organization and Design, 4 th edition,
COMPUTER ARCHITECTURE & OPERATIONS I Instructor: Hao Ji.
Computer ArchitectureFall 2008 © August 27, CS 447 – Computer Architecture Lecture 4 Computer Arithmetic (2)
CPS Computer Architecture Assignment 4: Multiplication, Division, Floating Point.
Systems Architecture Lecture 14: Floating Point Arithmetic
Computer Organization and Architecture Computer Arithmetic Chapter 9.
Computer Arithmetic Nizamettin AYDIN
Computer Arithmetic. Instruction Formats Layout of bits in an instruction Includes opcode Includes (implicit or explicit) operand(s) Usually more than.
CEN 316 Computer Organization and Design Computer Arithmetic Floating Point Dr. Mansour AL Zuair.
Computing Systems Basic arithmetic for computers.
ECE232: Hardware Organization and Design
Floating Point Numbers Topics –IEEE Floating Point Standard –Rounding –Floating Point Operations –Mathematical properties.
CPS3340 COMPUTER ARCHITECTURE Fall Semester, /14/2013 Lecture 16: Floating Point Instructor: Ashraf Yaseen DEPARTMENT OF MATH & COMPUTER SCIENCE.
Lecture 7: Multiplication and Floating Point EEN 312: Processors: Hardware, Software, and Interfacing Department of Electrical and Computer Engineering.
CH09 Computer Arithmetic  CPU combines of ALU and Control Unit, this chapter discusses ALU The Arithmetic and Logic Unit (ALU) Number Systems Integer.
Oct. 18, 2007SYSC 2001* - Fall SYSC2001-Ch9.ppt1 See Stallings Chapter 9 Computer Arithmetic.
CSCI 6307 Foundation of Systems – Exercise (2) Xiang Lian The University of Texas – Pan American Edinburg, TX
Instructor: Andrew Case Floating Point Slides adapted from Randy Bryant & Dave O’Hallaron.
CSC 221 Computer Organization and Assembly Language
Floating Point Arithmetic
Floating Point Representation for non-integral numbers – Including very small and very large numbers Like scientific notation – –2.34 × –
COMP201 Computer Systems Floating Point Numbers. Floating Point Numbers  Representations considered so far have a limited range dependent on the number.
Lecture notes Reading: Section 3.4, 3.5, 3.6 Multiplication
Computer Engineering FloatingPoint page 1 Floating Point Number system corresponding to the decimal notation 1,837 * 10 significand exponent A great number.
Chapter 3 Arithmetic for Computers. Chapter 3 — Arithmetic for Computers — 2 Arithmetic for Computers Operations on integers Addition and subtraction.
Floating Point Numbers Representation, Operations, and Accuracy CS223 Digital Design.
C OMPUTER O RGANIZATION AND D ESIGN The Hardware/Software Interface 5 th Edition Chapter 3 Arithmetic for Computers.
Numbers in Computers.
CS 232: Computer Architecture II Prof. Laxmikant (Sanjay) Kale Floating point arithmetic.
Fixed-point and floating-point numbers Ellen Spertus MCS 111 October 4, 2001.
Chapter 9 Computer Arithmetic
William Stallings Computer Organization and Architecture 8th Edition
Morgan Kaufmann Publishers Arithmetic for Computers
Computer Architecture & Operations I
Morgan Kaufmann Publishers Arithmetic for Computers
Floating Point Number system corresponding to the decimal notation
Morgan Kaufmann Publishers
PRESENTED BY J.SARAVANAN. Introduction: Objective: To provide hardware support for floating point arithmetic. To understand how to represent floating.
Arithmetic for Computers
Outline Introduction Floating Point Arithmetic Adder Multiplier.
Floating Point Arithmetic
ECEG-3202 Computer Architecture and Organization
Morgan Kaufmann Publishers Arithmetic for Computers
Floating Point Arithmetic
Presentation transcript:

Lecture 12: Integer Arithmetic and Floating Point CS 2011 Fall 2014, Dr. Rozier

FULL ADDER SOLUTIONS

INTEGER ARITHMETIC

Putting Together Multiple Bits

Making it Faster Carry Look Ahead Adder

Making it Even Faster Carry-Select Adder Kogge-Stone Adder

How do we get subtraction? XB2T(X)B2U(X) –88 –79 –610 –511 –412 –313 –214 –

How do we get subtraction? XB2T(X)B2U(X) –88 –79 –610 –511 –412 –313 –214 – x ~x

FLOATING POINT

Carnegie Mellon Fractional binary numbers What is ?

2i2i 2 i /2 1/4 1/8 2 -j bibi b i-1 b2b2 b1b1 b0b0 b -1 b -2 b -3 b -j Carnegie Mellon Fractional Binary Numbers Representation – Bits to right of “binary point” represent fractional powers of 2 – Represents rational number:

Carnegie Mellon Fractional Binary Numbers: Examples ValueRepresentation 5 3/ / / Observations  Divide by 2 by shifting right  Multiply by 2 by shifting left  Numbers of form … 2 are just below 1.0  1/2 + 1/4 + 1/8 + … + 1/2 i + … ➙ 1.0  Use notation 1.0 – ε

Carnegie Mellon Representable Numbers Limitation – Can only exactly represent numbers of the form x/2 k – Other rational numbers have repeating bit representations ValueRepresentation – 1/ [01]… 2 – 1/ [0011]… 2 – 1/ [0011]… 2

Floating Point Standard Defined by IEEE Std Developed in response to divergence of representations – Portability issues for scientific code Now almost universally adopted Two representations – Single precision (32-bit) – Double precision (64-bit)

IEEE Floating-Point Format S: sign bit (0  non-negative, 1  negative) Normalize significand: 1.0 ≤ |significand| < 2.0 – Always has a leading pre-binary-point 1 bit, so no need to represent it explicitly (hidden bit) – Significand is Fraction with the “1.” restored Exponent: excess representation: actual exponent + Bias – Ensures exponent is unsigned – Single: Bias = 127; Double: Bias = 1203 SExponentFraction single: 8 bits double: 11 bits single: 23 bits double: 52 bits

Floating-Point Addition Consider a 4-digit decimal example – × × 10 –1 1. Align decimal points – Shift number with smaller exponent – × × Add significands – × × 10 1 = × Normalize result & check for over/underflow – × Round and renormalize if necessary – × 10 2

Floating-Point Addition Now consider a 4-digit binary example – × 2 –1 + – × 2 –2 (0.5 + –0.4375) 1. Align binary points – Shift number with smaller exponent – × 2 –1 + – × 2 –1 2. Add significands – × 2 –1 + – × 2 –1 = × 2 –1 3. Normalize result & check for over/underflow – × 2 –4, with no over/underflow 4. Round and renormalize if necessary – × 2 –4 (no change) =

FP Adder Hardware Much more complex than integer adder Doing it in one clock cycle would take too long – Much longer than integer operations – Slower clock would penalize all instructions FP adder usually takes several cycles – Can be pipelined

FP Adder Hardware Step 1 Step 2 Step 3 Step 4

FP Arithmetic Hardware FP multiplier is of similar complexity to FP adder – But uses a multiplier for significands instead of an adder FP arithmetic hardware usually does – Addition, subtraction, multiplication, division, reciprocal, square-root – FP  integer conversion Operations usually takes several cycles – Can be pipelined

Floating Point Floating Point is handled by a FPU, floating point unit.

Pentium FDIV Bug Intel’s Pentium 5 – Professor Thomas Nicely noticed inconsistencies in calculations when adding Pentiums to his cluster – Floating-point division operations didn’t quite come out right. Off by 61 parts per million

Pentium FDIV Bug Intel acknowledged the flaw, but claimed it wasn’t serious. Wouldn’t affect most users. Byte magazine estimated only 1 in 9 billion floating point operations would suffer the error.

Pentium FDIV Bug Total cost to Intel? $450 million

WRAP UP

For next time Read Chapter

For next time Read Chapter 3 Sections 3.1 – 3.5