GATE CS 2025 Set 1 | Question 36
Consider a memory system with 1M bytes of main memory and 16K bytes of cache memory. Assume that the processor generates 20-bit memory address, and the cache block size is 16 bytes. If the cache uses direct mapping, how many bits will be required to store all the tag values? [Assume memory is byte addressable, 1K=\(2^{10}\), 1M=\(2^{20}\).]
Explanation
Answer: (A)
Split the 20-bit address into tag, line index and block offset.
- Offset: a block has \(16 = 2^4\) bytes, so 4 bits.
- Index: the cache has \(2^{14} / 2^4 = 2^{10}\) lines, so 10 bits.
- Tag: \(20 - 10 - 4 = 6\) bits.
Each of the \(2^{10}\) cache lines stores its own 6-bit tag, so the tag storage is \(6 \times 2^{10}\) bits.
Answer: A
