GateAI
Cache Memory and Hierarchy

GATE CSE 2021 Set 2 · Q19

NAT1 markMedium

Time

Consider a set-associative cache of size 2KB (1KB=2101\text{KB} = 2^{10} bytes) with cache block size of 64 bytes. Assume that the cache is byte-addressable and a 32-bit address is used for accessing the cache. If the width of the tag field is 22 bits, the associativity of the cache is ________.

Your answerNumerical answer

Enter a value to check

Solution

Step-by-step verified solution

Official answer: 2

Cache Memory and Hierarchy

Given parameters:

  • Cache size =2 KB=2×210 bytes=2048 bytes= 2\text{ KB} = 2 \times 2^{10}\text{ bytes} = 2048\text{ bytes}

  • Block size =64 bytes=26 bytes= 64\text{ bytes} = 2^6\text{ bytes}

  • Total address bits =32 bits= 32\text{ bits}

  • Tag bits =22 bits= 22\text{ bits}

  1. Block Offset Bits:

    Block offset=log⁡2(64)=6 bits\text{Block offset} = \log_2(64) = 6\text{ bits}
  2. Set Index Bits:

    Set index bits=Address bits−(Tag bits+Block offset bits)\text{Set index bits} = \text{Address bits} - (\text{Tag bits} + \text{Block offset bits})
    Set index bits=32−(22+6)=32−28=4 bits\text{Set index bits} = 32 - (22 + 6) = 32 - 28 = 4\text{ bits}
  3. Number of Sets:

    Number of sets=24=16\text{Number of sets} = 2^4 = 16
  4. Total Number of Cache Blocks:

    Total blocks=Cache sizeBlock size=204864=32\text{Total blocks} = \frac{\text{Cache size}}{\text{Block size}} = \frac{2048}{64} = 32
  5. Associativity (kk-way):

    k=Total blocksNumber of sets=3216=2k = \frac{\text{Total blocks}}{\text{Number of sets}} = \frac{32}{16} = 2

Thus, the associativity of the cache is 2.

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 Q19 of the GATE CSE 2021 Set 2 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. 7 of them are 1-mark NAT questions like this one, and GATE CSE 2021 Set 2 has 2.

How GATE tests Cache Memory and Hierarchy

More from GATE CSE 2021 Set 2

Share this solution

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

GateAI solution cardGATE CSE 2021 Set 2 · Q19 · NAT

Consider a set-associative cache of size 2KB (1KB = 210 bytes) with cache block size of 64 bytes. Assume that the cache is byte-addressable and a 32-bit address is used for accessing the cache. If the width of the tag field is 22 bits, the associativity of the cache is …

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.