The tag bits in direct mapping can be given by
2024
The tag bits in direct mapping can be given by
- A.
log2 m
- B.
log2 (m/n)
- C.
log2 n
- D.
log2 mn
Attempted by 126 students.
Show answer & explanation
Correct answer: B
Key idea: In direct mapping, every main-memory block maps to exactly one cache line.
Let the number of main-memory blocks be m.
Let the number of cache lines be n.
For a fixed cache line, the number of possible memory blocks that can map there is m/n.
The tag must identify which one of these m/n blocks is currently present.
Therefore: tag bits = log2(m/n).
Final answer: log2(m/n).