Question
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.
Which one of the following is TRUE?
Official answer and solution
- Official answer
- B
- From
- Official GATE 2020 answer key
Solution
Extract the cache set index bits from each physical address to find which pair maps to the same set.
Determine the address bit breakdown:
- Main memory = 16 MB = bytes 24-bit physical address.
- Block size = 256 bytes = bytes Block offset = 8 bits (bits 0 to 7).
- Total cache size = 64 KB = bytes.
- Number of lines in cache = lines.
- 4-way set associative Number of sets = sets.
- Set index field = 6 bits (bits 8 to 13).
- Tag field = bits (bits 14 to 23).
Extract Set Index (bits 8 to 13) for each address:
- :
- Byte 1 (bits 8..15) is
0xC8=1100 1000 - Lower 6 bits (bits 8..13) are
00 1000=
- Byte 1 (bits 8..15) is
- :
- Byte 1 (bits 8..15) is
0x68=0110 1000 - Lower 6 bits (bits 8..13) are
10 1000=
- Byte 1 (bits 8..15) is
- :
- Byte 1 (bits 8..15) is
0x28=0010 1000 - Lower 6 bits (bits 8..13) are
10 1000=
- Byte 1 (bits 8..15) is
- :
- Byte 1 (bits 8..15) is
0x48=0100 1000 - Lower 6 bits (bits 8..13) are
00 1000=
- Byte 1 (bits 8..15) is
Comparing the sets:
- A1 and A4 map to set 8.
- A2 and A3 map to set 40.
- Therefore, 'A2 and A3 are mapped to the same cache set' is TRUE.
B
The answer is the one in the official GATE answer key. The solution is this site's own explanation.
Source
- Paper
- GATE 2020 Computer Science and Information Technology (CS)
- Question
- 40 of 65, printed as CS Q.30
- Section
- Computer Science and Information Technology
Report an error in this question
GATE questions are the work of the organising institutes. This site is independent and is not affiliated with them.