Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/178.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Memory 缓存寻址:索引长度、块偏移量、字节偏移量&;标签?_Memory_Mips_Cpu Cache - Fatal编程技术网

Memory 缓存寻址:索引长度、块偏移量、字节偏移量&;标签?

Memory 缓存寻址:索引长度、块偏移量、字节偏移量&;标签?,memory,mips,cpu-cache,Memory,Mips,Cpu Cache,假设我知道以下值: W = Word length (= 32 bits) S = Cache size in words B = Block size in words M = Main memory size in words 如何计算需要多少位用于: - Index - Block offset - Byte offset - Tag a) 在直接映射缓存中 b) 在完全关联缓存中?地址可分为以下部分: [ tag | index | block or line offset | by

假设我知道以下值:

W = Word length (= 32 bits)
S = Cache size in words
B = Block size in words
M = Main memory size in words
如何计算需要多少位用于:

- Index
- Block offset
- Byte offset
- Tag
a) 在直接映射缓存中
b) 在完全关联缓存中?

地址可分为以下部分:

[ tag | index | block or line offset | byte offset ]
字节偏移位数 0表示字可寻址内存,log2(每个字的字节数)表示字节可寻址内存

块或行偏移位数 log2(每行字数)

索引位数 log2(CS),其中CS是缓存集的数量

  • 对于完全关联,CS为1。因为log2(1)是0,所以没有 索引位
  • 对于直接映射,CS等于CL,即缓存线的数量,因此索引位的数量为log2(CS)==log2(CL)
  • 对于n路关联CS=CL÷n:log2(CL÷n)索引位
通过将缓存大小除以block size=S/B(假设它们都不包括标记和有效位的大小),可以计算出您拥有多少缓存线

标记位数 地址长度减去用于偏移量和索引的位数。地址的长度可以使用主存储器的大小来计算,例如,任何字节都需要寻址,若它是字节可寻址存储器的话

资料来源: