缓存:找到位的标签大小
所以我有一个问题:
一个缓存存储器以4行32 bytes组织。主内存的大小为64 kbytes。 RAM访问时间是200NS,缓存访问时间为20NS
,我很难找到解决此子问题的方法:
在位中找到标签的大小。
教师的给定答案是11位。
我不明白如何找到地址的长度,以及如何确定缓存是设置缔合或完全关联的。
So I have this problem:
One cache memory is organised in 4 lines of 32bytes. The main memory has the size of 64 KBytes.
The RAM access time is 200ns and the CACHE access time is 20ns
and I struggle to find the way to solve this sub-question:
Find the size of the tag in bits.
The given answer by the instructor is 11 bits.
I can't understand how can I find the length of the address, and how to determine if the cache is set-associative or fully associative.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
以下公式将值V的数量与位数(二进制数字)n的数量(二进制数字)相关联,将其表示并区分V值数量。
v = 2 n 和反向,即n = log2 V
中的上述公式中,V为64k,n是您想要的,数字区分64K不同的值所需的位(在这里这些值是地址,但公式可与任何n和v相关联)。
因此,1位可以区分2个不同的值。 4个不同的值之间的2位,3位:8个值,...
缓存是在4行32个字节中组织的 - 它们不再说了,因此我们应该假设它是直接映射或1向套件的关联(这些是同一件事)。
如果它是完全关联的,则不会有任何“行”,只有4个块在同一组中(好像只有1行)。 尽管如此,这还是术语的问题,所以ymmv。
如果是> 1向套装协会,我相信他们会这么说些效果。 一种晦涩的方法是将总缓存大小作为4*32 = 128的倍数。 如果第一个多个多个(例如128),则为1向套件的关联(IE直接映射),如果第二个多个(例如256),则是2-way Set sopiative。
The following formulas relate the number of Values, V, with the number of bits (binary digits), N, that it takes to represent and differentiate between V number of values.
V = 2N, and the reverse, which is N = log2 V
In the above formulas, V is 64k and N is what you're looking for, the number of bits it takes to differentiate between 64k different values (here those values are addresses, but the formula works to relate any N and V).
So, 1 bit can distinguish between 2 different values; 2 bits between 4 different values, 3 bits: 8 values, ...
The cache is organized in 4 lines of 32 bytes — and they don't say any more, so we should assume it is direct mapped or 1-way set associative (those are the same thing).
If it were fully associative, there wouldn't be any "lines", just 4 blocks all in the same set (as if only 1 line). Still, it is a matter of terminology, so YMMV.
If it were > 1-way set associative, I believe they would have said something to that effect. An obscure way would have been to give the total cache size as a multiple of 4*32=128. If the first multiple (e.g. 128), then 1-way set associative (i.e. direct mapped), and if 2nd multiple (e.g. 256) then 2-way set associative.