Presentation is loading. Please wait.

Presentation is loading. Please wait.

Computer Architecture Lecture 11 Arithmetic Ralph Grishman Oct. 2015 NYU.

Similar presentations


Presentation on theme: "Computer Architecture Lecture 11 Arithmetic Ralph Grishman Oct. 2015 NYU."— Presentation transcript:

1 Computer Architecture Lecture 11 Arithmetic Ralph Grishman Oct. 2015 NYU

2 Overflow (for two’s complement arithmetic) value too large to represent in (32-bit) word for addition, occurs when you add two positive numbers and get a negative result you add two negative numbers and get a positive result 10/13/15Computer Architecture lecture 112

3 Multiplication sequential circuit 10/13/15Computer Architecture lecture 113

4 Multiplication sequential circuit, shared register 10/13/15Computer Architecture lecture 114

5 Multiplication combinatorial circuit n rows of adders, one for each multiplier bit 10/13/15Computer Architecture lecture 115

6 Multiplication tree of adders 10/13/15Computer Architecture lecture 116

7 Multiplication carry save: carries propagated diagonally (see diagram with lecture notes) 10/13/15Computer Architecture lecture 117

8 Division Sequential circuit 10/13/15Computer Architecture lecture 118

9 Division Harder to speed up but programs don’t divide very often 10/13/15Computer Architecture lecture 119

10 Floating point representation: sign S, exponent E, and fraction F value = (-1) S × F × 2 E IEEE 754 floating-point standard standard sizes standard representations for 0, ∞, … makes floating code portable 10/13/15Computer Architecture lecture 1110 sizesize of E fieldsize of F field single precision32 bits8 bits23 bits double precision64 bits11 bits52 bits

11 Floating point addition Basic algorithm: 1.align decimal points 1.if exponents differ, adjust operand with smaller exponent so exponents are equal 2.add fractions 3.normalize result 10/13/15Computer Architecture lecture 1111

12 Floating point addition Example (decimal): 0.95 x 10 2 +0.70 x 10 1 10/13/15Computer Architecture lecture 1112

13 Floating point addition Example (decimal): 0.95 x 10 2 +0.07 x 10 2 10/13/15Computer Architecture lecture 1113

14 Floating point addition Example (decimal): 0.95 x 10 2 +0.07 x 10 2 1.02 x 10 2 10/13/15Computer Architecture lecture 1114

15 Floating point addition Example (decimal): 0.95 x 10 2 +0.07 x 10 2 0.10 x 10 3 10/13/15Computer Architecture lecture 1115

16 Floating point multiplication Basic algorithm: add exponents, multiply fractions 10/13/15Computer Architecture lecture 1116

17 Precision Why do we need such precision (particularly, double precision)? What do we measure so precisely? 10/13/15Computer Architecture lecture 1117


Download ppt "Computer Architecture Lecture 11 Arithmetic Ralph Grishman Oct. 2015 NYU."

Similar presentations


Ads by Google