【问题标题】:Is the Cache Index the same for each Cache block/line?每个缓存块/行的缓存索引是否相同?
【发布时间】:2017-06-10 15:10:08
【问题描述】:

根据我在网上找到的信息,每个缓存块/行的缓存索引都是相同的。我们的教练给我们的笔记似乎与此相矛盾。

【问题讨论】:

  • 位索引是一样的,当然,最终值取决于访问的地址。

标签: caching assembly mips processor


【解决方案1】:

缓存索引(或有时称为set bits)是(块地址)模块(缓存中的块数)。

如果缓存中的条目数是 2 的幂,那么模可以是 只需使用低阶 log2 (以块为单位的缓存大小)位计算 地址。

在你的情况下直接映射缓存。

4 块缓存使用块的两个最低位 (4 = 2^2 ) 地址。

(block address)       cache index
   0000 mod 4     =       00
   1000 mod 4     =       00
   0000 mod 4     =       00
   0110 mod 4     =       10
   1000 mod 4     =       00

这里有一些方程和参数,为了解决一般的缓存问题,很高兴知道。

要知道的参数

C = cache capacity
b = block size
B = number of blocks
N = degree of associativity
S = number of set
tag_bits
set_bits (also called index)
byte_offset
v = valid bits

要知道的方程式

B = C/b
S = B/N
b = 2^(byte_offset)
S = 2^(set_bits)

内存地址

|___tag________|____set___|___byte offset_|

【讨论】:

    猜你喜欢
    • 2016-03-16
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-03-26
    • 1970-01-01
    • 1970-01-01
    • 2021-12-30
    • 2015-01-27
    相关资源
    最近更新 更多