Problem Set 2

Due Sunday, January 23 @ 11:59PM

Submit your answers to blackboard. Be sure to show your work (simple calculations).

  1. Consider three different processors, Chocolate, Cinnamon, and Bacon executing the same instruction set with the clock rates and CPIs given in the following table:
    Processor Clock Rate CPI
    Chocolate 2 GHz 1.5
    Cinnamon 1.5 GHz 1.0
    Bacon! 3 GHz 2.5
    Which processor has the highest performance?
  2. Considering the following table:
    Processor Clock Rate # of Instructions Time
    Chocolate 2 GHz 20 x 109 7 s
    Cinnamon 1.5 GHz 30 x 109 10 s
    Bacon! 3 GHz 90 x 109 9 s
    What are the IPC (instructions per cycle) of each processor?
  3. Finally! You've finished your program that solves all of the world's problems. It's an amazing worm designed to simply turn everything off. Assume that as machine code, it contains the following types of instructions:
    Arith Store Load Branch Total
    500 50 100 50 700
    Assuming that arith instructions take one cycle, load and store take five cycles, and branch instructions take two cycles, what is the execution time of the program on a 2 GHz MIPS processor?
  4. Compilers have a profound impact on the performance of an application on a given processor. Imagine that you try compiling your world-saving worm program with two different compilers with the following results:
    Happy Compiler Somewhat Anxious Compiler
    # of instructions Execution time # of instructions Execution time
    1.00e+09 1 s 1.20e+09 1.4 s
    Given that your computer has a clock cycle time of 1 nanosecond, find the average CPI for each of the two compiled versions of your program.
  5. Rubric (40 points)

    1. See page 35 of our text. CPU time = (Instruction count x CPI) / clock rate.
      Assuming that an identical program is run (which we can assume means the # of instructions are the same, since the processors have the "same instruction set") that contains 1 instruction. CPU time is then CPI / clock rate.
      Chocolate: 1.5/2 = .75
      Cinnamon: 1.0/1.5 = .6
      Bacon: 2.5 / 3 = .83
      Therefore, the CPU time of Cinnamon is the least, and is the fastest. I know, you were probably hoping for bacon, since bacon is the best.
    2. This one is tricky in that it asks you for IPC (instructions per cycle or instructions/cycle) rather than CPI (cycles per instruction or cycles/instruction). You could use the same formula as in question 1 above (page 35 of our text): CPU time = (Instruction count x CPI) / clock rate. Then, just invert CPI to get IPC. Also note that # of instructions is 109 and clock rates are in GHz, so this makes the math very simple:
      Chocolate: 7s = (20 x CPI) / 2 ; CPI = 14/20 ; IPC = 20/14 = 1.42
      Cinnamon: 10s = (30 x CPI) / 1.5 ; CPI = 15/30 ; IPC = 30/15 = 2
      Bacon: 9s = (90 x CPI) / 3 ; CPI = 27/90 ; IPC = 90/27 = 3.3
    3. There are numerous ways to solve this one, let's take an very explicit approach and calculate the execution time for each type of instruction. Again, use the formula CPU time = (Instruction count x CPI) / clock rate.
      Arith: CPU Time = (500 x 1) / 2 x 109 = .00025s
      Store: CPU Time = (50 x 5) / 2 x 109 = .000125s
      Load: CPU Time = (100 x 5) / 2 x 109 = .00025s
      Branch: CPU Time = (50 x 2) / 2 x 109 = .00005s

      Sum up those times and we get 0.000675 seconds. A very excellent worm.
    4. Again, same formula.
      Happy: 1s = ((1.0 x 109) x CPI) / 1 x 10-9 ; 1s = 109 x CPI / 10-9 ; CPI = 10-9/109
      Somewhat Anxious: 1.4s = ((1.2 x 109) x CPI) / 1 x 10-9 ; CPI = (1.4 x 10-9) / 1.2 x 109