diff options
author | Pavel Pisa <pisa@cmp.felk.cvut.cz> | 2019-02-07 21:05:44 +0100 |
---|---|---|
committer | Pavel Pisa <pisa@cmp.felk.cvut.cz> | 2019-02-07 21:05:44 +0100 |
commit | a0bc62d72314aa1c1946f0b1affe5bbe0dc64274 (patch) | |
tree | b7ba07aec406ae57db6bb945acc47b78edb7648a /qtmips_machine | |
parent | 48c0b3ffcaef15aeac7b239e769bcc795b943bec (diff) | |
download | qtmips-a0bc62d72314aa1c1946f0b1affe5bbe0dc64274.tar.gz qtmips-a0bc62d72314aa1c1946f0b1affe5bbe0dc64274.tar.bz2 qtmips-a0bc62d72314aa1c1946f0b1affe5bbe0dc64274.zip |
Correct cache LocationStatus when cache is disabled.
Signed-off-by: Pavel Pisa <pisa@cmp.felk.cvut.cz>
Diffstat (limited to 'qtmips_machine')
-rw-r--r-- | qtmips_machine/cache.cpp | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/qtmips_machine/cache.cpp b/qtmips_machine/cache.cpp index e327d7b..8767ee1 100644 --- a/qtmips_machine/cache.cpp +++ b/qtmips_machine/cache.cpp @@ -225,13 +225,15 @@ enum LocationStatus Cache::location_status(std::uint32_t address) const { std::uint32_t index = address % ssize; std::uint32_t row = index / cnf.blocks(); - for (unsigned indx = 0; indx < cnf.associativity(); indx++) { - if (dt[indx][row].valid && dt[indx][row].tag == tag) { - if (dt[indx][row].dirty && - cnf.write_policy() == MachineConfigCache::WP_BACK) - return (enum LocationStatus)(LOCSTAT_CACHED | LOCSTAT_DIRTY); - else - return (enum LocationStatus)LOCSTAT_CACHED; + if (cnf.enabled()) { + for (unsigned indx = 0; indx < cnf.associativity(); indx++) { + if (dt[indx][row].valid && dt[indx][row].tag == tag) { + if (dt[indx][row].dirty && + cnf.write_policy() == MachineConfigCache::WP_BACK) + return (enum LocationStatus)(LOCSTAT_CACHED | LOCSTAT_DIRTY); + else + return (enum LocationStatus)LOCSTAT_CACHED; + } } } return mem->location_status(address); |