【问题标题】:Tag Size and Cache Bits Exercise标记大小和缓存位练习
【发布时间】:2021-09-17 00:51:54
【问题描述】:

我正在为明天到期的计算机体系结构考试而学习,并且一直在练习有关标记大小和缓存位总数的练习。问题来了:

Question 8:
This question deals with main and cache memory only.
Address size: 32 bits
Block size: 128 items
Item size: 8 bits
Cache Layout: 6 way set associative
Cache Size: 192 KB (data only)
Write Policy: Write Back

Answer: The tag size is 17 bits. The total number of cache bits is 1602048.

我知道这是一个失败的直接练习,但我似乎缺乏正确的公式。我也知道N组关联的结构是|TAG 25 bits|SET 2 bits|OFFSET 5 bits|。并且该标签大小 = AddrSize - Set - Offset(- 项目大小,如果有的话)从而给出 17 位标签大小的答案。

但是,请问如何计算缓存的总位数?

【问题讨论】:

    标签: caching cpu-architecture cpu-cache


    【解决方案1】:
    • 缓存大小(以字节为单位):192*1024 = 196608

    • 块数:196608 / 128 = 1536

    • 组数:1536 / 6 = 256

    • 设置位数:log2(256) = 8

    • 偏移数位:log2(128) = 7

    • 标签大小:32-(8+7) = 17

    • 元数据:有效+脏=2位

    • 总标签 + 元数据:(17+2)*1536 = 29184 位

    • 总数据:1536*128*8 = 1572864 位

    • 总大小:29184 + 1572864 = 1,602,048

    也可能有用于替换策略的位,但我们可以假设它是随机的以使答案有效。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2013-07-05
      • 2022-06-24
      • 1970-01-01
      • 2018-09-26
      • 2013-12-05
      • 2019-05-05
      • 2023-03-23
      相关资源
      最近更新 更多