Memory Latency Activity

For this activity you will compute the impact of memory latency on the CPI and the speed of your program. For this activity, you will use my implementation of the Insertion Sort. Download this sort here

There are two related constants you may wish to change in this program. They are Size the size of the array measured in elements, and Array the number of bytes in the array. Array should be Size * 4.

Some MARS tools slow computations down incredibly. You should reduce the number of elements in the array when told to do so, however for cache analysis, you should use an array with 250 elements.

  1. Begin by creating a spreadsheet.
    1. In the first sheet place your name, and the fact that this is homework 10.
    2. Build a table of the following assumptions:
      • Clock Speed (ps) : 250
      • PS/SEC : 1E12
      • PS/NS: 1000
      • HZ/GHZ : 1E9
    3. For computations in this worksheet, you will show units for a computation by placing the units above the value entry.
      • For example, we will compute the GHz rating for this machine.
        • In cell A11 place the Label Clock Speed (GHz)
        • In cell B10 place the label cycles/ps
        • In cell B11 compute this value (=1/B4)
        • In cell C10 place the label ps/sec
        • In cell C11 compute this value (=b6)
        • In cell D10 place the label GHz/Hz
        • In cell D11 compute this value (=1/B8)
        • In cell E10 place the label GHz
        • In cell E11 compute the value by multiplying the values in the previous cells.
    4. Memory Latency (ns) in Cell A13- C13
      • Read the wikipedia article on latency. Compare this with the information presented in this paper. From the two select a memory latency for your model.
      • Make sure you use the true access time, not the CAS latency
      • Note the memory type selected and the source.
    5. Cache miss penalty (cycles) A15-E16
      • We want to have this in terms of CYCLES so we can add it to our CPI computation.
      • This is based on the ns/miss (the memory latency from above)
      • and the constants ps/ns and cycles/ps
    6. Using the Instruction Statistics tool in Mars, compute the number of instructions required and the instruction mix to sort 250 numbers using the insertion sort program
      • Start the tool and Connect to MIPS
      • Run the program from the beginning.
      • Add a line for number of instructions. Use the value 3,319,341, which is that number of instructions needed to sort 1000 numbers.
        • You can compute this number if you wish, but it will take a while.
      • Add these statistics in a table.
      • For now hard code the cpi for each instruction type to be that given in the picture.
      • Compute the contribution of each instruction type and the total CPI for the machine.
      • Compute the time required for your program as shown.
  2. Add a worksheet to compute the CPI for the branch instructions.