Question
Consider a set-associative cache of size 2KB () 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 ______.
Official answer and solution
- Official answer
- 2
- From
- Official GATE 2021 answer key
Solution
Use the memory address format breakdown into Tag, Set Index, and Block Offset fields.
Given parameters:
- Memory address width = 32 bits
- Cache block size = 64 bytes bytes
- Cache capacity = 2 KB bytes
- Tag width = 22 bits
Calculate the field bit widths:
The number of sets in the cache is:
The total number of cache lines (blocks) in the cache is:
The associativity (number of lines per set) is:
2
The answer is the one in the official GATE answer key. The solution is this site's own explanation.
Source
- Paper
- GATE 2021 Computer Science and Information Technology - Session 2 (CS2)
- Question
- 29 of 65, printed as CS Q.19
- 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.