From: Daniel R. Carvalho Date: Mon, 21 Dec 2020 01:15:23 +0000 (-0300) Subject: mem-cache: Generate error on compression misconfiguration X-Git-Tag: develop-gem5-snapshot~332 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=4dc09a9543e8be0a70be7b42b8521509700752a4;p=gem5.git 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 Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/38635 Reviewed-by: Nikos Nikoleris Maintainer: Nikos Nikoleris Tested-by: kokoro --- diff --git a/src/mem/cache/base.cc b/src/mem/cache/base.cc index 5fc345664..3181a0c1b 100644 --- a/src/mem/cache/base.cc +++ b/src/mem/cache/base.cc @@ -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(tags), + "The tags of compressed cache %s must derive from CompressedTags", + name()); + warn_if(!compressor && dynamic_cast(tags), + "Compressed cache %s does not have a compression algorithm", name()); if (compressor) compressor->setCache(this); }