Direct Mapping Problem
Direct Mapping Problem
Consider a direct mapped cache of size 16 KB with block size 256 bytes. The size of
main memory is 128 KB. Find-
1. Number of bits in tag
2. Tag directory size
Solution-
Given-
●Cache memory size = 16 KB
● Block size = Frame size = Line size = 256 bytes
● Main memory size = 128 KB
● We consider that the memory is byte addressable.
Consider a fully associative mapped cache of size 512 KB with block size 1 KB. There
are 17 bits in the tag. Find-
1. Size of main memory
2. Tag directory size
Solution-
Given-
● Cache memory size = 512 KB
● Block size = Frame size = Line size = 1 KB
● Number of bits in tag = 17 bits
We have,
Number of bits in physical address = 27 bits
Thus, Size of main memory
= 227 bytes
= 128 MB
Consider a 8-way set associative mapped cache of size 512 KB with block size 1 KB.
There are 7 bits in the tag. Find-
1. Size of main memory
2. Tag directory size
Solution-
Given-
● Set size = 8
● Cache memory size = 512 KB
● Block size = Frame size = Line size = 1 KB
● Number of bits in tag = 7 bits
We have,
Block size
= 1 KB
= 210 bytes
Thus, Number of bits in block offset = 10 bits
Number of Lines in Cache-
We have,
Number of bits in physical address = 23 bits
Thus, Size of main memory
= 223 bytes
= 8 MB