mem-cache: Generate error on compression misconfiguration

Compressed caches must use the compressed tags, otherwise a
seg fault will be generated. Besides, if no compressor is
assigned; yet compressed tags are used, data is not compressed.

Generate an error for the first case, and a warning for the
second.

Change-Id: Iac5474ed919163ce38a8c4e8efd9727e5b3d8417
Signed-off-by: Daniel R. Carvalho <odanrc@yahoo.com.br>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/38635
Reviewed-by: Nikos Nikoleris <nikos.nikoleris@arm.com>
Maintainer: Nikos Nikoleris <nikos.nikoleris@arm.com>
Tested-by: kokoro <noreply+kokoro@google.com>
This commit is contained in:
Daniel R. Carvalho
2020-12-20 22:15:23 -03:00
committed by Daniel Carvalho
parent 0badfdb207
commit 4dc09a9543

View File

@@ -56,6 +56,7 @@
#include "mem/cache/mshr.hh"
#include "mem/cache/prefetch/base.hh"
#include "mem/cache/queue_entry.hh"
#include "mem/cache/tags/compressed_tags.hh"
#include "mem/cache/tags/super_blk.hh"
#include "params/BaseCache.hh"
#include "params/WriteAllocator.hh"
@@ -123,6 +124,12 @@ BaseCache::BaseCache(const BaseCacheParams &p, unsigned blk_size)
tags->tagsInit();
if (prefetcher)
prefetcher->setCache(this);
fatal_if(compressor && !dynamic_cast<CompressedTags*>(tags),
"The tags of compressed cache %s must derive from CompressedTags",
name());
warn_if(!compressor && dynamic_cast<CompressedTags*>(tags),
"Compressed cache %s does not have a compression algorithm", name());
if (compressor)
compressor->setCache(this);
}