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=210, 1M=220 .]
GATE CS - 2025,
Answer: A
The tag storage is \(6 \times 2^{10}\) bits.
Split the 20-bit address for a direct-mapped cache:
\[ \begin{aligned} \text{offset} &= \log_{2}16 = 4\ \text{bits} \\ \text{lines} &= \frac{16\text{K}}{16} = 2^{10} \Rightarrow \text{index} = 10 \\ \text{tag} &= 20 - 10 - 4 = 6\ \text{bits} \end{aligned} \]
Each of the \(2^{10}\) lines stores one 6-bit tag, so the tags take \(6 \times 2^{10}\) bits in all.
\(8 \times 2^{10}\) would need an 8-bit tag, which happens if the index or offset is miscounted. \(2^{12}\) and \(2^{14}\) correspond to 4-bit and 16-bit tags per line, neither of which fits a 20-bit address split this way.
Please log in or register to report this question.