The size of the physical address space of a processor is 232 bytes. The…
2026
The size of the physical address space of a processor is 232 bytes. The capacity of a cache memory unit is 223 bytes. The cache block size is 128 bytes. The cache memory unit can be built as a direct mapped cache or as a 𝐾-way set-associative cache, where 𝐾= 2𝐿 and 𝐿∈{1,2,3}. Let the length of the TAG field be 𝑀 bits for the direct mapped cache, and 𝑁 bits for the set-associative cache. Which one of the following options is true?
- A.
N=𝑀+𝐿
- B.
N=𝑀-𝐿
- C.
N=𝑀+K
- D.
N=𝑀-K
Attempted by 15 students.
Show answer & explanation
Correct answer: A
Given:
Physical address space = 2^32 bytes
Cache size = 2^23 bytes
Block size = 128 bytes = 2^7 bytes
--------------------------------------------------
Step 1: Block Offset Bits
--------------------------------------------------
Block offset bits = log2(128)
= 7 bits
--------------------------------------------------
Step 2: Direct Mapped Cache
--------------------------------------------------
Number of cache lines:
= 2^23 / 2^7
= 2^16
Index bits = 16
TAG bits for direct mapped cache:
M = 32 - 16 - 7
M = 9 bits
--------------------------------------------------
Step 3: K-Way Set Associative Cache
--------------------------------------------------
Given:
K = 2^L
Number of sets:
= 2^16 / 2^L
= 2^(16-L)
Set index bits:
= 16 - L
TAG bits:
N = 32 - (16-L) - 7
N = 32 - 16 + L - 7
N = 9 + L
But,
M = 9
Therefore,
N = M + L
--------------------------------------------------
Final Answer
--------------------------------------------------
Option A is correct.
N = M + L
"""