Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Please explain step-by-step how to solve these kinds of questions Suppose we hav

ID: 3723838 • Letter: P

Question

Please explain step-by-step how to solve these kinds of questions

Suppose we have a direct mapped instruction cache on a 32-bit MIPS processor. The capacity is 2048 bytes and the block size is 16 bytes. Assume that 10 instructions are executed in each iteration of a loop. Before the loop starts, we can assume that the cache is empty (all valid bits are set to zero). The first instruction in the loop starts at address 0x00400200. What is then the cache hit rate when executing the loop,if the loop iterates 10 times? (2 points)

Explanation / Answer

MIPS processor =32 bit

Direct mapped cache capacity=2048bytes

Each block size=16 bytes

4 bytes=32 bit(each instruction is 32 bit)

16 bytes/4 bytes=4

So,Each block hold 4 instructions

In a single loop contains instruction = 10

10 instructions need 3 blocks(4+4+2)

Iteration:-

step 1: Ist block load 4 instructions when the first read happen,so Ist instruction(I1) got miss and other 3  

               instructions(I2,I3 and I4) hit

          2nd block load 4 instructions,so Ist instruction(I5) got miss and other 3 instructions(I6,I7 and I8) hit

          3rd block load 2 instructions,so Ist instruction(I9) got miss and next instruction(I10) hit.

step 2:Now all instructions are reside in cache so no miss

step3 :All instructions are reside in cache so no miss

..

..

..

step 10:All instructions are reside in cache so no miss

Therefore,

Total instruction execution=10(instructions)*10(Iterations)=100

Total hit=100-3=97

Hit ratio=total hit/total instruction=97/100=97%