Memory Hierarchy
In a cache with 64-byte lines and 64 sets, which set holds the data at address 0x1234?
- A4
- B52
- C8
Show answer and explanation
Answer: C. 8
The offset is the low 6 bits (64 = 2⁶), and the index is the next 6 bits (64 sets = 2⁶). 0x1234 = 4,660, and 4,660 ÷ 64 = 72 remainder 52, so the line number is 72. The set number is the line number modulo the set count: 72 mod 64 = 8. 52 is the remainder, the position within the line (offset). 4 is merely the last hexadecimal digit of the address and has nothing to do with the set.
- A. 4 is just the last hex digit and unrelated to the set.
- B. 52 is the position within the line (offset).
- C. Correct. Line number 72 modulo 64 gives 8.