GateAI
Cache Memory and Hierarchy

GATE CSE 2020 · Q30

MCQ2 marksMedium

Time

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?

Select one answerSingle correct

Pick an option to check

Solution

Step-by-step verified solution

Official answer: B) A2 and A3 are mapped to the same cache set.

Cache Memory and Hierarchy

### 1. Cache Geometry & Address Breakdown:

  • Main Memory Size =16 MB=224 bytes  ⟹  = 16\text{ MB} = 2^{24}\text{ bytes} \implies Physical Address is 24 bits24\text{ bits}.

  • Block Size =256 bytes=28 bytes  ⟹  Block Offset=8 bits= 256\text{ bytes} = 2^8\text{ bytes} \implies \text{Block Offset} = 8\text{ bits}.

  • Cache Size =64 KB=216 bytes= 64\text{ KB} = 2^{16}\text{ bytes}.

  • Total Number of Cache Lines =21628=256= \frac{2^{16}}{2^8} = 256.

  • Since it is 4-way set associative, the number of sets is:

    Number of Sets=2564=64=26  ⟹  Set Index=6 bits\text{Number of Sets} = \frac{256}{4} = 64 = 2^6 \implies \text{Set Index} = 6\text{ bits}
  • Tag Bits =24−(6+8)=10 bits= 24 - (6 + 8) = 10\text{ bits}.

Address division (24 bits):

Tag⏟10 bitsSet Index⏟6 bitsBlock Offset⏟8 bits\underbrace{\text{Tag}}_{10\text{ bits}} \quad \underbrace{\text{Set Index}}_{6\text{ bits}} \quad \underbrace{\text{Block Offset}}_{8\text{ bits}}

### 2. Extracting the Set Index for Each Address: The lower 8 bits (the last 2 hex digits) correspond to the block offset. The next 6 bits (bits 8 to 13) correspond to the set index, which is given by ((Address≫8) & 0x3F)((\text{Address} \gg 8) \ \& \ 0\text{x}3\text{F}):

  • A1 = 0x42C8A4:

    • Address≫8=0x42C8\text{Address} \gg 8 = \text{0x42C8}

    • Lowest byte is 0xC8=110010002\text{0xC8} = 11001000_2

    • Lowest 6 bits =0010002=810= 001000_2 = 8_{10}

    • Set(A1)=8\text{Set}(A1) = 8

  • A2 = 0x546888:

    • Address≫8=0x5468\text{Address} \gg 8 = \text{0x5468}

    • Lowest byte is 0x68=011010002\text{0x68} = 01101000_2

    • Lowest 6 bits =1010002=4010= 101000_2 = 40_{10}

    • Set(A2)=40\text{Set}(A2) = 40

  • A3 = 0x6A289C:

    • Address≫8=0x6A28\text{Address} \gg 8 = \text{0x6A28}

    • Lowest byte is 0x28=001010002\text{0x28} = 00101000_2

    • Lowest 6 bits =1010002=4010= 101000_2 = 40_{10}

    • Set(A3)=40\text{Set}(A3) = 40

  • A4 = 0x5E4880:

    • Address≫8=0x5E48\text{Address} \gg 8 = \text{0x5E48}

    • Lowest byte is 0x48=010010002\text{0x48} = 01001000_2

    • Lowest 6 bits =0010002=810= 001000_2 = 8_{10}

    • Set(A4)=8\text{Set}(A4) = 8

### 3. Evaluating the Options:

  • A: A1 and A4 are mapped to the same cache set (88). (False)

  • B: A2 and A3 are mapped to the same cache set (4040). (True)

  • C: A3 (4040) and A4 (88) are mapped to different cache sets. (False)

  • D: A1 (88) and A3 (4040) are mapped to different cache sets. (False)

Thus, statement B is TRUE.

Try the question first, then check your work.

Think the official key or this write-up is wrong?

Report error or challenge

Examiner trap

The misconception this question tests

This Cache Memory and Hierarchy previous year question is Q30 of the GATE CSE 2020 paper. Find more GATE CSE PYQs on Cache Memory and Hierarchy in Computer Organization and Architecture, or browse all GATE CSE PYQs.

Free diagnostic

Where do you stand for GATE?

Take the 20-minute diagnostic: the 3 topics that cost you the most marks, and a rank range. Or sit 5 related Cache Memory and Hierarchy PYQs now with no account.

One GATE CSE PYQ every morning

An official question by email at 7 AM IST, with a link to its verified solution. Unsubscribe in one click.

Cache Memory and Hierarchy in GATE CSE

Cache Memory and Hierarchy has 47 GATE CSE PYQs across 23 papers from 2011 to 2026. 16 of them are 2-mark MCQs like this one, and it is the only one in GATE CSE 2020.

How GATE tests Cache Memory and Hierarchy

More from GATE CSE 2020

Share this solution

A plain-text card for WhatsApp or Telegram study groups.

GateAI solution cardGATE CSE 2020 · Q30 · MCQ

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?

Topic-wise GATE CS PYQs with verified steps

Independent practice explanation verified by the GateAI team. GATE is conducted by the IITs; question text follows the official paper.