To check if the cache holds the contents of an address, the address is partitioned into three parts.
For example, for a direct mapped cache with 512 sets and a block size of 32 bytes and 32 bit addresses, the cache data capacity is 512 * 1 * 32 = 4096 = 4K bytes and
Parameter | Size | Number of address bits |
S | 512 | 9 |
B | 32 | 5 |
Tag | - | 18 |
The address is partioned into
Tag | Set | Block Offset |
---|---|---|
bits 31 - 14 | bits 13 - 5 | bits 4 - 0 |