简体   繁体   English

如何计算集合关联缓存大小?

[英]How to calculate set associative cache size?

A 32-bit processor has a two-way associative cache set that uses the 32 address bits as follows: 31-14 tags, 13-5 index, 4-0 offsets. 32 位处理器有一个双向关联高速缓存集,它使用 32 个地址位,如下所示:31-14 个标签、13-5 个索引、4-0 个偏移量。

Calculate :计算 :

  1. The size of the cache line in number of words缓存行的大小(以字数表示)
  2. The total cache size in bits以位为单位的总缓存大小

I do not understand how to solve it, in my slides there is almost nothing on the set associative caches.我不明白如何解决它,在我的幻灯片中,集合关联缓存上几乎没有任何内容。

Solutions :解决方案:

  1. 2^3 = 8 words (remaining 3 offset bits removed 2 bits for byte address) 2^3 = 8 words (剩余 3 个偏移位删除了 2 个字节地址位)
  2. 2 * 2^9 * (1 + 18 + 8 * 2^5)

For 1 Shouldn't it be 2^(number of offset bits) so 2^5?对于 1 不应该是 2^(偏移位数)所以 2^5? And for 2 what is the formula used? 2 使用的公式是什么?

  1. The size of a word and the smallest entity addressable are not given.没有给出字的大小和可寻址的最小实体。 But, if we assume that addresses are byte oriented and that a word hold 4 bytes, there are 2^5 bytes/line and 2^3 words但是,如果我们假设地址是面向字节的并且一个字包含 4 个字节,那么每行有 2^5 个字节和 2^3 个字

  2. 2 * 2^9 * (1 + 18 + 8 * 2^5)

2 (number of ways/sets) * 2^9 (number of sets based on index) 
     * (1 (valid bit) + 18 (tag size) + 8 (bits/byte) * 2^5 (line size in bytes))

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM