Consider a direct mapped cache of size 32 KB with block size 32 bytes. The CPU…

2005

Consider a direct mapped cache of size 32 KB with block size 32 bytes. The CPU generates 32 bit addresses. The number of bits needed for cache indexing and the number of tag bits are respectively

  1. A.

    10, 17

  2. B.

    10, 22

  3. C.

    15, 17

  4. D.

    5, 17

Attempted by 442 students.

Show answer & explanation

Correct answer: A

Answer: 10 index bits, 17 tag bits.

Steps:

  • Calculate block offset: block size = 32 bytes → offset bits = log2(32) = 5.

  • Calculate number of cache lines: cache size = 32 KB = 32768 bytes. Lines = 32768 / 32 = 1024 → index bits = log2(1024) = 10.

  • Calculate tag bits: tag bits = address bits - index bits - offset bits = 32 - 10 - 5 = 17.

Therefore, the cache indexing requires 10 bits and the tag requires 17 bits.

Explore the full course: Gate Guidance By Sanchit Sir