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 are respectively: A. 9, 6, 5 B. 7, 7, 6 C. 7, 5, 8 D. 9, 5, 6

GATE 2007 · Computer Organization and Architecture · Cache Memory · medium

Answer: TAG = 9 bits, LINE (set index) = 5 bits, WORD (block offset) = 6 bits. Answer: D. 9, 5, 6

  1. Calculate WORD (block offset) bits: Line size = 64 words. To address any one of 64 words within a line: WORD bits = log2(64) = 6 bits.
  2. Calculate LINE (set index) bits: Total lines = 128, associativity = 4 (4-way). Number of sets = 128 / 4 = 32. Bits for set index = log2(32) = 5 bits.
  3. Calculate TAG bits: TAG bits = 20 - 5 - 6 = 9 bits.
  4. State the answer: Summarising: WORD = 6 bits, LINE (set index) = 5 bits, TAG = 9 bits. The question asks for TAG, LINE, WORD in that order: 9, 5, 6. This corresponds to option D.