J. Michael Moore Computer Organization CSCE 110
J. Michael Moore High Level View Of A Computer ProcessorInputOutput Memory Storage
J. Michael Moore Getting Data In Input Others?
J. Michael Moore ProcessorInputOutput Memory Storage
J. Michael Moore Getting Data Out Output Others?
J. Michael Moore ProcessorInputOutput Memory Storage
J. Michael Moore Unit of Storage Bit –Binary digit –Smallest unit of measurement Memory Storage Two possible values on off OR
J. Michael Moore How Data Is Stored Byte: a group of 8 bits; 2 8 =256 possibilities – , , , , …, Memory: long sequence of locations, each large enough to hold one byte, numbered 0, 1, 2, 3, … Address: The number of the location
J. Michael Moore How Data Is Stored Contents of a location can change –e.g can become Use consecutive locations to store longer sequences –e.g. 4 bytes = 1 word bytes 012 bits
J. Michael Moore Binary Numbers Base Ten Numbers (Integers) –characters –5401 is 5x x x x10 0 Binary numbers are the same –characters 0 1 –1011 is 1x x x x2 0
J. Michael Moore Converting Binary to Base = = = = = ____ 10 = 2.1x x x x2 0 = 3.1x8 + 0x4 + 0x2 + 1x1 = = = ____ 10 (Try yourself) = 6 10
J. Michael Moore Converting Base 10 to Binary 2 8 = = = = = = = = = = ____ (2 8 ) = (2 7 ) = (2 2 ) = 0
J. Michael Moore Converting Base 10 to Binary = ____ / 2 = Remainder / 2 = Remainder / 2 = Remainder / 2 = Remainder / 2 = Remainder / 2 = 6 10 Remainder / 2 = 3 10 Remainder / 2 = 1 10 Remainder / 2 = 0 10 Remainder
J. Michael Moore Other common number representations Octal Numbers –characters –7820 is 7x x x x8 0 Hexadecimal Numbers –characters A B C D E F –2FD6 is 2x Fx Dx x16 0
J. Michael Moore Negative Numbers Can we store a negative sign? What can we do? –Use a bit Most common is two’s complement
J. Michael Moore Representing Negative Numbers Two’s Complement –flip all the bits change 0 to 1 and 1 to zero –add 1 –if the leftmost bit is 0, the number is 0 or positive –if the leftmost bit is 1, the number is negative
J. Michael Moore Two’s Complement What is -9? –9 is in binary –flip the bits –add Addition and Subtraction are easy –always addition
J. Michael Moore Two’s Complement Addition – = 4 –13 + (-9) = 4 – = ? = 1 This bit is lost But that doesn’t matter since we get the correct answer anyway
J. Michael Moore Real (Floating point) numbers Break the bits used into parts MantissaExponent Sign bits
J. Michael Moore Limitations of Finite Data Encodings Overflow - number is too large –suppose 1 byte stores integers in base 2, from 0 ( ) to 255 ( ) (note: this is not two’s complement although it would have the same problem) –if the byte holds 255, then adding 1 to it results in 0, not 256 – – TwosComplement.htmlhttp://classes.engr.oregonstate.edu/eecs/fall2007/cs160/applets/ TwosComplement.html
J. Michael Moore Limitations of Finite Data Exchange Roundoff Error –Insufficient precision (size of word) ex. Try to store 1/8, which is in binary, with only two bits –Nonterminating expansions in current base ex. Try to store 1/3 in base 10, which is … –Nonterminating expansions in every base ex. Irrational numbers such as
J. Michael Moore ProcessorInputOutput Memory Storage