From: Daniel R. Carvalho Date: Tue, 6 Oct 2020 10:52:03 +0000 (+0200) Subject: mem-cache: Isolate compression bit X-Git-Tag: develop-gem5-snapshot~668 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=28d8594435d0a52b257ceba768ce75f1449d6a1e;p=gem5.git 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 --- 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. *