A 4-way set-associative cache holds 32 KB with 32-byte blocks and 32-bit addresses. How many tag bits does each block need?
Correct answer B. 19
Explanation
Offset = log2(32) = 5 bits. Number of sets = 32 KB / (32 B x 4 ways) = 256, so the index takes 8 bits. Tag = 32 - 8 - 5 = 19 bits. Answering 17 treats the cache as direct-mapped (1024 sets, 10 index bits). Each doubling of associativity halves the sets, removing one index bit and adding one tag bit.
Answer checked How we write and check questions
Discussion