diff options
Diffstat (limited to 'src/mem/cache/base.cc')
-rw-r--r-- | src/mem/cache/base.cc | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/src/mem/cache/base.cc b/src/mem/cache/base.cc index ba981b606..62f1bb21b 100644 --- a/src/mem/cache/base.cc +++ b/src/mem/cache/base.cc @@ -773,13 +773,19 @@ BaseCache::drain(DrainManager *dm) BaseCache * BaseCacheParams::create() { - int numSets = size / (assoc * block_size); - - if (numSets == 1) { - FALRU *tags = new FALRU(block_size, size, hit_latency); - return new Cache<FALRU>(this, tags); + unsigned numSets = size / (assoc * block_size); + + assert(tags); + + if (dynamic_cast<FALRU*>(tags)) { + if (numSets != 1) + fatal("Got FALRU tags with more than one set\n"); + return new Cache<FALRU>(this); + } else if (dynamic_cast<LRU*>(tags)) { + if (numSets == 1) + warn("Consider using FALRU tags for a fully associative cache\n"); + return new Cache<LRU>(this); } else { - LRU *tags = new LRU(numSets, block_size, assoc, hit_latency); - return new Cache<LRU>(this, tags); + fatal("No suitable tags selected\n"); } } |