1 / 11

Datorsystem 1 och Datorarkitektur 1 – föreläsning 8 fredag 9 november 2007

Datorsystem 1 och Datorarkitektur 1 – föreläsning 8 fredag 9 november 2007. flyttal 0.0001756809651851654052734375. heltal 59985408. 0x39383700. All interpretations are valid. You have to explicitly tell the machine which interpretation you want.

Download Presentation

Datorsystem 1 och Datorarkitektur 1 – föreläsning 8 fredag 9 november 2007

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Datorsystem 1 och Datorarkitektur 1 – föreläsning 8 fredag 9 november 2007

  2. flyttal 0.0001756809651851654052734375 • heltal 59985408 0x39383700 • All interpretations are valid. You have to explicitly tell the machine which interpretation you want. • Use an integer load (lw) to interpret them as an int • Use a floating point load (l.s) to interpret them as a float • Use a branch or a jump (bne or j) to interpret them as an instruction • sträng “987” • instruktion xor $24, $9, 0x3700

  3. Eight Conditions for Signed-Magnitude Addition/Subtraction

  4. Liten Demo

  5. n can be formed in parallel and added in parallel for faster multiplication multiplicand multiplier partial product array n double precision product 2n

  6. 4 Multiplicand = 2 0010 Multiplier = 5 0101 0010 0000 0010 0000 00001010 partial product array 4 Product = 10 00010000 00000010 00000100 00001000 2n 8 bits 2*5 = 10 0010 0000 0101 0001 4 bits 0000000 00000010 00001010 8 bits Add Multiplicand to product Don’t Add Multiplicand to product Add Multiplicand to product Don’t Add Multiplicand to product

  7. Optimera.... n multiplicand multiplier can be formed in parallel and added in parallel for faster multiplication partial product array n double precision product 2n Aha! Multiplicera med 32 = 25 kompilator 1378 * 32 1378 << 5 (shift left 5)

  8. MIPS (IEEE 754) (-1)sign x (1+fraction) x 2(exponent - 127) exempel 0.7510 = 0 + 0.5 + 0.25 = ½ + ¼ = 0.112 -127  128 Normalisera  0.112 = 1.102 x (2-1)10 -0.7510 (-1)1 x (1 + 0.1000...0) x 2(126- 127) -1 10111111110000000000000000000000

  9. 0.1010 = 1/128 + 1/256 + 1/1024 + .... = 000001111.....2 • During the Gulf War in 1991, a U.S. Patriot missile failed to intercept an Iraqi Scud missile, and 28 Americans were killed. • A later study determined that the problem was caused by the inaccuracy of the binary representation of 0.10. • The Patriot incremented a counter once every 0.10 seconds. • It multiplied the counter value by 0.10 to compute the actual time. • However, the (24-bit) binary representation of 0.10 actually corresponds to 0.099999904632568359375, which is off by 0.000000095367431640625. • This doesn’t seem like much, but after 100 hours the time ends up being off by 0.34 seconds—enough time for a Scud to travel 500 meters!

More Related