diff options
author | bd <bdunahu@operationnull.com> | 2025-04-16 15:06:04 -0400 |
---|---|---|
committer | bd <bdunahu@operationnull.com> | 2025-04-16 15:06:04 -0400 |
commit | 0041cc424b5711559302bd77a534922a9dbca8ae (patch) | |
tree | 86336777ef72cedf7a0185c36501979b2eaff848 /src/cache.cc | |
parent | 7a94defa477d5dd0a5f7c77a7c64d46aa4266e6a (diff) |
Use signed integers for cache eviction
Diffstat (limited to 'src/cache.cc')
-rw-r--r-- | src/cache.cc | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/cache.cc b/src/cache.cc index 7092bc5..a2d4525 100644 --- a/src/cache.cc +++ b/src/cache.cc @@ -76,7 +76,7 @@ Cache::process(void *id, int address, std::function<void(int index, int offset)> int Cache::priming_address(int address) { - unsigned int tag, index, offset; + int tag, index, offset; int r1, r2; std::array<signed int, LINE_SIZE> *evict; std::array<int, 3> *meta; @@ -109,8 +109,8 @@ Cache::priming_address(int address) return r1; } -unsigned int -Cache::is_address_missing(unsigned int index, unsigned int tag) +int +Cache::is_address_missing(int index, int tag) { int i; @@ -120,14 +120,14 @@ Cache::is_address_missing(unsigned int index, unsigned int tag) return -1; } -unsigned int -Cache::get_true_index(unsigned int index) +int +Cache::get_true_index(int index) { return index * (1 << this->ways); } -unsigned int -Cache::get_replacement_index(unsigned int index) +int +Cache::get_replacement_index(int index) { return index + (rand() % (1 << this->ways)); } |