From 28d8594435d0a52b257ceba768ce75f1449d6a1e Mon Sep 17 00:00:00 2001 From: "Daniel R. Carvalho" Date: Tue, 6 Oct 2020 12:52:03 +0200 Subject: [PATCH] mem-cache: Isolate compression bit The compression bit does not belong with the coherence bits. Change-Id: I6e9f201a9961b8c6051ba599f051a444d585f0e4 Signed-off-by: Daniel R. Carvalho Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/35700 Reviewed-by: Jason Lowe-Power Reviewed-by: Nikos Nikoleris Maintainer: Nikos Nikoleris Tested-by: kokoro --- src/mem/cache/cache_blk.hh | 6 ++---- src/mem/cache/tags/super_blk.cc | 15 +++++++++++---- src/mem/cache/tags/super_blk.hh | 5 +++++ 3 files changed, 18 insertions(+), 8 deletions(-) diff --git a/src/mem/cache/cache_blk.hh b/src/mem/cache/cache_blk.hh index 4483fb134..bf9bfe6b8 100644 --- a/src/mem/cache/cache_blk.hh +++ b/src/mem/cache/cache_blk.hh @@ -69,14 +69,12 @@ enum CacheBlkStatusBits : unsigned { BlkReadable = 0x04, /** dirty (modified) */ BlkDirty = 0x08, - /** block holds compressed data */ - BlkCompressed = 0x80 }; /** * A Basic Cache block. - * Contains information regarding its coherence, prefetching and compression - * status, as well as a pointer to its data. + * Contains information regarding its coherence, prefetching status, as + * well as a pointer to its data. */ class CacheBlk : public TaggedEntry { diff --git a/src/mem/cache/tags/super_blk.cc b/src/mem/cache/tags/super_blk.cc index 982d9b095..0f570f947 100644 --- a/src/mem/cache/tags/super_blk.cc +++ b/src/mem/cache/tags/super_blk.cc @@ -37,26 +37,26 @@ #include "base/logging.hh" CompressionBlk::CompressionBlk() - : SectorSubBlk(), _size(0), _decompressionLatency(0) + : SectorSubBlk(), _size(0), _decompressionLatency(0), _compressed(false) { } bool CompressionBlk::isCompressed() const { - return (status & BlkCompressed) != 0; + return _compressed; } void CompressionBlk::setCompressed() { - status |= BlkCompressed; + _compressed = true; } void CompressionBlk::setUncompressed() { - status &= ~BlkCompressed; + _compressed = false; } std::size_t @@ -83,6 +83,13 @@ CompressionBlk::setDecompressionLatency(const Cycles lat) _decompressionLatency = lat; } +void +CompressionBlk::invalidate() +{ + SectorSubBlk::invalidate(); + setUncompressed(); +} + std::string CompressionBlk::print() const { diff --git a/src/mem/cache/tags/super_blk.hh b/src/mem/cache/tags/super_blk.hh index a1c3ff4f2..bca32662f 100644 --- a/src/mem/cache/tags/super_blk.hh +++ b/src/mem/cache/tags/super_blk.hh @@ -59,6 +59,9 @@ class CompressionBlk : public SectorSubBlk */ Cycles _decompressionLatency; + /** Compression bit. */ + bool _compressed; + public: CompressionBlk(); CompressionBlk(const CompressionBlk&) = delete; @@ -110,6 +113,8 @@ class CompressionBlk : public SectorSubBlk */ void setDecompressionLatency(const Cycles lat); + void invalidate() override; + /** * Pretty-print sector offset and other CacheBlk information. * -- 2.30.2