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?
Answer
(A)
Explanation
Each block holds one byte, so the address has no offset field: it is just tag plus index, \(4 + 12 = 16\) bits.
- Main memory: \(2^{16}\) bytes = 64 KB.
- Cache: the index picks one of \(2^{12}\) blocks of 1 byte each, so the cache holds \(2^{12}\) bytes = 4 KB.
Option D’s 6 KB would add the 4-bit tags to the data (12 bits per block), and its 128 KB would need a 17-bit address, so it does not fit.
Answer: A