Lecture_8 - Chapter 3 Arithmetic for Computers MIPS...

Info iconThis preview shows pages 1–8. Sign up to view the full content.

View Full Document Right Arrow Icon
Chapter 3 Arithmetic for Computers
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Chapter 3 — Arithmetic for Computers — 2 MIPS Multiplication Two 32-bit registers for product HI: most-significant 32 bits LO: least-significant 32-bits Instructions mult rs, rt / multu rs, rt 64-bit product in HI/LO mfhi rd / mflo rd Move from HI/LO to rd Can test HI value to see if product overflows 32 bits mul rd, rs, rt Least-significant 32 bits of product –> rd
Background image of page 2
Chapter 3 — Arithmetic for Computers — 3 MIPS Division Use HI/LO registers for result HI: 32-bit remainder LO: 32-bit quotient Instructions div rs, rt / divu rs, rt No overflow or divide-by-0 checking Software must perform checks if required Use mfhi , mflo to access result
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Chapter 3 — Arithmetic for Computers — 4 Floating Point Representation for non-integral numbers Including very small and very large numbers Like scientific notation –2.34 × 10 56 +0.002 × 10 –4 +987.02 × 10 9 In binary ± 1. xxxxxxx 2 × 2 yyyy Types float and double in C normalized not normalized § 3.5 Floating Point
Background image of page 4
Chapter 3 — Arithmetic for Computers — 5 Floating Point Standard Defined by IEEE Std 754-1985 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)
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Chapter 3 — Arithmetic for Computers — 6 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 = 1023 S Exponent Fraction single: 8 bits double: 11 bits single: 23 bits double: 52 bits Bias) (Exponent S 2 Fraction) (1 1) ( x - × + × - =
Background image of page 6
Chapter 3 — Arithmetic for Computers — 7 Single-Precision Range Exponents 00000000 and 11111111 reserved Smallest value Exponent: 00000001 actual exponent = 1 – 127 = –126 Fraction: 000…00 significand = 1.0
Background image of page 7

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Image of page 8
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

Page1 / 23

Lecture_8 - Chapter 3 Arithmetic for Computers MIPS...

This preview shows document pages 1 - 8. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online