The width of the physical address on a machine is 40 bits. The width of the…

2016

The width of the physical address on a machine is 40 bits. The width of the tag field in a 512 KB 8-way set associative cache is _________ bits.

Attempted by 223 students.

Show answer & explanation

Correct answer: 24

Key idea: split the physical address into tag, index, and block offset. Tag bits = physical address width - index bits - offset bits.

  • Assume a 64-byte block (common default). Block offset bits = log2(64) = 6.

  • Number of sets = cache size / (associativity × block size) = 512 KB / (8 × 64 B) = 524,288 / 512 = 1,024 sets.

  • Index bits = log2(1,024) = 10.

  • Tag bits = 40 (physical address width) − 10 (index) − 6 (offset) = 24 bits.

Note: If the block size differs from 64 bytes, recompute the block offset and index accordingly; the procedure above still applies.

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

Explore the full course: Gate Guidance By Sanchit Sir