Preface: There are many different design patterns that are important to cache's overall performance. Below are listed parameters for different direct-mapped cache designs.
- Cache data size: 32 kib
- Cache block Size: 2 words
- Cache access time: 1-cycle
Question: Calculate the number of bits required for the cache listed above, assuming a 32-bit address. Given that total size, find the total size of the closest direct-mapped cache with 16-word blocks of equal size or greater. Explain why the second cache, despite its larger data size, might provide slower performance that the first cache.
公式如下:
缓存中的位数2^n X( block 大小+标签大小+有效字段大小)
这是我得到的:65536(1+14X(32X2)
..
这是正确的吗?
最佳答案
使用:(2^索引位) * (有效位 + 标记位 + (数据位 * 2^偏移位))
对于我得到的第一个:
total bits = 2^15 (1+14+(32*2^1)) = 2588672 bits
对于具有 16 个字 block 的缓存,我得到:
total bits = 2^13(1 +13+(32*2^4)) = 4308992
具有 16 个字 block 和 32 位地址的下一个最小缓存为 2158592 位,小于第一个缓存。
关于caching - 计算缓存中的位数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23017033/