A computer system with a word length of 32 bits has a 16 MB byte- addressable…

2020

A computer system with a word length of 32 bits has a 16 MB byte- addressable main memory and a 64 KB, 4-way set associative cache memory with a block size of 256 bytes. Consider the following four physical addresses represented in hexadecimal notation.

\(A1 = 0x42C8A4,    \ \ \ \ \ \ \ \    A2 = 0x546888,  \ \ \ \ \ \ \ \       A3 = 0x6A289C,    \ \ \ \ \ \ \ \     A4 = 0x5E4880\)

Which one of the following is TRUE ?

  1. A.

    \(A1\) and \(A4\) are mapped to different cache sets.

  2. B.

    \(A2\) and \(A3\) are mapped to the same cache set.

  3. C.

    \(A3\) and \(A4\) are mapped to the same cache set.

  4. D.

    \(A1\) and \(A3\) are mapped to the same cache set.

Attempted by 131 students.

Show answer & explanation

Correct answer: B

Key insight: with a 256-byte block and a 64 K B (64 KB) cache that is 4-way set associative, the block offset is 8 bits and there are 64 sets (6 index bits). To find the set: block number = address >> 8, set = block_number & 0x3F.

  • Compute block numbers (address >> 8): A1 = 0x42C8, A2 = 0x5468, A3 = 0x6A28, A4 = 0x5E48.

  • Compute set indices (block_number & 0x3F): A1 -> 0x08 (8), A2 -> 0x28 (40), A3 -> 0x28 (40), A4 -> 0x08 (8).

Conclusion: Addresses 0x546888 and 0x6A289C map to the same cache set (set 40), so the correct statement is that A2 and A3 are mapped to the same cache set.

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

Explore the full course: Gate Guidance By Sanchit Sir