Cache Mapping
- While with logical operators, it is possible to check if a value exists or not, if a block can be anywhere, we need to search everywhere.
- Where is the block we are looking for?
- Fully Associative Mapping
- Any block from memory can be put in any cache block (i.e., no restriction)
- ,
- Byte offset bits bits where is the block size
- No set index because there is one set.
- Most flexible (fewer evictions)
- Longest search time
- Direct Mapping
- Each block from memory can only be put in one location
- ,
- Each set has one block.
- Least flexible (more evictions)
- Shortest search time
- K-Way Set-Associative Mapping
- Given S sets, block of main memory maps to set
- Within the set, the block can be put anywhere.
- Byte offset bits bits where is the block size
- Set bits bits where is the number of cache sets
- Tag bits = remaining bits
- Compromised
- 1-way set associative = Direct
- N-way set associative = Fully Associative
- Search Time is
- For small Parallel Search with Hardware Optimization: