📜  门| GATE-CS-2016(套装2)|第 42 题

📅  最后修改于: 2021-09-26 04:30:16             🧑  作者: Mango

一台机器上物理地址的宽度是 40 位。 512 KB 8 路组关联缓存中的标签字段的宽度为 ____________ 位
(一) 24
(乙) 20
(C) 30
(四) 40答案:(一)
解释:一个简单的方法是我们知道物理地址是 40 个字节

We know cache size = no.of.sets*
                     lines-per-set*
                     block-size

Let us assume no of sets = 2^x 
And block size= 2^y

So applying it in formula.
2^19 = 2^x + 8 + 2^y;
So x+y = 16

Now we know that to address block size and 
set number we need 16 bits so remaining bits
must be for tag 
i.e., 40 - 16 = 24
The answer is 24 bits 

如果问题延伸并询问比较器的大小是多少,那么我们需要的是 24 位比较器。

以上解释由Sumanth Sunny提供

替代解释:

Physical Address Bits = T(Tag Bits) + S(Set Bits) + O(Offset Bits) = 40 bits    (given)
Set = 8    (given)
Size of cache = 512 KB     (given)

Size of lines = 512 / 8 = 64 KB 
So, O = 64/8 = 8 bits

Now, S + O = 8 + 8 = 16 bits
Hence, T = 40 - 16 = 24 bits 

物理地址结构

This explanation is contributed by Mohit Gupta.

Refer the following links for more understanding in the above topic:

Cache Memory
Cache Organization | Introduction

这个问题的测验