diff options
author | Pavel Pisa <pisa@cmp.felk.cvut.cz> | 2019-02-04 10:30:00 +0100 |
---|---|---|
committer | Pavel Pisa <pisa@cmp.felk.cvut.cz> | 2019-02-04 10:30:00 +0100 |
commit | e6bb3b28987b7c521a4a8b35342f71a147b55fec (patch) | |
tree | 1c7926e339cd9daa683ab0c3e247d22c6a0c204f /qtmips_machine | |
parent | 361f5aab10d72e2200dfc7985a1511044b987db8 (diff) | |
download | qtmips-e6bb3b28987b7c521a4a8b35342f71a147b55fec.tar.gz qtmips-e6bb3b28987b7c521a4a8b35342f71a147b55fec.tar.bz2 qtmips-e6bb3b28987b7c521a4a8b35342f71a147b55fec.zip |
Correct write-back cache behavior.
Signed-off-by: Pavel Pisa <pisa@cmp.felk.cvut.cz>
Diffstat (limited to 'qtmips_machine')
-rw-r--r-- | qtmips_machine/cache.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/qtmips_machine/cache.cpp b/qtmips_machine/cache.cpp index 9f4bfb0..f724561 100644 --- a/qtmips_machine/cache.cpp +++ b/qtmips_machine/cache.cpp @@ -216,7 +216,7 @@ bool Cache::access(std::uint32_t address, std::uint32_t *data, bool write, std:: } cd.valid = true; // We either write to it or we read from memory. Either way it's valid when we leave Cache class - cd.dirty = cd.dirty || !write; + cd.dirty = cd.dirty || write; cd.tag = tag; *data = cd.data[col]; @@ -233,7 +233,7 @@ void Cache::kick(unsigned associat_indx, unsigned row) const { struct cache_data &cd = dt[associat_indx][row]; if (cd.dirty && cnf.write_policy() == MachineConfigCache::WP_BACK) for (unsigned i = 0; i < cnf.blocks(); i++) - mem->wword(base_address(associat_indx, row) + (4*i), cd.data[i]); + mem->wword(base_address(cd.tag, row) + (4*i), cd.data[i]); cd.valid = false; cd.dirty = false; |