A 2-way set associative cache consists of four sets. MainMemory contains 2k bloc
ID: 3615395 • Letter: A
Question
A 2-way set associative cache consists of four sets. MainMemory contains 2k blocks of eight words each.Show the maim memory addresss format that allows us to map adressesfrom main memory to cache. Be sure to include the fields as well astheir sizes (tag, set, word) Compute the hit ratio for a program that loops 3 tims fromlocations 810 to 5110 in main memory. afraction is fine for the answer. A 2-way set associative cache consists of four sets. MainMemory contains 2k blocks of eight words each.
Show the maim memory addresss format that allows us to map adressesfrom main memory to cache. Be sure to include the fields as well astheir sizes (tag, set, word) Compute the hit ratio for a program that loops 3 tims fromlocations 810 to 5110 in main memory. afraction is fine for the answer.
Explanation / Answer
Dear...
a.
Given that memory contains 2Kblocks of eight words.
2K can be distributedas 2K * 23 = 211* 23 = 214
so we have 14-bitaddresses with 9 bits in the tag field, 2bits in the setfield and 3 in the word field
b. First iteration of the loop:
Address 8 is a miss, then entire block brought into Set 1.9-15 are then hits.
16 is a miss, entire block brought into Set 2, 17-23 arehits.
24 is a miss, entire block brought into Set 3, 25-31 arehits.
32 is a miss, entire block brought into Set 0, 33-39 arethen hits.
40 is a miss, entire block brought into Set 1 41-47 arehits.
48 is a miss, entire block brought into Set 2, 49-51 arehits.
For the first iteration of the loop, we have 6 misses, and 5*7 + 3hits, or 38 hits.
On the remaining iterations, we have 5*8+4 hits, or 44 hits each,for 88 more hits.
Therefore, we have 6 misses and 126 hits, for a hit ratio of126/132, or 95.45%.
Hope this will help you...
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.