csci341
play

CSCI341 Lecture 18, IEEE Floating Point Image courtesy of - PowerPoint PPT Presentation

CSCI341 Lecture 18, IEEE Floating Point Image courtesy of http://debsbookbag.blogspot.com/ The design team for a relationship-problem-solving-unit (RPSU) is choosing between a Candy and Flower implementation. Thousands of relationships may be


  1. CSCI341 Lecture 18, IEEE Floating Point

  2. Image courtesy of http://debsbookbag.blogspot.com/

  3. The design team for a relationship-problem-solving-unit (RPSU) is choosing between a Candy and Flower implementation. Thousands of relationships may be at stake if the problems aren’t solved efficiently.

  4. Parameter Candy Flowers Clock Rate 500 MHz 35 MHz CPI for ALU 1 1 CPI for Control 2 1 CPI for Memory 2.7 1 For a program with 20% ALU instructions, 10% control instructions and 70% memory instructions, which design will be faster?

  5. REVIEW • We need to represent real numbers (very large, very small) in a machine • The agreed-upon standard is the IEEE Floating Point standard

  6. IEEE FLOATING POINT STANDARD • Single Precision (4 bytes / 32-bit encoding) • Double Precision (8 bytes / 64-bit encoding)

  7. SINGLE-PRECISION FLOATING POINT ENCODING e = 8-bit f=23-bit s= 1-bit sign exponent significand Biased exponent (because this The MSB, 1, is implied. isn’t your parents 2‘s Think 24-bits. complement system, this is IEEE rock and roll.) For single-precision FP , the bias is 127.

  8. SINGLE-PRECISION FLOATING POINT ENCODING e = 8-bit f=23-bit s= 1-bit sign exponent significand (-1) s x 1.f x 10 e-127 Think of this as “one zero” not ten e-127 -> e - 01111111

  9. BINARY TO DECIMAL 101.101 2 111.001 2 10.101 2

  10. DECIMAL TO BINARY 25.25 10 12.2 10

  11. ENCODE AS FLOATING POINT s= 1-bit e = 8-bit exponent f=23-bit significand sign • Place a value for the sign bit in the s field • Normalize the binary number • Add 127 (01111111) to the actual exponent • place this in the e field • Place the digits to the right of the binary point into the f field

  12. ENCODE AS FLOATING POINT s= 1-bit e = 8-bit exponent f=23-bit significand sign 12.25 10 1.101010 1001001.1010 0.101011

  13. DECODE FROM FLOATING POINT s= 1-bit e = 8-bit exponent f=23-bit significand sign • First bit is the sign bit, it remains the MSB • Subtract 127 from e to find the actual exponent • Extract the f bits into a normalized form: 1. f • Denormalize the number

  14. DECODE FROM FLOATING POINT s= 1-bit e = 8-bit exponent f=23-bit significand sign 1 10000111 001100....0 0 10001000 101000....0 1 10001001 01100....0

  15. PRECISION / RESOLUTION What’s the big deal?

  16. CONSIDER A SMALLER FORMAT... sign exp sign 1 bit 3 bits 4 bits 1 101 1011 (Biased by 3) What is this in decimal?

  17. CONSIDER A SMALLER FORMAT... How would you represent -6.76? sign exp sign 1 bit 3 bits 4 bits

  18. OK... SO WHAT ABOUT MIPS? .data Pi: .double 3.1415926536897924 Rad: .double 12.345678901234567 .text main: l.d $f0, Pi # $f0 = Pi l.d $f4, Rad # $f4 = Rad mul.d $f12, $f4, $f4 # $f12 = Radius squared mul.d $f12, $f12, $f0 # Multiply by Pi li $v0, 3 syscall # Print the area li $v0, 10 syscall # Terminate the program

  19. HOMEWORK • Reading 16 (online) • Chapter 11 of MIPS Assembly Language (pdf) give me more!

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend