Thursday, August 28, 2003

Computer architecture

Computer Systems 2nd Edition, Warford, J. Stanley

Chapter 3 Notes

Read chapter 3 sections 1 - 2 - Instruction Set Architecture - Information Representation
  1. Unsigned Binary Representation
    1. Binary Storage
      1. Computers can not store numbers and letters directly
      2. They must be broken down into states the computer can understand
      3. Computers store information in a location as either an on or an off state
      4. These units are called binary digits or bits
      5. These bits combined together are called cells. Cells can be of various sizes. Most computers use 8.
      6. The 1s and 0s used to represent various characters are called a code
    2. Integers
      1. Numbers must be stored in binary form
        1. Unsigned - always positive
        2. signed - either way
      2. Review of our system - base 10
        1. Our system developed because of our ten fingers
        2. When we get to a certain point, 10 numbers in (0 to 9), we start the counting again with 0 and put a 1 in the next column.
        3. This repeats each time we reach a 9
      3. What if we only had 8 fingers instead of 10
        1. At 7 we would put a 0 in and add 1 to the next column
        2. This would repeat every time we reached 7
      4. This same pattern works if we only have 2 fingers only our numbers are 0 and 1
    3. Base Conversion
      1. simplest way to convert the numbers is just to count up but that only works for small numbers
      2. Just like base 10 goes from 1s to 10s to 100s to 1000s we can do the same with the 2s system
      3. Our numbers in this case would be 1s 2s 4s 8s 16s 32s etc. (in decimal of course)
      4. By adding the decimal numbers together for the places where the 1s are we will get the decimal number.
      5. To convert the other direction binary to decimal, follow these steps
        1. Divide the number by 2 and write down the remainder (it will be 1 or 0)
        2. Take the value of the answer and divide it by 2 again and again save the remainder
        3. When you get a 0 for an answer take that remainder and make it the first number in your string of numbers. Follow this by the other 1s and 0's till you get to the first one. this is your answer.
    4. Range for Unsigned Integers
      1. In real life we have an infinite storage system for numbers so they can get as large as the need to
      2. In computers we are limited to the size of the cells that we are using. And the amount of memory we have.
      3. Because of this the smallest number we can do in an unsigned number is all 0s and the largest is all 1s.
    5. Unsigned Addition
      1. Rules for addition in binary is the same as in decimal - reach the limit put a 0 down and a 1 in the next column
      2. What happens when we reach the limit of the cells?
    6. The Carry Bit
      1. When we wind up reaching the limit the cells can hold, then the carry bit comes into place.
      2. A carry bit will be a cell that tells the computer that we have gone over the limit of what the cell can hold.
      3. In subtraction it also lets us know that we have gone lower than we can go (i.e. 0)(It basically is a borrow bit)
  2. twos Compliment Binary Representation
    1. This system will only work for non negative numbers
      1. All we have is 1s and 0s to represent a number
      2. This means a 1 or a 0 will have to represent the fact the number is negative in a cell
      3. In most cases it is the highest order cell (the highest number)
      4. We can now represent the rest of the cells as a number (a smaller number though as we have less cells to work with)
      5. Problems add up if we try to use the same representation for a negative and a positive number
        1. If I add a +5 and a -5 I get 0
        2. If I add a 00 0101 (pos 5)and a 10 0101 (negative 5) we get

          00 0101
          10 0101
          ----------
          10 1010
          which does not represent 0 but -9
        3. In stead we need a way to add them together to get 0
        4. In this case what can I add to binary 5 to make it 0, that will be binary -5
        5. Our answer winds up being 11 1011 but how do we get that number?
        6. For that process we use the twos Compliment
          1. First invert the number to get the 1's compliment
          2. Then add a 1 to the result
    2. twos compliment range
      1. Because of the use of the 1st cell something unexpected happens
        1. Like before we have a range of 16 numbers (unsigned 0 to 15)
        2. If we only have 3 numbers to work with we should have 0 to 7 positive and negative
        3. In reality we go to -8 (1000)
        4. This makes the range -8 to +7
      2. This happens no matter how many cells we wind up using
    3. Base Conversion
      1. Conversion of negative decimal to negative binary
        1. Take the positive value of it
        2. Do a 1s compliment of it by putting 0 where 1s are and 1 where 0s are
        3. Add 1 to the result
      2. Converting binary to a decimal
        1. Start with the sign bit
          1. Positive - covert as normal
          2. Negative - one of two methods
              1. first method
                1. make number positive by negating it
                2. convert it to decimal as in unsigned representation
              2. 2nd method
                1. Where the 0s are add up those place holders
                2. Add 1
          3. The Number Line
          4. The Overflow Bit
            1. When numbers are added the carry bit represents if the number is out of range
            2. It will store the wrong information and then go on after that.
            3. If we are using 2s Compliment than the carry bit does not really represent if a number is in or out of range.
            4. We introduce a overflow bit (represented by v)
            5. when numbers are added if it senses overflow it sets the bit, otherwise it is left as 0

No comments:

Post a Comment