caching - 计算缓存中的位数

标签 caching computer-science cpu-architecture cpu-cache

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/

相关文章:

opencv - 机器学习 : sign visibility

math - 高级形式逻辑/自动机理论教科书

Android 开发者——我的应用程序应该支持哪种 CPU 架构?

caching - cpuid命令显示信息的问题

optimization - 长延迟指令

language-agnostic - 除了文件或数据库,还有哪些缓存方法可用?

caching - 创建 etag 的最佳方法是什么?

python - 保持数字有序的有效方法

php - 管理 key (在 memcache 中)以防止缓存值过时的最佳方法是什么?

android - 在 React Native 上缓存图像