diff options
author | bd <bdunahu@operationnull.com> | 2025-03-11 20:26:59 -0400 |
---|---|---|
committer | bd <bdunahu@operationnull.com> | 2025-03-11 20:26:59 -0400 |
commit | 7c828204a091330eca7dd6495f02f54c2c0a3091 (patch) | |
tree | 30947c7018653ca18d4a69de20936b3615768f9e /src/storage/cache.cc | |
parent | 1f0e8cb4ab77c0db6d0ec08cb3a09219ccb04e90 (diff) |
Fix small issue in fetch_resource wih off by one cycle count
Diffstat (limited to 'src/storage/cache.cc')
-rw-r--r-- | src/storage/cache.cc | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/storage/cache.cc b/src/storage/cache.cc index 4842ed5..3e2a5e0 100644 --- a/src/storage/cache.cc +++ b/src/storage/cache.cc @@ -119,6 +119,7 @@ Response Cache::read_word(Accessor accessor, int address, signed int &data) void Cache::fetch_resource(int expected) { Response r = OK; + Response q; int tag, index, offset; std::array<signed int, LINE_SIZE> *actual; std::array<int, 2> *meta; @@ -128,21 +129,21 @@ void Cache::fetch_resource(int expected) actual = &this->data->at(index); if (meta->at(0) != tag) { + r = WAIT; // address not in cache if (meta->at(1) >= 0) { // occupant is dirty // writing line to DRam in case of dirty cache eviction - r = this->lower->write_line( + q = this->lower->write_line( L1CACHE, *actual, ((index << LINE_SPEC) + (meta->at(0) << (L1_CACHE_LINE_SPEC + LINE_SPEC)))); - if (r == OK) { + if (q == OK) { meta->at(1) = -1; - r = WAIT; } } else { - r = this->lower->read_line(L1CACHE, expected, *actual); - if (r == OK) { + q = this->lower->read_line(L1CACHE, expected, *actual); + if (q == OK) { meta->at(0) = tag; } } |