Presentation is loading. Please wait.

Presentation is loading. Please wait.

CSE 340 Simulation Modeling | MUSHFIQUR ROUF CSE340:

Similar presentations


Presentation on theme: "CSE 340 Simulation Modeling | MUSHFIQUR ROUF CSE340:"— Presentation transcript:

1 CSE 340 Simulation Modeling | MUSHFIQUR ROUF nasarouf@gmail.com http://groups.google.com/group/cse340spring07/ http://faculty.bu.ac.bd/~rouf/cse340/ CSE340: Computer Architecture Chapter 3 Arithmetic for Computers Mushfiqur Rouf nasarouf@gmail.com

2 CSE 340 Simulation Modeling | MUSHFIQUR ROUF nasarouf@gmail.com http://groups.google.com/group/cse340spring07/ http://faculty.bu.ac.bd/~rouf/cse340/ Scientific Notation 0.000000001 = 1 x 10 -9 12345 = 1.2345 x 10 4 Normalized ►No leading zeroes ►0.1 x 10 5 is not normalized ►Neither is 10.0 x 10 3

3 CSE 340 Simulation Modeling | MUSHFIQUR ROUF nasarouf@gmail.com http://groups.google.com/group/cse340spring07/ http://faculty.bu.ac.bd/~rouf/cse340/ Binary Notation Binary Scientific Notation ►1.xxxxxxxx x 2 yyyy Floating Point ►‘Floating’ since the binary point is not fixed

4 CSE 340 Simulation Modeling | MUSHFIQUR ROUF nasarouf@gmail.com http://groups.google.com/group/cse340spring07/ http://faculty.bu.ac.bd/~rouf/cse340/ Representation Parts: ►Fraction ►Exponent Trade off ►More bits for fraction improves precision ►More bits for exponent increases range ►32 bit limit

5 CSE 340 Simulation Modeling | MUSHFIQUR ROUF nasarouf@gmail.com http://groups.google.com/group/cse340spring07/ http://faculty.bu.ac.bd/~rouf/cse340/ Single Precision Sign: 31 (1 bit) Exponent: 30-23 (8 bits) Fraction: 22-0 (23 bits) Errors: ►Overflow (The number is too large) ►Underflow (The number is too small)

6 CSE 340 Simulation Modeling | MUSHFIQUR ROUF nasarouf@gmail.com http://groups.google.com/group/cse340spring07/ http://faculty.bu.ac.bd/~rouf/cse340/ Double Precision 2 bytes ►Sign 1 bit ►Exponent 11 bits ►Fraction 20+32 bits

7 CSE 340 Simulation Modeling | MUSHFIQUR ROUF nasarouf@gmail.com http://groups.google.com/group/cse340spring07/ http://faculty.bu.ac.bd/~rouf/cse340/ Optimizations NB need to store the 1 before fraction. ►The fraction part always precedes a 1 ►Exception: 0. Have all bits unset to mean 0. Exponent field is stored before fraction ►To make comparisons easy Exponent has a Bias ►So that negative exponents are not lexicographically larger than positive exponents.

8 CSE 340 Simulation Modeling | MUSHFIQUR ROUF nasarouf@gmail.com http://groups.google.com/group/cse340spring07/ http://faculty.bu.ac.bd/~rouf/cse340/ Value (-1) S x (1 + Fraction) x 2 (Exponent – Bias)

9 CSE 340 Simulation Modeling | MUSHFIQUR ROUF nasarouf@gmail.com http://groups.google.com/group/cse340spring07/ http://faculty.bu.ac.bd/~rouf/cse340/ Addition 1.Align the decimal point 2.Add 3.Normalize 4.Round up 5.If necessary Goto 3

10 CSE 340 Simulation Modeling | MUSHFIQUR ROUF nasarouf@gmail.com http://groups.google.com/group/cse340spring07/ http://faculty.bu.ac.bd/~rouf/cse340/ Multiplication 1.Add Exponents Remember bias 2.Multiply Significands 3.Normalize 4.Check for overflow/underflow 5.Round up 6.Determine Sign 7.If necessary Goto 3

11 CSE 340 Simulation Modeling | MUSHFIQUR ROUF nasarouf@gmail.com http://groups.google.com/group/cse340spring07/ http://faculty.bu.ac.bd/~rouf/cse340/ Instructions add.s add.d sub.s sub.d mul.s mul.d div.s div.d c.eq.s c.eq.d c.neq.s … Conditional Branch ►(branch if true) bclt ►(brznch if false) bclf

12 CSE 340 Simulation Modeling | MUSHFIQUR ROUF nasarouf@gmail.com http://groups.google.com/group/cse340spring07/ http://faculty.bu.ac.bd/~rouf/cse340/ Floating Point Registers Separate Floating point registers ►$f0, $f1, $f2, … Separate Memory instructions ►lwcl ►swcl


Download ppt "CSE 340 Simulation Modeling | MUSHFIQUR ROUF CSE340:"

Similar presentations


Ads by Google