GATE 2025 CS (CS2) – Question 39
For a direct-mapped cache, 4 bits are used for the tag field and 12 bits are used to index into a cache block. The size of each cache block is one byte. Assume that there is no other information stored for each cache block.
Which ONE of the following is the CORRECT option for the sizes of the main memory and the cache memory in this system (byte addressable), respectively?
Practise this question in The GATE Grind →
Show answer and explanation
Correct answer: (A) 64 KB and 4 KB
Explanation
Direct-mapped cache with 1-byte blocks:
- Block offset: $\log_21=0$ bits.
- Index: 12 bits, so there are $2^{12}$ blocks.
- Tag: 4 bits.
Physical address $=4+12+0=16$ bits, so main memory is $2^{16}=64$ KB.
Cache size $=$ number of blocks $\times$ block size $=2^{12}\times1\text{ B}=4$ KB.
Answer: 64 KB and 4 KB (option A).