StreakPeaked· Practice

ExamsGATETechnical

Consider a memory system with 1M bytes of main memory and 16K bytes of cache memory. Assume that the processor generates 20-bit memory address, and the cache block size is 16 bytes. If the cache uses direct mapping, how many bits will be required to store all the tag values? [Assume memory is byte addressable. 1K = 2¹⁰, 1M = 2²⁰.]

  1. 6 × 2¹⁰
  2. 8 × 2¹⁰
  3. 2¹²
  4. 2¹⁴

Correct answer: 6 × 2¹⁰

Solution

To determine the number of bits required to store all the tag values in a direct-mapped cache, we first calculate the number of cache lines, which is the cache size divided by the block size. With 16K bytes of cache and a block size of 16 bytes, there are 1024 cache lines. The main memory has 1M bytes, which corresponds to 20 bits for addressing. The index requires 10 bits (since 1024 = 2¹⁰), leaving 10 bits for the tag (20 total bits - 10 index bits). Thus, the total number of bits for all tag values is 1024 lines multiplied by 10 bits, resulting in 6 × 2¹⁰ bits.

Related GATE Technical questions

⚔️ Practice GATE Technical free + battle 1v1 →