CSCI 402: Computer Architectures. Arithmetic for Computers (4) Fengguang Song Department of Computer & Information Science IUPUI.
|
|
- Esmond Jones
- 6 years ago
- Views:
Transcription
1 CSCI 402: Computer Architectures Arithmetic for Computers (4) Fengguang Song Department of Computer & Information Science IUPUI Homework 4 Assigned on Feb 22, Thursday Due Time: 11:59pm, March 5 on Monday night You have 1.5 weeks (not 2 weeks!) TA will post the solution on March 6 or 7 Your Midterm Exam is on March 8 so you can prepare for it , 3.18 (assuming both inputs are two-digit octal numbers consisting of 6 binary bits) 3.20, 3.22, 3.23, 3.24, , 3.42,
2 IEEE Floating-Point Format single: 8 bits double: 11 bits S Exponent single: 23 bits double: 52 bits Fraction x = ( 1) S (1+Fraction) 2 [0, 255] (stored Exponent Bias) S: sign bit (0 Þ non-negative, 1 Þ negative) Normalized significand: 1.0 significand < 2.0 Always has a leading (pre-binary-point) 1, so no need to represent it explicitly ( hidden bit ) Significand = Fraction with the 1. restored Stored exponent = actual exponent + Bias Actual exponent = stored exponent - Bias Stored exponent is unsigned: e.g., 0 to 255, or 0 to 2047 Single: Bias = 127; Double: Bias = Floating-Point Example (1/2) Q: How to represent (= ) 0.75 = ( ) //normalized number S = 1 Fraction = Stored exponent = 1 + Bias Single: = 126 = Double: = 1022 = Single: Double:
3 Floating-Point Example (2/2) Q: What decimal value is represented by the following single-precision floating-point number? S = 1 Stored exponent = = 129 Fraction = x = ( 1) 1 ( ) 2 ( ) = ( 1) = Floating-Point Addition (base 10) First, consider a decimal example (suppose 4 digits of significand and 2 digits of exponent) Align decimal points (equal exponent) 4 Steps Shift the number with smaller exponent Now, exponents are equal 2. Add significands = Normalize result & check for over/underflow Round and renormalize the output if necessary
4 Floating-Point Addition (binary) Similarly, consider a 4-digit binary example (i.e., ) Step 1. Align binary points (s.t. equal exponent) Shift the number with smaller exponent Step 2. Add significands = Step 3. Normalize result & check for over/underflow , //-4 is between -127 and 128. Step 4. Round and renormalize if necessary (no change) = FP Adder Hardware Step 1 Larger exp Smaller frac Larger frac Step 2 New faction Step 3 Step
5 FP Adder Hardware It is more complex than integer adder Doing it in one cycle would make the clock cycle too long! Note that a slower clock would penalize all instructions So, FP Adder takes several cycles Can be pipelined 12 Next: Floating Point Multiplication Given two Operands (2 normalized inputs) as follows: (-1) S1 m1 2 E1 // m1 is the significand: 1.xxxxx (-1) S2 m2 2 E2 Exact Result? Suppose it is: (-1) S m 2 E Sign s: s = 1 if s1 ¹ s2; s = 0 otherwise Significand m: m1 * m2 //just multiply two significands Exponent E: E1 + E2 Fixing result: Round output m to fit the significand precision Overflow if E out of range Implementation: The most complex part is multiplying 2 significands 13 5
6 Floating-Point Multiplication Again, first consider a decimal example (suppose 4 digits of significand and 2 digits of exponent) Add exponents New exponent = = 5 2. Multiply the two significands = Þ Normalize result & check for over/underflow Round and renormalize if necessary Determine sign of result from signs of operands Floating-Point Multiplication Now, let s consider a 4-digit binary example ( ) 1. Add exponents Unbiased: = 3 2. Multiply significands = Þ Normalize result & check for over/underflow // no over/underflow 4. Round and renormalize if necessary // (no change) 5. Determine sign: +ve ve Þ ve =
7 1.000 x FP MIPS Instructions Floating point hardware is an adjunct processor that extends the existing MIPS ISA Called coprocessor 1 (c1) There are 32 separate FP registers 32 single-precision: $f0, $f1, $f31 Can be paired for storing double-precision: $f0/$f1, $f2/$f3, i.e., 16 double-precision registers FP Instructions can operate only on FP registers Also, special load and store instructions lwc1, swc1 ldc1, sdc1 e.g., lwc1 $f8, 32($sp) 17 7
8 CPU (central processing unit) FPU (floating point unit) "coprocessor 1" mfc1 register $0,..,$31 integer arithmetic division multiplication logical ops mtc1 register $f0,.. $f31 floating point arithmetic divison multiplication int float convert sw lwc1 lw swc1 Memory (2^32 bytes) 18 FP MIPS Instructions Single-precision arithmetic add.s, sub.s, mul.s, div.s e.g., add.s $f0, $f1, $f6 //F0=F1+F6 Double-precision arithmetic add.d, sub.d, mul.d, div.d e.g., mul.d $f4, $f4, $f6 //F4=F4*F6 Comparison c.xx.s, c.xx.d (xx is eq, lt, le, ) will set FP condition-code bit e.g. c.lt.s $f3, $f4 Branch on FP condition code true or false bc1t ( branch C1 true ), bc1f ( branch C1 false ) e.g., bc1t TargetLabel 19 8
9 FP MIPS Example: F to C C code: float f2c (float fahr) { return ((5.0/9.0)*(fahr )); } fahr in $f12, result in $f0, literals stored in Global memory Compiled MIPS code: f2c: lwc1 $f16, const5($gp) lwc1 $f18, const9($gp) div.s $f16, $f16, $f18 lwc1 $f18, const32($gp) sub.s $f18, $f12, $f18 mul.s $f0, $f16, $f18 jr $ra //F16 = 5.0/9.0 //product result 20 FP Example: Array Multiplication X = X + Y Z All matrices, 64-bit double-precision elements C code: void mm (double x[][], double y[][], double z[][]) { int i, j, k; } for (i = 0; i! = 32; i = i + 1) for (j = 0; j! = 32; j = j + 1) for (k = 0; k! = 32; k = k + 1) x[i][j] = x[i][j] + y[i][k] * z[k][j]; Addresses of x, y, z in $a0, $a1, $a2, and i, j, k in $s0, $s1, $s2 21 9
10 n FP Example: Array Multiplication MIPS code: li $t1, 32 # $t1 = 32 (row size/loop end) li $s0, 0 # i = 0; initialize 1st for loop L1: li $s1, 0 # j = 0; restart 2nd for loop L2: li $s2, 0 # k = 0; restart 3rd for loop sll $t2, $s0, 5 # $t2 = i * 32, i-th row addu $t2, $t2, $s1 # $t2 = i * 32 + j, j-th column sll $t2, $t2, 3 # $t2 = byte offset of [i][j] addu $t2, $a0, $t2 # $t2 = byte address of x[i][j] l.d $f4, 0($t2) # $f4 = 8 bytes of x[i][j] L3: sll $t0, $s2, 5 # $t0 = k * 32, k-th row addu $t0, $t0, $s1 # $t0 = k * 32 + j, j-th column sll $t0, $t0, 3 # $t0 = byte offset of [k][j] addu $t0, $a2, $t0 # $t0 = byte address of z[k][j] l.d $f16, 0($t0) # $f16 = 8 bytes of z[k][j] 22 Accuracy of Floating Point Numbers Only a subset of real numbers can be represented by computer! 24 10
11 Accurate Arithmetic NOTE: Floating-point numbers are approximations of real numbers 53 bits vs infinite number of real numbers (consider [0.0, 1.0]) IEEE Std 754 offers a rounding control Allow programmer to fine-tune numerical behavior of a computation HW always keeps two extra bits of precision (guard, round) Will be used during intermediate computations But not all FP hardware implement all options Most programming languages and FP libraries just use defaults 25 Accurate Arithmetic Guard & Round bits IEEE 754 standard specifies the use of 2 extra bits on the right during intermediate calculations Guard bit and Round bit Example: Add and assuming 3 significant digits and without guard and round bits = With guard and round bits ROUND
12 IEEE Std 754 has 4 different rounding modes 1st is the default; Others are called directed rounding. Round to Nearest round to the nearest value And Ties to Even : If the number falls midway, it is rounded to the nearest even number Round toward 0 directed rounding towards zero (or truncation) Round toward + directed rounding towards positive infinity (ceiling) Round toward directed rounding towards negative infinity (floor) $1.40 $1.60 $1.50 $2.50 -$1.50 Nearest even $1.00 $2.00 $2.00 $2.00 -$ Accurate Arithmetic A conceptual view: First compute exact result Then make it fit into the desired precision Possibly overflow if exponent too large Possibly round to fit into significand Rounding modes (illustrate with $ rounding) $1.40 $1.60 $1.50 $2.50 -$1.50 Zero $1.00 $1.00 $1.00 $2.00 -$ $1.00 $1.00 $1.00 $2.00 -$ $2.00 $2.00 $2.00 $3.00 -$1.00 Nearest even $1.00 $2.00 $2.00 $2.00 -$2.00 Rounding methods in case of tie cases (fraction = 0.5) No problems in case of fraction 0.5 However, IRS always round up 0.5! Fused Multiply Add: a = a + (b x c). //round only once at the end! 28 12
13 Interpretation of Data The BIG Picture Bits have no inherent meaning! Could be anything E.g., 32 bits, what does it mean? Interpretation depends on the instruction applied Computer representations of numbers have limited range and limited precision You must know they are approximations (have rounding errors)
Written Homework 3. Floating-Point Example (1/2)
Written Homework 3 Assigned on Tuesday, Feb 19 Due Time: 11:59pm, Feb 26 on Tuesday Problems: 3.22, 3.23, 3.24, 3.41, 3.43 Note: You have 1 week to work on homework 3. 3 Floating-Point Example (1/2) Q:
More informationFloating Point Arithmetic. Jin-Soo Kim Computer Systems Laboratory Sungkyunkwan University
Floating Point Arithmetic Jin-Soo Kim (jinsookim@skku.edu) Computer Systems Laboratory Sungkyunkwan University http://csl.skku.edu Floating Point (1) Representation for non-integral numbers Including very
More informationFloating Point Arithmetic
Floating Point Arithmetic Jinkyu Jeong (jinkyu@skku.edu) Computer Systems Laboratory Sungkyunkwan University http://csl.skku.edu EEE3050: Theory on Computer Architectures, Spring 2017, Jinkyu Jeong (jinkyu@skku.edu)
More informationComputer Architecture and IC Design Lab. Chapter 3 Part 2 Arithmetic for Computers Floating Point
Chapter 3 Part 2 Arithmetic for Computers Floating Point Floating Point Representation for non integral numbers Including very small and very large numbers 4,600,000,000 or 4.6 x 10 9 0.0000000000000000000000000166
More informationChapter 3. Arithmetic for Computers
Chapter 3 Arithmetic for Computers Arithmetic for Computers Operations on integers Addition and subtraction Multiplication and division Dealing with overflow Floating-point real numbers Representation
More informationChapter 3. Arithmetic for Computers
Chapter 3 Arithmetic for Computers Arithmetic for Computers Operations on integers Addition and subtraction Multiplication and division Dealing with overflow Floating-point real numbers Representation
More informationThomas Polzer Institut für Technische Informatik
Thomas Polzer tpolzer@ecs.tuwien.ac.at Institut für Technische Informatik Operations on integers Addition and subtraction Multiplication and division Dealing with overflow Floating-point real numbers VO
More informationChapter 3. Arithmetic Text: P&H rev
Chapter 3 Arithmetic Text: P&H rev3.29.16 Arithmetic for Computers Operations on integers Addition and subtraction Multiplication and division Dealing with overflow Floating-point real numbers Representation
More informationChapter 3. Arithmetic for Computers
Chapter 3 Arithmetic for Computers Arithmetic for Computers Operations on integers Addition and subtraction Multiplication and division Dealing with overflow Floating-point real numbers Representation
More informationCOMPUTER ORGANIZATION AND DESIGN
COMPUTER ORGANIZATION AND DESIGN The Hardware/Software Interface 5 th Edition Chapter 3 Arithmetic for Computers Arithmetic for Computers Operations on integers Addition and subtraction Multiplication
More informationTDT4255 Computer Design. Lecture 4. Magnus Jahre
1 TDT4255 Computer Design Lecture 4 Magnus Jahre 2 Chapter 3 Computer Arithmetic ti Acknowledgement: Slides are adapted from Morgan Kaufmann companion material 3 Arithmetic for Computers Operations on
More informationArithmetic for Computers. Hwansoo Han
Arithmetic for Computers Hwansoo Han Arithmetic for Computers Operations on integers Addition and subtraction Multiplication and division Dealing with overflow Floating-point real numbers Representation
More informationComputer Organization and Structure. Bing-Yu Chen National Taiwan University
Computer Organization and Structure Bing-Yu Chen National Taiwan University Arithmetic for Computers Addition and Subtraction Gate Logic and K-Map Method Constructing a Basic ALU Arithmetic Logic Unit
More informationArithmetic. Chapter 3 Computer Organization and Design
Arithmetic Chapter 3 Computer Organization and Design Addition Addition is similar to decimals 0000 0111 + 0000 0101 = 0000 1100 Subtraction (negate) 0000 0111 + 1111 1011 = 0000 0010 Over(under)flow For
More information3.5 Floating Point: Overview
3.5 Floating Point: Overview Floating point (FP) numbers Scientific notation Decimal scientific notation Binary scientific notation IEEE 754 FP Standard Floating point representation inside a computer
More informationFloating Point COE 308. Computer Architecture Prof. Muhamed Mudawar. Computer Engineering Department King Fahd University of Petroleum and Minerals
Floating Point COE 38 Computer Architecture Prof. Muhamed Mudawar Computer Engineering Department King Fahd University of Petroleum and Minerals Presentation Outline Floating-Point Numbers IEEE 754 Floating-Point
More informationChapter 3 Arithmetic for Computers (Part 2)
Department of Electr rical Eng ineering, Chapter 3 Arithmetic for Computers (Part 2) 王振傑 (Chen-Chieh Wang) ccwang@mail.ee.ncku.edu.tw ncku edu Depar rtment of Electr rical Eng ineering, Feng-Chia Unive
More informationBoolean Algebra. Chapter 3. Boolean Algebra. Chapter 3 Arithmetic for Computers 1. Fundamental Boolean Operations. Arithmetic for Computers
COMPUTER ORGANIZATION AND DESIGN The Hardware/Software Interface 5 th Edition COMPUTER ORGANIZATION AND DESIGN The Hardware/Software Interface 5 th Edition Chapter 3 Arithmetic for Computers Arithmetic
More informationCOMPUTER ORGANIZATION AND DESIGN. 5 th Edition. The Hardware/Software Interface. Chapter 3. Arithmetic for Computers
COMPUTER ORGANIZATION AND DESIGN The Hardware/Software Interface 5 th Edition Chapter 3 Arithmetic for Computers Boolean Algebra Boolean algebra is the basic math used in digital circuits and computers.
More informationFloating Point Arithmetic
Floating Point Arithmetic ICS 233 Computer Architecture and Assembly Language Dr. Aiman El-Maleh College of Computer Sciences and Engineering King Fahd University of Petroleum and Minerals [Adapted from
More informationCO Computer Architecture and Programming Languages CAPL. Lecture 15
CO20-320241 Computer Architecture and Programming Languages CAPL Lecture 15 Dr. Kinga Lipskoch Fall 2017 How to Compute a Binary Float Decimal fraction: 8.703125 Integral part: 8 1000 Fraction part: 0.703125
More informationCOMPUTER ORGANIZATION AND DESIGN. 5 th Edition. The Hardware/Software Interface. Chapter 3. Arithmetic for Computers
COMPUTER ORGANIZATION AND DESIGN The Hardware/Software Interface 5 th Edition Chapter 3 Arithmetic for Computers Arithmetic for Computers Operations on integers Addition and subtraction Multiplication
More informationCOMPUTER ORGANIZATION AND DESIGN. 5 th Edition. The Hardware/Software Interface. Chapter 3. Arithmetic for Computers
COMPUTER ORGANIZATION AND DESIGN The Hardware/Software Interface 5 th Edition Chapter 3 Arithmetic for Computers Arithmetic for Computers Operations on integers Addition and subtraction Multiplication
More information5DV118 Computer Organization and Architecture Umeå University Department of Computing Science Stephen J. Hegner. Topic 3: Arithmetic
5DV118 Computer Organization and Architecture Umeå University Department of Computing Science Stephen J. Hegner Topic 3: Arithmetic These slides are mostly taken verbatim, or with minor changes, from those
More informationArithmetic for Computers. Integer Addition. Chapter 3
COMPUTER ORGANIZATION AND DESIGN The Hardware/Software Interface 5 th Edition Chapter 3 Arithmetic for Computers Arithmetic for Computers Operations on integers Addition and subtraction Multiplication
More informationLecture 10: Floating Point, Digital Design
Lecture 10: Floating Point, Digital Design Today s topics: FP arithmetic Intro to Boolean functions 1 Examples Final representation: (-1) S x (1 + Fraction) x 2 (Exponent Bias) Represent -0.75 ten in single
More informationInteger Subtraction. Chapter 3. Overflow conditions. Arithmetic for Computers. Signed Addition. Integer Addition. Arithmetic for Computers
COMPUTER ORGANIZATION AND DESIGN The Hardware/Software Interface 5 th Edition Integer Subtraction Chapter 3 Arithmetic for Computers Add negation of second operand Example: 7 6 = 7 + ( 6) +7: 0000 0000
More informationCOMPUTER ORGANIZATION AND DESIGN. 5 th Edition. The Hardware/Software Interface. Chapter 3. Arithmetic for Computers
COMPUTER ORGANIZATION AND DESIGN The Hardware/Software Interface 5 th Edition Chapter 3 Arithmetic for Computers Arithmetic for Computers Operations on integers Addition and subtraction Multiplication
More informationLecture 10: Floating Point, Digital Design
Lecture 10: Floating Point, Digital Design Today s topics: FP arithmetic Intro to Boolean functions 1 Examples Final representation: (-1) S x (1 + Fraction) x 2 (Exponent Bias) Represent -0.75 ten in single
More informationComputer Architecture. Chapter 3: Arithmetic for Computers
182.092 Computer Architecture Chapter 3: Arithmetic for Computers Adapted from Computer Organization and Design, 4 th Edition, Patterson & Hennessy, 2008, Morgan Kaufmann Publishers and Mary Jane Irwin
More informationChapter 3. Arithmetic for Computers
Chapter 3 Arithmetic for Computers Arithmetic for Computers Unsigned vs. Signed Integers Operations on integers Addition and subtraction Multiplication and division Dealing with overflow Floating-point
More informationECE 154A Introduction to. Fall 2012
ECE 154A Introduction to Computer Architecture Fall 2012 Dmitri Strukov Lecture 10 Floating point review Pipelined design IEEE Floating Point Format single: 8 bits double: 11 bits single: 23 bits double:
More informationCSE 2021 Computer Organization. Hugh Chesser, CSEB 1012U W4-W
CE 01 Computer Organization Hugh Chesser, CEB 101U Agenda for Today 1. Floating Point Addition, Multiplication. FP Instructions. Quiz 1 Patterson: ections. Floating Point: ingle Precision 1. In MIP, decimal
More information9 Floating-Point. 9.1 Objectives. 9.2 Floating-Point Number Representation. Value = ± (1.F) 2 2 E Bias
9 Floating-Point 9.1 Objectives After completing this lab, you will: Understand Floating-Point Number Representation (IEEE 754 Standard) Understand the MIPS Floating-Point Unit Write Programs using the
More informationxx.yyyy Lecture #11 Floating Point II Summary (single precision): Precision and Accuracy Fractional Powers of 2 Representation of Fractions
CS61C L11 Floating Point II (1) inst.eecs.berkeley.edu/~cs61c CS61C : Machine Structures Lecture #11 Floating Point II 2007-7-12 Scott Beamer, Instructor Sony & Nintendo make E3 News www.nytimes.com Review
More informationCSCI 402: Computer Architectures. Arithmetic for Computers (3) Fengguang Song Department of Computer & Information Science IUPUI.
CSCI 402: Computer Architectures Arithmetic for Computers (3) Fengguang Song Department of Computer & Information Science IUPUI 3.5 Today s Contents Floating point numbers: 2.5, 10.1, 100.2, etc.. How
More informationChapter 3 Arithmetic for Computers
Chapter 3 Arithmetic for Computers 1 Outline Signed and unsigned numbers (Sec. 3.2) Addition and subtraction (Sec. 3.3) Multiplication (Sec. 3.4) Division (Sec. 3.5) Floating point (Sec. 3.6) 2 Representation
More informationCS61C : Machine Structures
inst.eecs.berkeley.edu/~cs61c CS61C : Machine Structures Lecture #11 Floating Point II Scott Beamer, Instructor Sony & Nintendo make E3 News 2007-7-12 CS61C L11 Floating Point II (1) www.nytimes.com Review
More informationIEEE Standard 754 for Binary Floating-Point Arithmetic.
CS61C L11 Floating Point II (1) inst.eecs.berkeley.edu/~cs61c CS61C : Machine Structures Lecture #11 Floating Point II 2005-10-05 There is one handout today at the front and back of the room! Lecturer
More informationReview: MIPS Organization
1 MIPS Arithmetic Review: MIPS Organization Processor Memory src1 addr 5 src2 addr 5 dst addr 5 write data Register File registers ($zero - $ra) bits src1 data src2 data read/write addr 1 1100 2 30 words
More informationECE232: Hardware Organization and Design
ECE232: Hardware Organization and Design Lecture 11: Floating Point & Floating Point Addition Adapted from Computer Organization and Design, Patterson & Hennessy, UCB Last time: Single Precision Format
More informationLecture 13: (Integer Multiplication and Division) FLOATING POINT NUMBERS
Lecture 13: (Integer Multiplication and Division) FLOATING POINT NUMBERS Lecture 13 Floating Point I (1) Fall 2005 Integer Multiplication (1/3) Paper and pencil example (unsigned): Multiplicand 1000 8
More informationPrecision and Accuracy
inst.eecs.berkeley.edu/~cs61c UC Berkeley CS61C : Machine Structures Lecture 16 Floating Point II 2010-02-26 TA Michael Greenbaum www.cs.berkeley.edu/~cs61c-tf Research without Google would be like life
More informationUC Berkeley CS61C : Machine Structures
inst.eecs.berkeley.edu/~cs61c UC Berkeley CS61C : Machine Structures www.cs.berkeley.edu/~ddgarcia Google takes on Office! Google Apps: premium services (email, instant vs messaging, calendar, web creation,
More informationCS222: Processor Design
CS222: Processor Design Dr. A. Sahu Dept of Comp. Sc. & Engg. Indian Institute of Technology Guwahati 1 Outline Previous Class: Floating points: Add, Sub, Mul,Div, Rounding Processor Design: Introduction
More informationUC Berkeley CS61C : Machine Structures
inst.eecs.berkeley.edu/~cs61c UC Berkeley CS61C : Machine Structures Lecture 16 Floating Point II 2010-02-26 TA Michael Greenbaum www.cs.berkeley.edu/~cs61c-tf Research without Google would be like life
More informationCS61C Floating Point Operations & Multiply/Divide. Lecture 9. February 17, 1999 Dave Patterson (http.cs.berkeley.edu/~patterson)
CS61C Floating Point Operations & Multiply/Divide Lecture 9 February 17, 1999 Dave Patterson (http.cs.berkeley.edu/~patterson) www-inst.eecs.berkeley.edu/~cs61c/schedule.html cs 61C L9 FP.1 Review 1/2
More informationReview 1/2 Big Idea: Instructions determine meaning of data; nothing inherent inside the data Characters: ASCII takes one byte
CS61C Floating Point Operations & Multiply/Divide Lecture 9 February 17, 1999 Dave Patterson (http.cs.berkeley.edu/~patterson) www-inst.eecs.berkeley.edu/~cs61c/schedule.html Review 1/2 Big Idea: Instructions
More informationCSCI 402: Computer Architectures. Instructions: Language of the Computer (3) Fengguang Song Department of Computer & Information Science IUPUI.
CSCI 402: Computer Architectures Instructions: Language of the Computer (3) Fengguang Song Department of Computer & Information Science IUPUI Recall Big endian, little endian Memory alignment Unsigned
More informationIEEE Standard 754 for Binary Floating-Point Arithmetic.
CS61C L14 MIPS Instruction Representation II (1) inst.eecs.berkeley.edu/~cs61c UC Berkeley CS61C : Machine Structures Lecture 16 Floating Point II 27-2-23 Lecturer SOE Dan Garcia As Pink Floyd crooned:
More informationDivide: Paper & Pencil
Divide: Paper & Pencil 1001 Quotient Divisor 1000 1001010 Dividend -1000 10 101 1010 1000 10 Remainder See how big a number can be subtracted, creating quotient bit on each step Binary => 1 * divisor or
More informationFloating Point. The World is Not Just Integers. Programming languages support numbers with fraction
1 Floating Point The World is Not Just Integers Programming languages support numbers with fraction Called floating-point numbers Examples: 3.14159265 (π) 2.71828 (e) 0.000000001 or 1.0 10 9 (seconds in
More informationMIPS ISA and MIPS Assembly. CS301 Prof. Szajda
MIPS ISA and MIPS Assembly CS301 Prof. Szajda Administrative HW #2 due Wednesday (9/11) at 5pm Lab #2 due Friday (9/13) 1:30pm Read Appendix B5, B6, B.9 and Chapter 2.5-2.9 (if you have not already done
More informationFloating-Point Data Representation and Manipulation 198:231 Introduction to Computer Organization Lecture 3
Floating-Point Data Representation and Manipulation 198:231 Introduction to Computer Organization Instructor: Nicole Hynes nicole.hynes@rutgers.edu 1 Fixed Point Numbers Fixed point number: integer part
More informationECE331: Hardware Organization and Design
ECE331: Hardware Organization and Design Lecture 15: Midterm 1 Review Adapted from Computer Organization and Design, Patterson & Hennessy, UCB Basics Midterm to cover Book Sections (inclusive) 1.1 1.5
More informationInstruction Set Architecture of. MIPS Processor. MIPS Processor. MIPS Registers (continued) MIPS Registers
CSE 675.02: Introduction to Computer Architecture MIPS Processor Memory Instruction Set Architecture of MIPS Processor CPU Arithmetic Logic unit Registers $0 $31 Multiply divide Coprocessor 1 (FPU) Registers
More informationCSCI 402: Computer Architectures
CSCI 402: Computer Architectures Arithmetic for Computers (5) Fengguang Song Department of Computer & Information Science IUPUI What happens when the exact result is not any floating point number, too
More informationFormat. 10 multiple choice 8 points each. 1 short answer 20 points. Same basic principals as the midterm
Final Review Format 10 multiple choice 8 points each Make sure to show your work Can write a description to the side as to why you think your answer is correct for possible partial credit 1 short answer
More informationCS 33. Data Representation (Part 3) CS33 Intro to Computer Systems VIII 1 Copyright 2018 Thomas W. Doeppner. All rights reserved.
CS 33 Data Representation (Part 3) CS33 Intro to Computer Systems VIII 1 Copyright 2018 Thomas W. Doeppner. All rights reserved. Byte-Oriented Memory Organization 00 0 FF F Programs refer to data by address
More informationECE331: Hardware Organization and Design
ECE331: Hardware Organization and Design Lecture 35: Final Exam Review Adapted from Computer Organization and Design, Patterson & Hennessy, UCB Material from Earlier in the Semester Throughput and latency
More informationChapter 3 Arithmetic for Computers
Chapter 3 Arithmetic for Computers 1 Arithmetic for Computers Operations on integers Addition and subtraction Multiplication and division Dealing with overflow Floating-point real numbers Representation
More informationFloating point. Today! IEEE Floating Point Standard! Rounding! Floating Point Operations! Mathematical properties. Next time. !
Floating point Today! IEEE Floating Point Standard! Rounding! Floating Point Operations! Mathematical properties Next time! The machine model Chris Riesbeck, Fall 2011 Checkpoint IEEE Floating point Floating
More information95% of the folks out there are completely clueless about floating-point.
CS61C L11 Floating Point (1) Instructor Paul Pearce inst.eecs.berkeley.edu/~cs61c UCB CS61C : Machine Structures Well, not quite yet. A UC Davis student (shown left) is attempting to standardize hella
More informationUCB CS61C : Machine Structures
inst.eecs.berkeley.edu/~cs61c UCB CS61C : Machine Structures Instructor Paul Pearce Lecture 11 Floating Point 2010-07-08 Well, not quite yet. A UC Davis student (shown left) is attempting to standardize
More informationCSCI 402: Computer Architectures
CSCI 402: Computer Architectures Instructions: Language of the Computer (2) Fengguang Song Department of Computer & Information Science IUPUI Memory Operands Two tribes: Big Endian: Most-significant byte
More informationMIPS Integer ALU Requirements
MIPS Integer ALU Requirements Add, AddU, Sub, SubU, AddI, AddIU: 2 s complement adder/sub with overflow detection. And, Or, Andi, Ori, Xor, Xori, Nor: Logical AND, logical OR, XOR, nor. SLTI, SLTIU (set
More informationFloating Point Puzzles. Lecture 3B Floating Point. IEEE Floating Point. Fractional Binary Numbers. Topics. IEEE Standard 754
Floating Point Puzzles Topics Lecture 3B Floating Point IEEE Floating Point Standard Rounding Floating Point Operations Mathematical properties For each of the following C expressions, either: Argue that
More informationComputer Architecture Chapter 3. Fall 2005 Department of Computer Science Kent State University
Computer Architecture Chapter 3 Fall 2005 Department of Computer Science Kent State University Objectives Signed and Unsigned Numbers Addition and Subtraction Multiplication and Division Floating Point
More informationFloating Point Numbers
Floating Point Numbers Computer Systems Organization (Spring 2016) CSCI-UA 201, Section 2 Instructor: Joanna Klukowska Slides adapted from Randal E. Bryant and David R. O Hallaron (CMU) Mohamed Zahran
More informationFloating Point Numbers
Floating Point Numbers Computer Systems Organization (Spring 2016) CSCI-UA 201, Section 2 Fractions in Binary Instructor: Joanna Klukowska Slides adapted from Randal E. Bryant and David R. O Hallaron (CMU)
More informationChapter 2 Float Point Arithmetic. Real Numbers in Decimal Notation. Real Numbers in Decimal Notation
Chapter 2 Float Point Arithmetic Topics IEEE Floating Point Standard Fractional Binary Numbers Rounding Floating Point Operations Mathematical properties Real Numbers in Decimal Notation Representation
More informationFloating-Point Arithmetic
Floating-Point Arithmetic if ((A + A) - A == A) { SelfDestruct() } L11 Floating Point 1 What is the problem? Many numeric applications require numbers over a VERY large range. (e.g. nanoseconds to centuries)
More informationECE 331 Hardware Organization and Design. Professor Jay Taneja UMass ECE - Discussion 5 2/22/2018
ECE 331 Hardware Organization and Design Professor Jay Taneja UMass ECE - jtaneja@umass.edu Discussion 5 2/22/2018 Today s Discussion Topics Program Concepts Floating Point Floating Point Conversion Floating
More informationFloating Point Arithmetic
Floating Point Arithmetic CS 365 Floating-Point What can be represented in N bits? Unsigned 0 to 2 N 2s Complement -2 N-1 to 2 N-1-1 But, what about? very large numbers? 9,349,398,989,787,762,244,859,087,678
More informationCSE 141 Computer Architecture Summer Session Lecture 3 ALU Part 2 Single Cycle CPU Part 1. Pramod V. Argade
CSE 141 Computer Architecture Summer Session 1 2004 Lecture 3 ALU Part 2 Single Cycle CPU Part 1 Pramod V. Argade Reading Assignment Announcements Chapter 5: The Processor: Datapath and Control, Sec. 5.3-5.4
More informationSlide Set 11. for ENCM 369 Winter 2015 Lecture Section 01. Steve Norman, PhD, PEng
Slide Set 11 for ENCM 369 Winter 2015 Lecture Section 01 Steve Norman, PhD, PEng Electrical & Computer Engineering Schulich School of Engineering University of Calgary Winter Term, 2015 ENCM 369 W15 Section
More informationFloating-Point Arithmetic
Floating-Point Arithmetic if ((A + A) - A == A) { SelfDestruct() } Reading: Study Chapter 4. L12 Multiplication 1 Why Floating Point? Aren t Integers enough? Many applications require numbers with a VERY
More informationSigned Multiplication Multiply the positives Negate result if signs of operand are different
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
More informationCS61C : Machine Structures
inst.eecs.berkeley.edu/~cs61c CS61C : Machine Structures Lecture 15 Floating Point!!Senior Lecturer SOE Dan Garcia!!!www.cs.berkeley.edu/~ddgarcia! UNUM, Float replacement? Dr. John Gustafson, Senior Fellow
More informationIEEE Standard for Floating-Point Arithmetic: 754
IEEE Standard for Floating-Point Arithmetic: 754 G.E. Antoniou G.E. Antoniou () IEEE Standard for Floating-Point Arithmetic: 754 1 / 34 Floating Point Standard: IEEE 754 1985/2008 Established in 1985 (2008)
More informationSystem Programming CISC 360. Floating Point September 16, 2008
System Programming CISC 360 Floating Point September 16, 2008 Topics IEEE Floating Point Standard Rounding Floating Point Operations Mathematical properties Powerpoint Lecture Notes for Computer Systems:
More informationFloating Point (with contributions from Dr. Bin Ren, William & Mary Computer Science)
Floating Point (with contributions from Dr. Bin Ren, William & Mary Computer Science) Floating Point Background: Fractional binary numbers IEEE floating point standard: Definition Example and properties
More informationSystems I. Floating Point. Topics IEEE Floating Point Standard Rounding Floating Point Operations Mathematical properties
Systems I Floating Point Topics IEEE Floating Point Standard Rounding Floating Point Operations Mathematical properties IEEE Floating Point IEEE Standard 754 Established in 1985 as uniform standard for
More informationCS101 Introduction to computing Floating Point Numbers
CS101 Introduction to computing Floating Point Numbers A. Sahu and S. V.Rao Dept of Comp. Sc. & Engg. Indian Institute of Technology Guwahati 1 Outline Need to floating point number Number representation
More informationICS DEPARTMENT ICS 233 COMPUTER ARCHITECTURE & ASSEMBLY LANGUAGE. Midterm Exam. First Semester (141) Time: 1:00-3:30 PM. Student Name : _KEY
Page 1 of 14 Nov. 22, 2014 ICS DEPARTMENT ICS 233 COMPUTER ARCHITECTURE & ASSEMBLY LANGUAGE Midterm Exam First Semester (141) Time: 1:00-3:30 PM Student Name : _KEY Student ID. : Question Max Points Score
More informationFloating Point January 24, 2008
15-213 The course that gives CMU its Zip! Floating Point January 24, 2008 Topics IEEE Floating Point Standard Rounding Floating Point Operations Mathematical properties class04.ppt 15-213, S 08 Floating
More informationFloating point. Today. IEEE Floating Point Standard Rounding Floating Point Operations Mathematical properties Next time.
Floating point Today IEEE Floating Point Standard Rounding Floating Point Operations Mathematical properties Next time The machine model Fabián E. Bustamante, Spring 2010 IEEE Floating point Floating point
More informationNumber Systems and Computer Arithmetic
Number Systems and Computer Arithmetic Counting to four billion two fingers at a time What do all those bits mean now? bits (011011011100010...01) instruction R-format I-format... integer data number text
More informationFloating Point Puzzles. Lecture 3B Floating Point. IEEE Floating Point. Fractional Binary Numbers. Topics. IEEE Standard 754
Floating Point Puzzles Topics Lecture 3B Floating Point IEEE Floating Point Standard Rounding Floating Point Operations Mathematical properties For each of the following C expressions, either: Argue that
More informationFoundations of Computer Systems
18-600 Foundations of Computer Systems Lecture 4: Floating Point Required Reading Assignment: Chapter 2 of CS:APP (3 rd edition) by Randy Bryant & Dave O Hallaron Assignments for This Week: Lab 1 18-600
More informationNumber Representations
Number Representations times XVII LIX CLXX -XVII D(CCL)LL DCCC LLLL X-X X-VII = DCCC CC III = MIII X-VII = VIIIII-VII = III 1/25/02 Memory Organization Viewed as a large, single-dimension array, with an
More informationHomework 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
Homework 3 Assigned on 02/15 Due time: midnight on 02/21 (1 WEEK only!) B.2 B.11 B.14 (hint: use multiplexors) 1 CSCI 402: Computer Architectures Arithmetic for Computers (2) Fengguang Song Department
More informationFloating Point. CSE 238/2038/2138: Systems Programming. Instructor: Fatma CORUT ERGİN. Slides adapted from Bryant & O Hallaron s slides
Floating Point CSE 238/2038/2138: Systems Programming Instructor: Fatma CORUT ERGİN Slides adapted from Bryant & O Hallaron s slides Today: Floating Point Background: Fractional binary numbers IEEE floating
More informationFloating Point. CSE 351 Autumn Instructor: Justin Hsia
Floating Point CSE 351 Autumn 2016 Instructor: Justin Hsia Teaching Assistants: Chris Ma Hunter Zahn John Kaltenbach Kevin Bi Sachin Mehta Suraj Bhat Thomas Neuman Waylon Huang Xi Liu Yufang Sun http://xkcd.com/899/
More informationCO Computer Architecture and Programming Languages CAPL. Lecture 13 & 14
CO20-320241 Computer Architecture and Programming Languages CAPL Lecture 13 & 14 Dr. Kinga Lipskoch Fall 2017 Frame Pointer (1) The stack is also used to store variables that are local to function, but
More informationData Representation Floating Point
Data Representation Floating Point CSCI 2400 / ECE 3217: Computer Architecture Instructor: David Ferry Slides adapted from Bryant & O Hallaron s slides via Jason Fritts Today: Floating Point Background:
More informationFloating Point Numbers
Floating Point Numbers Summer 8 Fractional numbers Fractional numbers fixed point Floating point numbers the IEEE 7 floating point standard Floating point operations Rounding modes CMPE Summer 8 Slides
More informationOctober 24. Five Execution Steps
October 24 Programming problems? Read Section 6.1 for November 5 How instructions execute Test Preview Ask Questions! 10/24/2001 Comp 120 Fall 2001 1 Five Execution Steps Instruction Fetch Instruction
More informationFloating Point Numbers. Lecture 9 CAP
Floating Point Numbers Lecture 9 CAP 3103 06-16-2014 Review of Numbers Computers are made to deal with numbers What can we represent in N bits? 2 N things, and no more! They could be Unsigned integers:
More informationData Representation Floating Point
Data Representation Floating Point CSCI 2400 / ECE 3217: Computer Architecture Instructor: David Ferry Slides adapted from Bryant & O Hallaron s slides via Jason Fritts Today: Floating Point Background:
More information