Skip to content

Commit

Permalink
Fix flash cache misses by setting the new cache line as most-recently…
Browse files Browse the repository at this point in the history
…-used
  • Loading branch information
calc84maniac authored May 29, 2024
1 parent 070d395 commit e41144d
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion core/flash.c
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,8 @@ uint32_t flash_touch_cache(uint32_t addr) {
return 3;
} else {
/* Handle a cache miss by replacing least-recently-used */
set->lru = tag;
set->lru = set->mru;
set->mru = tag;
cpu.flashCacheMisses++;
/* Supposedly this takes from 195-201 cycles, but typically seems to be 196-197 */
cpu.flashDelayCycles += 195;
Expand Down

0 comments on commit e41144d

Please sign in to comment.