summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices/cpu
diff options
context:
space:
mode:
author Jesus Ramos <jesus-ramos@live.com>2026-03-14 13:59:00 -0700
committer GitHub <noreply@github.com>2026-03-14 22:59:00 +0200
commitf808f9a7f8fa1d13ad9f7aa372d89d33bd57ff50 (patch)
tree78bf021bfd5f97002da45b4cb21ecd7815633579 /src/devices/cpu
parent5fa89c9f0c48fad11c07483488daf3c1ab802d04 (diff)
sh/sh7709s.cpp: Fix LRU cache replacement updates (#15098)
Only update LRU values greater than the current LRU value on cache hit
Diffstat (limited to 'src/devices/cpu')
-rw-r--r--src/devices/cpu/sh/sh7709s.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/devices/cpu/sh/sh7709s.cpp b/src/devices/cpu/sh/sh7709s.cpp
index 36ae47039c4..746b10c68e4 100644
--- a/src/devices/cpu/sh/sh7709s.cpp
+++ b/src/devices/cpu/sh/sh7709s.cpp
@@ -96,13 +96,13 @@ bool sh7709s_device::cache_access(uint32_t address, bool write)
// If the entry is already the latest in the LRU no need to update anything else
if (entry->lru != SH7709S_CACHE_ASSOCIATIVITY - 1)
{
- entry->lru = SH7709S_CACHE_ASSOCIATIVITY - 1;
for (int j = 0; j < SH7709S_CACHE_ASSOCIATIVITY; j++)
{
struct sh7709s_cache_entry* update_entry = &m_cache[cache_block][j];
- if (i != j && update_entry->lru != 0)
+ if (update_entry->lru > entry->lru)
update_entry->lru--;
}
+ entry->lru = SH7709S_CACHE_ASSOCIATIVITY - 1;
}
return true;
}