Question
Consider a machine with a byte addressable main memory of bytes divided into blocks of size 32 bytes. Assume that a direct mapped cache having 512 cache lines is used with this machine. The size of the tag field in bits is
Official answer and solution
- Official answer
- 18
- From
- Official GATE 2017 answer key
Solution
Decompose the physical address into Tag, Cache Line Index, and Block Offset fields.
Given parameters:
- Byte-addressable main memory size bytes Physical Address bits.
- Cache block size bytes bytes Block Offset bits.
- Number of cache lines in direct-mapped cache Cache Index bits.
In a direct-mapped cache, the physical address is partitioned as:
Thus, the size of the tag field is 18 bits.
18
Confusing line index with word offset or forgetting that cache size in lines gives directly.
The answer is the one in the official GATE answer key. The solution is this site's own explanation.
Source
- Paper
- GATE 2017 Computer Science and Information Technology (CS) Session 2
- Question
- 53 of 65, printed as CS Q.53
- 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.