Homework 1


When you complete this homework you should
Answer each, show all work including computations. If you use any sources, be sure that you reference these sources.

In general, you should strive to make your work neat and organized. You should follow common conventions for notation.

  1. Indent your answers under your questions.
  2. A(16) is not an acceptable notation for A16
  3. 3^5 is not really acceptable for 35
If you don't show your work, there will be no partial credit.

On a side note, if you send an email with the word homework in it, without any other words like question, comment, or help, I will assume it is a homework submission and not open it until I grade that homework.

  1. [3 points] Represent 37 in binary, octal and hexadecimal (hex).

        
        2 |37  1
          ---
         2|18  0
          ---
          2|9  1      so 37 = 1001012
           --            
          2|4  0            100|101
           --                4   5 
          3|2  0      so 37 = 458
           --
            1                0010|0101
                               2   5
    	          so 37 = 2516 
    

    Please use subscripts to indicate base.

  2. [1 points] Why are numbers represented in binary in a computer?

    The real reason is that it is convenient and it was the easiest to build. Here is an interesting article which someone gives the answer.

    Many of you stated that the only way to represent data is with current or no current. This is not true. Think about a dimmable light. We could clearly represent many different states with a dimmer switch.

    OK, so I gave up on grading this one.

    On top of this, there have been instances of computers built that use three possible values. See this article.

  3. [1 points] Why are hex and octal representations of numbers used in computer science? They provide an easy to convert to/from shorthand for binary.
  4. [1 point each] Represent each number in decimal
    1. 10110102

      1x26 + 1x24 + 1x23 + 1x21 = 90

    2. 3CAF16

      3x163 + 12x162 + 10x161 + 15x160 = 15,535

    3. 47308

      4x83 + 7x82 +3x81 = 2,520

      You normally do not subscript base 10 numbers.

  5. [1 points each] Represent the following in 4 bit two's compliment.
    1. -1

      	 
      1 is the same as 00012   Flip the bits: 1110
                                                +1
      			                ----
      				        1111
      
      	 
      	 
    2. -8
      	 
      8 is the same as 10002   Flip the bits: 1011111 
                                                  +1
      			                  ----
      				        1 0 00
      	 
      	 
  6. [1 points each] Convert the following 5 bit two's compliment numbers to decimal
    1. 01011
      	 
      This starts with a 0, so it is a positive number.
          Just compute the magnitude
          1011 = 8+2+1 = 11
      	 
      	 
    2. 10000
      	 
      This starts with a 1 so it is a negative number.
           Flip the bits and add 1.
           10000 -> 01111 +1 = 100000
      
           This is the special case in two's compliment.
           It is -2n-1 = -24 = -16
      	 
      	 
    3. 10101
      	 
      The first bit is 1, so it is a negative number.
           Flip the bits and add 1 to find the magnitude.
           10101-> 01010 + 1 = 01011 = 11
           So the original number is -11.
      	 
      	 
    4. 00000
      	 
      This is 0.
      	 
      	 
  7. [1 point each] Define the following as they relate to computer architecture
    1. Register

      A register is a short term memory location.

      You really should say that this is a piece of memory or a storage unit of some type. "Registers are variables" is a nice way to think about it, but that is not really a very good definition.

    2. Central Processing Unit (CPU)

      The central processing unit, or CPU is the portion of the computer which executes instructions.

    3. Arithmetic logic unit (ALU)

      The arithmetic logic unit is the portion of the CPU which performs computations. Most mathematics (addition, subtraction,. ..), comparisons, and logical operations are performed in the ALU.

    4. Hertz

      A Hertz is the SI measurement of frequency. One Hertz is equivalent to one cycle per second.

      Hertz is used anywhere you are measuring frequency. It is not only related to the CPU, memory or other hardware components.

  8. [2 points] State and describe the actions that occur at each step of the fetch-decode-execute cycle. Include how each of the following are used

        
    The fetch-decode-execute cycle consist of a series of actions within the 
    CPU to execute a single instruction.
    
    The cycle begins by fetching the next instruction to be executed 
    from memory, the address of this instruction is stored in the  
    Program Counter (PC).  This instruction is stored in the 
    Instruction Register (IR).  Finally the PC is incremented by the 
    size of an instruction.
    
    The decode portion of the cycle is performed by the Control Unit (CU) by 
    examining the data in the IR.
    
    The CU  then takes the steps necessary to execute the instruction , or 
    perform the action required by the instruction.  This may include fetching
    additional data from memory, loading or storing data contained in a general
    purpose register, or instructing the Arithmetic Logic Unit to perform 
    a computation.  
    
    Once the execute phase is done, the Control Unit begins the cycle again
    by fetching the next instruction.
        
        
    Note that the question asks you to explain the fetch-decode-execute cycle in terms of the components. It does not ask you to define the components.