gem5  v21.0.1.0
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
super_blk.hh
Go to the documentation of this file.
1 
35 #ifndef __MEM_CACHE_TAGS_SUPER_BLK_HH__
36 #define __MEM_CACHE_TAGS_SUPER_BLK_HH__
37 
39 
40 class SuperBlk;
41 
49 {
50  private:
54  std::size_t _size;
55 
61 
64 
65  public:
71  enum OverwriteType : int
72  {
76  UNCHANGED = 0,
79  };
80 
82  CompressionBlk(const CompressionBlk&) = delete;
83  CompressionBlk& operator=(const CompressionBlk&) = delete;
84  CompressionBlk(CompressionBlk&&) = delete;
93  CacheBlk& operator=(CacheBlk&& other) override;
94  ~CompressionBlk() = default;
95 
101  bool isCompressed() const;
102 
106  void setCompressed();
107 
111  void setUncompressed();
112 
113  /*
114  * Get size, in bits, of this compressed block's data.
115  *
116  * @return The compressed size.
117  */
118  std::size_t getSizeBits() const;
119 
125  void setSizeBits(const std::size_t size);
126 
133 
139  void setDecompressionLatency(const Cycles lat);
140 
141  void invalidate() override;
142 
153  OverwriteType checkExpansionContraction(const std::size_t size) const;
154 
160  std::string print() const override;
161 };
162 
167 class SuperBlk : public SectorBlk
168 {
169  protected:
171  std::size_t blkSize;
172 
179 
180  public:
181  SuperBlk();
182  SuperBlk(const SuperBlk&) = delete;
183  SuperBlk& operator=(const SuperBlk&) = delete;
184  ~SuperBlk() {};
185 
193  bool isCompressed(const CompressionBlk* ignored_blk = nullptr) const;
194 
201  bool canCoAllocate(const std::size_t compressed_size) const;
202 
208  void setBlkSize(const std::size_t blk_size);
209 
222  uint8_t calculateCompressionFactor(const std::size_t size) const;
223 
229  uint8_t getCompressionFactor() const;
230 
236  void setCompressionFactor(const uint8_t compression_factor);
237 
238  void invalidate() override;
239 
240  std::string print() const override;
241 };
242 
243 #endif //__MEM_CACHE_TAGS_SUPER_BLK_HH__
CompressionBlk::checkExpansionContraction
OverwriteType checkExpansionContraction(const std::size_t size) const
Determines if changing the size of the block will cause a data expansion (new size is bigger) or cont...
Definition: super_blk.cc:145
CompressionBlk::operator=
CompressionBlk & operator=(const CompressionBlk &)=delete
SuperBlk::canCoAllocate
bool canCoAllocate(const std::size_t compressed_size) const
Checks whether a superblock can co-allocate given compressed data block.
Definition: super_blk.cc:194
CompressionBlk::invalidate
void invalidate() override
Invalidate the block and inform sector block.
Definition: super_blk.cc:138
CompressionBlk::~CompressionBlk
~CompressionBlk()=default
SuperBlk::setCompressionFactor
void setCompressionFactor(const uint8_t compression_factor)
Set the compression factor of this superblock.
Definition: super_blk.cc:230
CompressionBlk::DATA_EXPANSION
@ DATA_EXPANSION
New data contents are considered larger than previous contents.
Definition: super_blk.hh:78
CompressionBlk::_size
std::size_t _size
Set size, in bits, of this compressed block's data.
Definition: super_blk.hh:54
CompressionBlk::UNCHANGED
@ UNCHANGED
New and old contents are considered of similar sizes.
Definition: super_blk.hh:76
SuperBlk::invalidate
void invalidate() override
Invalidate the block.
Definition: super_blk.cc:174
CompressionBlk::getSizeBits
std::size_t getSizeBits() const
Definition: super_blk.cc:90
SuperBlk::blkSize
std::size_t blkSize
Block size, in bytes.
Definition: super_blk.hh:171
CompressionBlk::_compressed
bool _compressed
Compression bit.
Definition: super_blk.hh:63
sector_blk.hh
Copyright (c) 2018, 2020 Inria All rights reserved.
CompressionBlk::getDecompressionLatency
Cycles getDecompressionLatency() const
Get number of cycles needed to decompress this block.
Definition: super_blk.cc:126
SuperBlk::setBlkSize
void setBlkSize(const std::size_t blk_size)
Set block size.
Definition: super_blk.cc:204
CompressionBlk::isCompressed
bool isCompressed() const
Check if this block holds compressed data.
Definition: super_blk.cc:72
SuperBlk::SuperBlk
SuperBlk()
Definition: super_blk.cc:168
CompressionBlk::setDecompressionLatency
void setDecompressionLatency(const Cycles lat)
Set number of cycles needed to decompress this block.
Definition: super_blk.cc:132
CompressionBlk::_decompressionLatency
Cycles _decompressionLatency
Number of cycles needed to decompress this block.
Definition: super_blk.hh:60
SuperBlk::getCompressionFactor
uint8_t getCompressionFactor() const
Get the compression factor of this superblock.
Definition: super_blk.cc:224
CompressionBlk::setCompressed
void setCompressed()
Set compression bit.
Definition: super_blk.cc:78
CompressionBlk::setUncompressed
void setUncompressed()
Clear compression bit.
Definition: super_blk.cc:84
SuperBlk
A basic compression superblock.
Definition: super_blk.hh:167
CompressionBlk::setSizeBits
void setSizeBits(const std::size_t size)
Set size, in bits, of this compressed block's data.
Definition: super_blk.cc:96
CacheBlk
A Basic Cache block.
Definition: cache_blk.hh:67
SuperBlk::isCompressed
bool isCompressed(const CompressionBlk *ignored_blk=nullptr) const
Returns whether the superblock contains compressed blocks or not.
Definition: super_blk.cc:181
SuperBlk::calculateCompressionFactor
uint8_t calculateCompressionFactor(const std::size_t size) const
Calculate the compression factor (cf) given a compressed size and the maximum compression ratio.
Definition: super_blk.cc:211
CompressionBlk::OverwriteType
OverwriteType
When an overwrite happens, the data size may change an not fit in its current container any longer.
Definition: super_blk.hh:71
SuperBlk::operator=
SuperBlk & operator=(const SuperBlk &)=delete
SuperBlk::compressionFactor
uint8_t compressionFactor
Superblock's compression factor.
Definition: super_blk.hh:178
Cycles
Cycles is a wrapper class for representing cycle counts, i.e.
Definition: types.hh:79
SectorSubBlk
A sector is composed of sub-blocks, and each sub-block has information regarding its sector and a poi...
Definition: sector_blk.hh:48
CompressionBlk::CompressionBlk
CompressionBlk()
Definition: super_blk.cc:42
SuperBlk::~SuperBlk
~SuperBlk()
Definition: super_blk.hh:184
SectorBlk
A Basic Sector block.
Definition: sector_blk.hh:131
SuperBlk::print
std::string print() const override
Print relevant information for this sector block and its sub-blocks.
Definition: super_blk.cc:241
CompressionBlk
A superblock is composed of sub-blocks, and each sub-block has information regarding its superblock a...
Definition: super_blk.hh:48
CompressionBlk::DATA_CONTRACTION
@ DATA_CONTRACTION
New data contents are considered smaller than previous contents.
Definition: super_blk.hh:74
CompressionBlk::print
std::string print() const override
Pretty-print sector offset and other CacheBlk information.
Definition: super_blk.cc:161

Generated on Tue Jun 22 2021 15:28:29 for gem5 by doxygen 1.8.17