Commit 40ce39a
committed
Switch victim cache from FIFO to LRU
The previous victim cache implementation used a simple FIFO
replacement policy, which is often suboptimal for cache performance.
This commit implements an LRU (Least Recently Used) replacement policy
to improve cache hit rates:
- On a cache miss requiring eviction, the block with the oldest
timestamp (minimum instret value) is now selected for replacement.
- Timestamps are updated both on victim cache hits and when a block
is newly evicted from the icache into the victim cache.1 parent 8bfe59c commit 40ce39a
2 files changed
+12
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
410 | 410 | | |
411 | 411 | | |
412 | 412 | | |
| 413 | + | |
413 | 414 | | |
414 | 415 | | |
415 | 416 | | |
| |||
450 | 451 | | |
451 | 452 | | |
452 | 453 | | |
453 | | - | |
| 454 | + | |
| 455 | + | |
| 456 | + | |
| 457 | + | |
| 458 | + | |
| 459 | + | |
| 460 | + | |
| 461 | + | |
| 462 | + | |
454 | 463 | | |
455 | 464 | | |
456 | 465 | | |
457 | | - | |
| 466 | + | |
458 | 467 | | |
459 | 468 | | |
460 | 469 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
127 | 127 | | |
128 | 128 | | |
129 | 129 | | |
130 | | - | |
| 130 | + | |
131 | 131 | | |
132 | 132 | | |
133 | 133 | | |
| |||
0 commit comments