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 334 students.

Show answer & explanation

Correct answer: A

Step 1: Compute the block offset.

Block size = 32 bytes, so block offset = log2(32) = 5 bits.

Step 2: Compute the number of cache lines and index bits.

  • Cache size = 32 KB = 32 * 1024 = 32768 bytes.

  • Number of lines = 32768 / 32 = 1024. Index bits = log2(1024) = 10 bits.

Step 3: Compute tag bits.

Total address bits = 32. Tag bits = 32 - index bits - offset bits = 32 - 10 - 5 = 17 bits.

Final answer: index bits = 10, tag bits = 17.

A video solution is available for this question — log in and enroll to watch it.

Explore the full course: Gate Guidance By Sanchit Sir