Question
The width of the physical address on a machine is 40 bits. The width of the tag field in a 512 KB 8-way set associative cache is ________ bits.
Official answer and solution
- Official answer
- 24
- From
- Official GATE 2016 answer key
Solution
Use the relationship between total cache capacity, associativity, and physical address bits to find the tag width.
Given parameters:
- Physical address width bits.
- Cache capacity bytes.
- Set associativity ways.
Let be the block size in bytes. The physical address is partitioned into:
where the block offset field has bits.
Calculate the number of sets in the cache:
The number of index bits required to address the sets is:
Now compute the tag field width:
Notice that the block size cancels out completely. The tag width is 24 bits.
24
Assuming the block size must be known, or miscalculating the number of sets by omitting associativity.
The answer is the one in the official GATE answer key. The solution is this site's own explanation.
Source
- Paper
- GATE 2016 Computer Science and Information Technology (CS) Session 2
- Question
- 42 of 65, printed as CS Q.32
- 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.