
Q. The size of the physical address space of a processor is 2๐ bytes. The word length is 2๐ bytes. The capacity of cache memory is 2๐ bytes. The size of each cache block is 2๐ words. For a ๐พ-way set-associative cache memory, the length (in number of bits) of the tag field is
(A) ๐ โ ๐ โ log2 ๐พ (B) ๐ โ ๐ + log2 ๐พ
(C) ๐ โ ๐ โ ๐ โ ๐ โ log2 ๐พ (D) ๐ โ ๐ โ ๐ โ ๐ + log2 ๐พ
Ans: ๐ โ ๐ + log2 ๐พ
Sol:
Physical Address Space = 2PBytes. Word Length is 2Wbytes, which means each word is of size 2Wbytes.
Cache memory size = 2NBytes and Tag Size = 2XBytes.
Physical address is P โ W bits
Number of blocks in cache = 2(N-W-M)
It is a K-way set associative cache memory, each set in cache will have K-blocks.
So, Number of sets = 2(N-W-M)/ K
SET bits will be N-W-M-logk
Offset bits will be M
We know,
TAG bits = Main memory bits โ SET bits โ offset bits
So, TAG bits(x) = P โ W โ (N-M-W-logk)- M
= P โ W โ N + M + W + logk โ M
x = P โ N + logk