Question

A 4-way set-associative cache memory unit with a capacity of 16 KB is built using a block size of 8 words. The word length is 32 bits. The size of the physical address space is 4 GB. The number of bits for the TAG field is _____.

Official answer and solution
Official answer
20
From
Official GATE 2014 answer key

Solution

Decompose the physical address into tag, set index, and block offset fields using cache capacity and set associativity.

  1. Physical Address Space:

    • Size = 4 GB=2324\text{ GB} = 2^{32} bytes.
    • Physical address length = 3232 bits.
  2. Block Offset (Byte Offset):

    • Block size = 88 words.
    • Word size = 3232 bits = 44 bytes.
    • Block size in bytes = 8×4=328 \times 4 = 32 bytes =25= 2^5 bytes.
    • Block offset = 55 bits.
  3. Set Index Bits:

    • Total cache capacity = 16 KB=16×102416\text{ KB} = 16 \times 1024 bytes =214= 2^{14} bytes.
    • Total number of cache blocks:
      Lines=21425=29=512 blocks.\text{Lines} = \frac{2^{14}}{2^5} = 2^9 = 512\text{ blocks}.
    • The cache is 4-way set-associative (44 blocks per set):
      Number of sets=5124=128=27 sets.\text{Number of sets} = \frac{512}{4} = 128 = 2^7\text{ sets}.
    • Set index = 77 bits.
  4. Tag Field Bits:

    Tag=Total Address Bits−(Set Index Bits+Block Offset Bits)\text{Tag} = \text{Total Address Bits} - (\text{Set Index Bits} + \text{Block Offset Bits})
    Tag=32−(7+5)=32−12=20 bits.\text{Tag} = 32 - (7 + 5) = 32 - 12 = 20\text{ bits}.
Final answer

20

Common trap

Treating block size as 8 bytes instead of 8 words (32 bytes).

The answer is the one in the official GATE answer key. The solution is this site's own explanation.

Source

Paper
GATE 2014 Computer Science and Information Technology (CS) Session 2
Question
19 of 65, printed as CS Q.9
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.