Question
A certain processor uses a fully associative cache of size . The cache block size is . Assume that the main memory is byte addressable and uses a -bit address. How many bits are required for the Tag and the Index fields respectively in the addresses generated by the processor?
Official answer and solution
- Official answer
- D
- From
- Official GATE 2019 answer key
Solution
Recall the addressing fields of a fully associative cache.
In a cache memory hierarchy, a memory address is divided into:
We are given:
- Cache size =
- Block size = , which requires for the block offset.
- Main memory address = .
In a fully associative cache, any block can be placed in any cache line. Effectively, there is only set (the entire cache is a single set). Therefore, the number of index bits required is:
The remaining address bits are allocated to the Tag field:
Thus, Tag = and Index = .
D
Calculating index bits as log2(number of cache blocks), which applies only to direct-mapped caches.
The answer is the one in the official GATE answer key. The solution is this site's own explanation.
Source
- Paper
- GATE 2019 Computer Science and Information Technology (CS)
- Question
- 11 of 65, printed as CS Q.1
- 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.