Consider a system with 1 MB physical memory and a word length of 1 byte. The
system uses a direct mapped cache, with block numbers starting from 0. The word
with physical address 0xA2C28 is mapped to the cache block number \(176_{10}\). The
maximum possible size of the cache (in KB) for this configuration is ___________.
(answer in integer)
Note: \(1\mathrm{K}=2^{10}\) and \(1\mathrm{M}=2^{20}\)
Think of the address as split into tag, cache-line number and block offset. We need the split that makes the line number equal to \(176\) and also gives the largest cache.
The physical address is \(0xA2C28 = (1010\,0010\,1100\,0010\,1000)_2\). The number \(176\) is \((10110000)_2\). If we discard the lowest \(6\) bits as block offset, the following index bits contain the suffix \(10110000\) and can be extended left to \(00010110000\), which is still decimal \(176\).
With \(6\) offset bits and \(11\) line-index bits, the cache has \(2^{11}\) lines and each line stores \(2^6\) bytes. Hence the cache capacity is \(2^{11} imes 2^6 = 2^{17}\) bytes.
Since \(2^{17}\) bytes \(= 128\) KB, the maximum possible cache size is \(oxed{128 ext{ KB}}\).