Caching 如何从双向集合关联缓存计算缓存命中率

Caching 如何从双向集合关联缓存计算缓存命中率,caching,Caching,在我的作业中,我们有两个问题:我们有一个双向集合关联缓存。缓存总共有四组。主存储器由4K块组成,每个块8个字,使用字寻址。 第a部分)要求演示地址格式,我已将其解析为word=3位set=2位和field=7位。我遇到的问题在第二部分): 计算从位置8到位置51循环3次的程序的命中率。换句话说,将其视为一个汇编语言程序,从位置8处的操作码运行到位置51m处的操作码,然后循环回位置8。它总共进行了三次这样的迭代 根据我的理解,在我做了研究之后,有一个标准,通常是给定的某种速度或命中率?我想知道,如

在我的作业中,我们有两个问题:我们有一个双向集合关联缓存。缓存总共有四组。主存储器由4K块组成,每个块8个字,使用字寻址。 第a部分)要求演示地址格式,我已将其解析为word=3位set=2位和field=7位。我遇到的问题在第二部分): 计算从位置8到位置51循环3次的程序的命中率。换句话说,将其视为一个汇编语言程序,从位置8处的操作码运行到位置51m处的操作码,然后循环回位置8。它总共进行了三次这样的迭代


根据我的理解,在我做了研究之后,有一个标准,通常是给定的某种速度或命中率?我想知道,如果我不知道未命中率、未命中惩罚、缓存速度或其他任何信息,如何计算命中率

我想我们是同一个班的,哈哈,今晚交作业的时候我有一个完全一样的问题。。无论如何,我做了一些研究,在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%.

希望这有帮助,祝你好运

顺便说一句,我没有得到和你a部分相同的答案。我有10位标记字段,2位集合字段,3位单词字段。