UMSL CS 312 - Arithmetic (15 pages)

Previewing pages 1, 2, 3, 4, 5 of 15 page document View the full content.
View Full Document

Arithmetic



Previewing pages 1, 2, 3, 4, 5 of actual document.

View the full content.
View Full Document
View Full Document

Arithmetic

13 views


Pages:
15
School:
University of Missouri-St. Louis
Course:
Cs 312 - Introduction to Computer Organization and Architecture
Introduction to Computer Organization and Architecture Documents

Unformatted text preview:

Arithmetic Introduction Representation of numbers Limits on number size Fractions and real numbers Arithmetic operations Signed and unsigned numbers Radix or base of a number system Base is indicated by subscript to actual number If b is the radix the value of ith digit d is given by d bi with i starting at zero and increasing from right to left Example 10112 10112 1 20 1 21 0 22 1 23 10 1 1 1 2 0 4 1 8 10 1 2 0 8 10 1110 Bits are numbered 0 1 2 from right to left in a word with bit 0 being the least significant bit lsb and the highest numbered bit being the most significant bit msb With n bits the maximum number that can be represented is given by 2n 1 ascii vs binary numbers Internal representation Leading zeroes are not generally shown Overflow as a result of arithmetic operation Overflow handled by os or application Sign and magnitude representation for negative numbers Where to put sign bit msb or lsb Adders may need an extra step to set the sign bit Both positive and negative zero 1 s complement Flip all the bits Still have positive and negative zero 2 s complement Used in all processors designed today Sum of an n bit number and its negative is 2n Leading bit msb as 1 indicates a negative number Positive numbers are represented as normal with leading bit zero Only one zero representation Arithmetic 2 For 8 bit numbers the range is from 127 to 128 with just one 0 The decimal representation for a number is found by 1 xn 1 2n 1 xn 2 2n 2 xn 3 2n 3 x0 20 Only the msb is multiplied by 1 Example 111101002 original number is 8 bit 111101002 1 27 1 26 1 25 1 24 0 23 1 22 0 21 0 20 10 1 128 1 64 1 32 1 16 0 8 1 4 0 2 0 1 10 128 64 32 16 0 4 0 0 10 1210 Signed load operation load word Repeatedly copy the sign bit to fill the rest of the register Also known as sign extension Unsigned load simply fills the left of data with 0s lb treats the byte as a signed number and performs sign extension into the register lbu load byte unsigned works with unsigned integers Overflow on



View Full Document

Access the best Study Guides, Lecture Notes and Practice Exams

Loading Unlocking...
Login

Join to view Arithmetic and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Arithmetic and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?