Question:medium

Consider a processor that generates 32-bit virtual addresses. It uses a direct mapped cache whose size is 32 KByte and has 32 Byte blocks. What is the number of bits needed for cache addressing?

Show Hint

Cache addressing bits are calculated as: Index bits + Block offset bits.
Updated On: Jul 6, 2026
  • 5
  • 10
  • 15
  • 20
Show Solution

The Correct Option is C

Approach Solution - 1

Step 1: The number of bits needed to address every byte inside the cache is simply \( \log_2(\text{cache size in bytes}) \), since each unique bit pattern must map to one byte location.
Step 2: Cache size = 32 KB = \(2^{15}\) bytes, so the number of address bits required is \( \log_2(2^{15}) = 15 \).
Step 3: This total naturally splits into 10 bits for choosing the block (since there are \(2^{10}\) blocks of 32 bytes each) and 5 bits for the offset within that block, confirming the same total.
\[ \boxed{15} \]
Was this answer helpful?
2
Show Solution

Approach Solution -2

Another way to settle this is by checking how many distinct locations each option's bit-count can actually address, using \(2^{\text{bits}}\), and comparing that to the cache's real byte count of 32 KB = 32768 bytes:

  1. 5 bits: \(2^5 = 32\) addressable locations, enough only for one 32-byte block, far short of the full cache.
  2. 10 bits: \(2^{10} = 1024\) addressable locations, this matches the number of blocks (1024), not the number of bytes, so it under-counts the addressing needed for byte-level access.
  3. 15 bits: \(2^{15} = 32768\) addressable locations, which exactly equals the cache size of 32 KB in bytes. Every byte in the cache gets a unique address with exactly this many bits.
  4. 20 bits: \(2^{20} = 1{,}048{,}576\) addressable locations, this is far larger than the 32 KB cache actually contains, so it massively overshoots what's needed.

Matching \(2^{\text{bits}}\) to the actual cache capacity singles out one option cleanly.

Therefore, the correct answer is 15.

Was this answer helpful?
0