Piece of MIPS code:
.data
first-node : .word 10,next-node
next-node: .......
.text
la $s0,first-node
move $s1,$zero
loop:
la $t0,0($s0)
add $s1,$s1,$t0
lw $s0,4($s0)
bne $s0,$zero,loop
we got list of 4096 nodes,
Cache one-way
16 set
Block size: 128 byte
Virtual Memory with page size of 4KB
1) Find out the miss rate of the cache
- The miss rate first 16 operation? **The answer:**4/4+2 (4 because there are 4 instrations in the loop and 2 before loop) - 4/6 = 66 %
- the miss rate 17th Iteration The answer:
1/6 (1 because it loads a new tree (I think) and 6 is total instrations) = 17%
- The miss rate 18th - 32th iteration? The answer:
0/6 (I didn't understand why 0 if we have to load the next tree) = 0%
- And the total miss rate?The answer: 4*16+1*15/16*16*6 = 5% (This part I coudn't understand)
2) How many page fault were executed? The answer: 9 page fault
3) What is the miss rate in TLB? The answer: 9/6*4096 0,03%
We answered all those questions in the class but, I didn't understand many of them can somebody please explain me?
Also What will be the difference between the one-way and 2-way? If it's bigger should be less miss rate,yes? the problem is how to calculate?