Cache Memory: Replacement Policy Memory Issues Related To Cache
Cache Memory: Replacement Policy Memory Issues Related To Cache
The 4096 memory blocks can be mapped to the 128 cache blocks in three different ways:
Direct Mapping:
To avoid the search through all CM blocks needed by associative mapping, this
The first 32 consecutive MM blocks (0 through 31) are mapped to the first CM
block, the second 32 MM blocks (32 through 63) are mapped to the second
CM block, etc.
Addressing process: The 16-bit address is divided into 3 fields, the 7 MSBs
to identify the CM block, the middle 5 bits to match with the 5-bit tag of the
block, and the 4 LSBs to select the word in the block in case of a match.
The first 128 consecutive MM blocks are mapped, respectively, to the 128 CM
blocks, so that the first CM block takes one of these 32 MM blocks: 0, 128,
256, ..., 4064, the second CM block takes one of these MM blocks: 1, 129,
257, ..., 4065, etc.
Addressing process: The 16-bit address is divided into 3 fields, the 5 MSBs
to match with the 5-bit tag of the CM block identified by the middle 7 bits,
and the 4 LSBs to select the word in the block in case of a match.
Example: For the 16-bit address , the top
5 bits (10100) are to be matched with the tag of CM block 91, identified by the
next 7 bits (1011011).
Which of the two methods is better in light of the spatial locality nature of memory
usage?
Example:
Each block contains only four bytes (one word). The CM has sets each
Next: Cache Memory: Replacement Policy Up: memory Previous: Issues Related to Cache
Ruye Wang 2005-11-29