diff options
author | bd <bdunahu@operationnull.com> | 2025-03-21 01:06:38 -0400 |
---|---|---|
committer | bd <bdunahu@operationnull.com> | 2025-03-21 01:06:38 -0400 |
commit | 4d1378e802d869271729bc3da1cbc362e8761a22 (patch) | |
tree | 3bf1411babb1511e6ad10ed7cdeaba576d8c4731 /src | |
parent | 5845ad71d78d310322046906ee4c8e91d007d57e (diff) |
Rewrite current cache.cc tests, add test-helper function to dram
Diffstat (limited to 'src')
-rw-r--r-- | src/storage/cache.cc | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/storage/cache.cc b/src/storage/cache.cc index 3e2a5e0..f15c919 100644 --- a/src/storage/cache.cc +++ b/src/storage/cache.cc @@ -34,7 +34,7 @@ Response Cache::write_word(Accessor accessor, signed int data, int address) this->requester = accessor; if (this->requester == accessor) { - fetch_resource(address); + handle_miss(address); if (this->is_waiting) r = BLOCKED; else if (this->wait_time == 0) { @@ -59,7 +59,7 @@ Response Cache::write_line( this->requester = accessor; if (this->requester == accessor) { - fetch_resource(address); + handle_miss(address); if (this->is_waiting) r = BLOCKED; else if (this->wait_time == 0) { @@ -84,7 +84,7 @@ Response Cache::read_line( if (this->requester == IDLE) this->requester = accessor; if (this->requester == accessor) { - fetch_resource(address); + handle_miss(address); if (this->is_waiting) r = BLOCKED; else if (this->wait_time == 0) { @@ -103,7 +103,7 @@ Response Cache::read_word(Accessor accessor, int address, signed int &data) if (this->requester == IDLE) this->requester = accessor; if (this->requester == accessor) { - fetch_resource(address); + handle_miss(address); if (this->is_waiting) r = BLOCKED; else if (this->wait_time == 0) { @@ -116,15 +116,15 @@ Response Cache::read_word(Accessor accessor, int address, signed int &data) return r; } -void Cache::fetch_resource(int expected) +void Cache::handle_miss(int expected) { - Response r = OK; - Response q; + Response r, q; int tag, index, offset; std::array<signed int, LINE_SIZE> *actual; std::array<int, 2> *meta; get_bit_fields(expected, &tag, &index, &offset); + r = OK; meta = &this->meta.at(index); actual = &this->data->at(index); |