I am currently enrolled in a computer organization and design class, which I am struggling mightily with, and I have a final homework in my class that I need to get a perfect score on. One of the questions covers cache hit-misses, and the lecture we had on the subject was relatively brief. The question I have having issues with is:
A processor has a CPI of 1.4 with level 1 caches with a 100% hit rate. When running benchmarks, the level 1 instruction cache has a 1% miss rate and the level 1 data cache has a 3% miss rate. 30% of the instructions access memory through load and store operations. Main memory has a 50 nano second access time and the clock is running at 2.5 GHz.
What is the actual CPI of the processor with just the level 1 caches?
A level 2 cache is added to the processor. The hit time of this cache is 1.5 nanoseconds, and it has a global miss rate of 0.5%. Compute the actual CPI of the processor after the addition of the level 2 cache.
What is the speedup achieved by adding the level 2 cache?
So my first attempt is this:
I-cache miss rate = 1%
D-cache miss rate = 3%
Miss penalty to main memory = main memory access time / clock time
50 ns / .4 ns per clock cycle = 125 clock cycles
Base CPI = 1.4
Load and store = 30% of instructions
Main memory access time = 50 ns
Processor clock = 2.5 GHz
What is the actual CPI of the processor with just the level 1 caches?
Instruction miss cycles = I x 1% x 125 = 1.25 x I
Data miss cycles = I x 30% x 3% x 125 = 1.125 x I
Total number of memory-stall cycles is 2.375 I
Total CPI including memory stalls is 1.4 + 2.375 = 3.775
A level 2 cache is added to the processor. The hit time of this cache is 1.5 ns and it has a global miss rate of 0.5%. Compute the actual CPI of the processor after the addition of the level 2 cache.
Secondary cache access time = 1.5ns
Processor clock = 2.5 GHz
Miss penalty for an access to second-level cache = 1.5ns / .4 ns per clock cycle = 3.75 clock cycles
For a two level cache, total CPI is the sum of the stall cycles from both levels of cache and the base CPI
1.4 + (.005 x 125) + (.005 x .3 x 125) + (.01 x 3.75) + (.01 x .3 x 3.75) = 2.26125
*****This is where I'm most unsure. The "global miss rate of 0.5%" is throwing me off, and I'm not sure I performed this calculation correctly.**
What is the speedup achieved by adding the level 2 cache?
3.775 / 2.26125 = 1.67
***This answer is dependent on the result from the calculation above. If I did that wrong, this answer will be different.