GATE 2021 CS (CS1) – Question 32
Consider a computer system with a byte-addressable primary memory of size $2^{32}$ bytes. Assume the computer system has a direct-mapped cache of size 32 KB (1 KB = $2^{10}$ bytes), and each cache block is of size 64 bytes. The size of the tag field is ______ bits.
Practise this question in The GATE Grind →
Show answer and explanation
Correct answer: 17
Explanation
Memory size $2^{32}$ bytes gives 32-bit addresses.
- Block size 64 bytes $=2^6$, so the **offset** is 6 bits.
- Cache size $32\text{ KB}=2^{15}$ bytes, so the number of blocks is $2^{15}/2^6=2^9=512$, and (direct mapped) the **index** is 9 bits.
- **Tag** $=32-9-6=\mathbf{17}$ bits.