diff options
author | bd <bdunahu@operationnull.com> | 2025-04-14 23:10:18 -0400 |
---|---|---|
committer | bd <bdunahu@operationnull.com> | 2025-04-14 23:10:18 -0400 |
commit | 661ba30d5233e1b95ac312e88cd51380e664933b (patch) | |
tree | bc9bba3e3e87025eebf86e6b5013485088cf0ccf /src/cache.cc | |
parent | 432e6f63ab4742ebf34ba7d031e269af810aa93f (diff) |
Initial refactor of is_access_cleared
Diffstat (limited to 'src/cache.cc')
-rw-r--r-- | src/cache.cc | 31 |
1 files changed, 10 insertions, 21 deletions
diff --git a/src/cache.cc b/src/cache.cc index 307d6d0..44a770d 100644 --- a/src/cache.cc +++ b/src/cache.cc @@ -59,35 +59,24 @@ int Cache::process(void *id, int address, std::function<void(int index, int offset)> request_handler) { int r; - r = this->is_access_cleared(id, address); - if (r) { - int tag, index, offset; - GET_FIELDS(address, &tag, &index, &offset); - request_handler(index, offset); - } - return r; -} -int -Cache::is_access_cleared(void *id, int address) -{ - /* Do this first--then process the first cycle immediately. */ + r = 0; if (id == nullptr) throw std::invalid_argument("Accessor cannot be nullptr."); if (this->current_request == nullptr) this->current_request = id; if (this->current_request == id) { if (is_address_missing(address)) - return 0; - else if (this->wait_time == 0) { - this->current_request = nullptr; - this->wait_time = delay; - return 1; - } else { - --this->wait_time; - } + r = 0; + else + r = this->is_access_cleared(); } - return 0; + if (r) { + int tag, index, offset; + GET_FIELDS(address, &tag, &index, &offset); + request_handler(index, offset); + } + return r; } int |