Search code examples
cachingmemorycpu-architecturememory-access

Average Memory Access Time for 25% memory instructions


*An I-cache has a 0.95 hit rate, hit rate time 3 cycles and a D-cache has a 0.85 hit rate (3 cycles). Miss penalty of both is 40 cycles. What is the AMAT for 0.25 Memory instructions?

I successfully calculated: AMAT_I = 3 + 0.05 * 40 = 5 AMAT_D = 3 + 0.15 * 40 = 9

The solutions tells me: AMAT_Total = 1/1.25 * AMAT_I + 0.25/1.25 * AMAT_D but I don't understand why. Can someone please explain me the logic behind it? I thought: AMAT_Total = 0.25 * (AMAT_I + AMAT_D)


Solution

  • If you were only accessing I-cache and D-cache on memory access instructions, your answer would be correct. However, all of your instructions go through I-cache, hence the name instruction-cache. To put it in a different way:

    When you are executing any instruction = you access I-Cache

    When you are execution memory instructions = you access both I-Cache to fetch the instruction and you access D-Cache for the data.