A computer system has a 4K word cache organized in block-set-associative manner with 4 blocks per set, 64 words per block. The number of bits in the SET and WORD fields of the main memory address format is:
A. 15, 40
B. 6, 4
C. 7, 2
D. 4, 6
GATE 1995 · Computer Organization and Architecture · Cache Memory · medium
Answer: D. 4, 6 — SET field requires 4 bits, WORD field requires 6 bits.
Compute total number of blocks in cache: Cache size = 4K = 4096 words. Block size = 64 words.
Total blocks = 4096 / 64 = 64 blocks.
Compute number of sets: Associativity = 4 blocks per set.
Number of sets = 64 / 4 = 16 sets.
Compute SET and WORD field bits: SET bits = log_2(16) = 4 bits.
WORD bits = log_2(64) = 6 bits.