mem-cache: Isolate compression bit
authorDaniel R. Carvalho <odanrc@yahoo.com.br>
Tue, 6 Oct 2020 10:52:03 +0000 (12:52 +0200)
committerDaniel Carvalho <odanrc@yahoo.com.br>
Thu, 8 Oct 2020 18:32:00 +0000 (18:32 +0000)
The compression bit does not belong with the coherence bits.

Change-Id: I6e9f201a9961b8c6051ba599f051a444d585f0e4
Signed-off-by: Daniel R. Carvalho <odanrc@yahoo.com.br>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/35700
Reviewed-by: Jason Lowe-Power <power.jg@gmail.com>
Reviewed-by: Nikos Nikoleris <nikos.nikoleris@arm.com>
Maintainer: Nikos Nikoleris <nikos.nikoleris@arm.com>
Tested-by: kokoro <noreply+kokoro@google.com>
src/mem/cache/cache_blk.hh
src/mem/cache/tags/super_blk.cc
src/mem/cache/tags/super_blk.hh

index 4483fb134e40fdaf6ca84b22c31f4ffad790df69..bf9bfe6b8fb13edc662e1e7443d50a96b97fc377 100644 (file)
@@ -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
 {
index 982d9b095f983a07849236cb0b9c6e951bb04803..0f570f947923f072c69a062a83d41457700504f8 100644 (file)
 #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
 {
index a1c3ff4f229e8d075ca74c8533b7edc3dffdb430..bca32662fc6966bc52fe368703e998205afb40c9 100644 (file)
@@ -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.
      *