Consider a memory system with bytes of main memory and bytes of cache memory. Assume that the processor generates -bit memory address, and the cache block size is bytes. If the cache uses direct mapping, how many bits will be required to store all the values? [Assume memory is byte addressable, , .]
View worked solution
Answer: A
To find the total number of bits required to store all the tag values in the cache, we can break down the memory address structure for a direct-mapped cache.
1. Identify the Given Parameters
- Main Memory Size: (which corresponds to a -bit physical address)
- Cache Size:
- Block Size:
2. Calculate the Number of Cache Lines
The number of lines (or blocks) in the cache is given by:
3. Determine the Address Fields
In a direct-mapped cache, the -bit physical address is split into three fields:
- Block Offset: Since the block size is , we need .
- Line Index: Since there are cache lines, we need .
- Tag Bits: The remaining bits are used for the tag:
4. Calculate Total Tag Bits
Each of the cache lines must store its own -bit tag. Therefore, the total number of bits required to store all the tag values is:
Thus, the correct option is A.
Free practice · Your answers on this page are not saved.
