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.

A1=0x42C8A4,A2=0x546888,A3=0x6A289C,A4=0x5E4880\text{A1} = \text{0x42C8A4},\quad \text{A2} = \text{0x546888},\quad \text{A3} = \text{0x6A289C},\quad \text{A4} = \text{0x5E4880}

Which one of the following is TRUE?

Choose one option
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 = 2242^{24} bytes   ⟹  \implies 24-bit physical address.
  • Block size = 256 bytes = 282^8 bytes   ⟹  \implies Block offset = 8 bits (bits 0 to 7).
  • Total cache size = 64 KB = 2162^{16} bytes.
  • Number of lines in cache = 64 KB256 B=256\frac{64 \text{ KB}}{256 \text{ B}} = 256 lines.
  • 4-way set associative   ⟹  \implies Number of sets = 2564=64=26\frac{256}{4} = 64 = 2^6 sets.
  • Set index field = 6 bits (bits 8 to 13).
  • Tag field = 24−(8+6)=1024 - (8 + 6) = 10 bits (bits 14 to 23).

Extract Set Index (bits 8 to 13) for each address:

  • A1=0x42C8A4\text{A1} = \text{0x42C8A4}:
    • Byte 1 (bits 8..15) is 0xC8 = 1100 1000
    • Lower 6 bits (bits 8..13) are 00 1000 = 8108_{10}
  • A2=0x546888\text{A2} = \text{0x546888}:
    • Byte 1 (bits 8..15) is 0x68 = 0110 1000
    • Lower 6 bits (bits 8..13) are 10 1000 = 401040_{10}
  • A3=0x6A289C\text{A3} = \text{0x6A289C}:
    • Byte 1 (bits 8..15) is 0x28 = 0010 1000
    • Lower 6 bits (bits 8..13) are 10 1000 = 401040_{10}
  • A4=0x5E4880\text{A4} = \text{0x5E4880}:
    • Byte 1 (bits 8..15) is 0x48 = 0100 1000
    • Lower 6 bits (bits 8..13) are 00 1000 = 8108_{10}

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.
Final answer

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.