Number Systems

16
1 Number Systems Number Systems Lecture 10 Digital Design and Computer Architecture Harris & Harris Morgan Kaufmann / Elsevier, 2007

description

Number Systems. Lecture 10 Digital Design and Computer Architecture Harris & Harris Morgan Kaufmann / Elsevier, 2007. Binary Representations. What kind of numbers do you know how to represent using binary representations?. Fractional Numbers. Fixed-Point Floating-Point. - PowerPoint PPT Presentation

Transcript of Number Systems

Page 1: Number Systems

1

Number SystemsNumber Systems

Lecture 10Digital Design and Computer Architecture

Harris & HarrisMorgan Kaufmann / Elsevier, 2007

Page 2: Number Systems

2

Binary RepresentationsBinary Representations

• What kind of numbers do you know how to represent using binary representations?

Page 3: Number Systems

3

Fractional NumbersFractional Numbers

• Fixed-Point• Floating-Point

Page 4: Number Systems

4

Fixed-Point NumbersFixed-Point Numbers

• How do you represent 6.510 using an 8-bit binary representation with 4 integer bits and 4 fraction bits?

Page 5: Number Systems

5

Fixed-Point NumbersFixed-Point Numbers

• How do you represent -6.510 using an 8-bit binary representation with 4 integer bits and 4 fraction bits?

Page 6: Number Systems

6

Floating-Point NumbersFloating-Point Numbers

• Like scientific notation

Page 7: Number Systems

7

Floating-Point NumbersFloating-Point Numbers

• How do you represent the value 22810 using a 32-bit floating point representation?

Page 8: Number Systems

8

Floating-Point NumbersFloating-Point Numbers

Page 9: Number Systems

9

Floating-Point ExampleFloating-Point Example

• How do you represent the value 5810 using a 32-bit floating point representation?

Page 10: Number Systems

10

Floating-Point Numbers: Special CasesFloating-Point Numbers: Special Cases

• How do you represent the value 0 using IEEE 754 32-bit floating-point notation?

Page 11: Number Systems

11

Floating-Point Numbers: PrecisionFloating-Point Numbers: Precision

• Single-Precision:– 32-bit notation– 1 sign bit, 8 exponent bits, 23 fraction bits– bias = 127

• Double-Precision:– 64-bit notation– 1 sign bit, 11 exponent bits, 52 fraction bits– bias = 1023

Page 12: Number Systems

12

Floating-Point Numbers: RoundingFloating-Point Numbers: Rounding

• Overflow, Underflow• Rounding modes:

– down– up– toward zero– to nearest

Page 13: Number Systems

13

Floating-Point AdditionFloating-Point Addition

1. Extract exponent and fraction bits

2. Prepend leading 1 to form mantissa

3. Compare exponents

4. Shift smaller mantissa if necessary

5. Add mantissas

6. Normalize mantissa and adjust exponent if necessary

7. Round result

8. Assemble exponent and fraction back into floating-point format

Page 14: Number Systems

14

Floating-Point Addition: ExampleFloating-Point Addition: Example

Add the following floating-point numbers:

1.510

3.2510

Start by representing the numbers in IEEE 754 single-precision floating-point notation.

Page 15: Number Systems

15

Floating-Point Addition: ExampleFloating-Point Addition: Example

Page 16: Number Systems

16

Next TimeNext Time

• Sequential Building Blocks

• Memory Arrays