From 4dc09a9543e8be0a70be7b42b8521509700752a4 Mon Sep 17 00:00:00 2001 From: "Daniel R. Carvalho" Date: Sun, 20 Dec 2020 22:15:23 -0300 Subject: [PATCH] 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 --- src/mem/cache/base.cc | 7 +++++++ 1 file changed, 7 insertions(+) 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); } -- 2.30.2