在我的任务中,我们有两个问题:我们有一个2路组关联缓存。缓存总共有四个集合。主存储器由4K块组成,每个块8个字,并使用字寻址。第a部分)要求演示地址格式,我已将其解析为word =3位set =2位和field =7位。问题在b)部分:计算从位置8到位置51循环3次的程序的命中率。换句话说,这是一个汇编语言程序,它从位置8的操作码运行到位置51m的操作码,然后循环回到位置8。它总共执行三次这样的迭代。
现在,据我所知,在我做了研究之后,有一个标准,通常是某种速度或命中率?我在想,如果我不知道未命中率、未命中惩罚、缓存速度或其他信息,如何计算命中率?
发布于 2014-04-07 10:34:22
我想我们在同一个班上笑我今晚要交作业时也有同样的问题..无论如何,我做了一些研究,在chegg上找到了类似问题的答案:
a. Given that memory contains 2K blocks of eight words.
2K can be distributed as 2K * 23 = 211* 23 = 214 so we have 14-bit addresses with 9 bits
in the tag field, 2 bits in the set field 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 are hits.
→ 24 is a miss, entire block brought into Set 3, 25-31 are hits.
→ 32 is a miss, entire block brought into Set 0, 33-39 are then hits.
→ 40 is a miss, entire block brought into Set 1 41-47 are hits.
→ 48 is a miss, entire block brought into Set 2, 49-51 are hits.
For the first iteration of the loop, we have 6 misses, and 5*7 + 3 hits, 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 of 126/132, or 95.45%.希望这能帮上忙,祝你好运!
https://stackoverflow.com/questions/22901802
复制相似问题