diff options
-rw-r--r-- | inc/cache.h | 6 | ||||
-rw-r--r-- | src/cache.cc | 14 |
2 files changed, 10 insertions, 10 deletions
diff --git a/inc/cache.h b/inc/cache.h index 4b2521a..8075d1a 100644 --- a/inc/cache.h +++ b/inc/cache.h @@ -64,7 +64,7 @@ nn * Constructor. * @return -1 if the tag is not present in this set of ways (not in cache), or the true index if * the tag is present. */ - unsigned int is_address_missing(unsigned int true_index, unsigned int tag); + int is_address_missing(int true_index, int tag); /** * Converts an index into a set of ways into an index into `this->data', which is a * 1D array. The next `this->ways' entries after the returned index represent the ways in the @@ -72,14 +72,14 @@ nn * Constructor. * @param an index to a set of ways * @param an index aligned to the set of ways in `this->data' */ - unsigned int get_true_index(unsigned int index); + int get_true_index(int index); /** * Selects an index into the `data' and `meta' tables for write back using a random replacement * policy. * @param an index aligned to the set of ways in `this->data' * @return an index aligned to the data line selected for eviction */ - unsigned int get_replacement_index(unsigned int index); + int get_replacement_index(int index); /** * The number of bits required to specify a line in this level of cache. */ 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)); } |