Consider a 4-way set associative cache consisting of 128 lines with a line…

2007

Consider a 4-way set associative cache consisting of 128 lines with a line size of 64 words. The CPU generates a 20-bit address of a word in main memory. The number of bits in the TAG, LINE and WORD fields arerespectively:

  1. A.

    9,6,5

  2. B.

    7, 7, 6

  3. C.

    7, 5, 8

  4. D.

    9, 5, 6

Attempted by 210 students.

Show answer & explanation

Correct answer: D

Final answer: TAG = 9, LINE = 5, WORD = 6

Key steps:

  • Compute the word (offset) field: line size = 64 words → word bits = log2(64) = 6.

  • Compute the number of sets and the index (line) field: total lines = 128 and associativity = 4 → sets = 128 / 4 = 32 → index bits = log2(32) = 5.

  • Compute the tag field: address width = 20 bits → tag bits = 20 - (index bits + word bits) = 20 - (5 + 6) = 9.

  • Therefore the fields are TAG = 9 bits, LINE (index) = 5 bits, WORD (offset) = 6 bits.

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

Explore the full course: Gate Guidance By Sanchit Sir