Question:

Consider a set-associative cache of size 2KB with cache block size of 64 bytes. If the width of the tag field is 22 bits, the associativity of the cache is \(\underline{\hspace{2cm}}\).

Show Hint

Associativity equals total blocks divided by the number of sets.
Updated On: Dec 29, 2025
Hide Solution
collegedunia
Verified By Collegedunia

Correct Answer: 2

Solution and Explanation

Step 1: Compute total cache blocks.
\[ \text{Cache size} = 2\,\text{KB} = 2048 \text{ bytes} \] \[ \text{Block size} = 64 \text{ bytes} \] \[ \text{Number of blocks} = \frac{2048}{64} = 32 \]

Step 2: Address breakdown.
Total address bits \( = 32 \).
Block offset bits \( = \log_2 64 = 6 \).
Given tag bits \( = 22 \).

Step 3: Compute index bits.
\[ \text{Index bits} = 32 - 22 - 6 = 4 \]

Step 4: Number of sets and associativity.
\[ \text{Number of sets} = 2^4 = 16 \] \[ \text{Associativity} = \frac{32}{16} = 2 \] % Final Answer

Final Answer: \[ \boxed{2} \]

Was this answer helpful?
0
0

Top Questions on Memory hierarchy

View More Questions

Questions Asked in GATE CS exam

View More Questions