gem5  v21.1.0.2
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 namespace gem5
41 {
42 
43 class SuperBlk;
44 
52 {
53  private:
57  std::size_t _size;
58 
64 
67 
68  public:
74  enum OverwriteType : int
75  {
79  UNCHANGED = 0,
82  };
83 
85  CompressionBlk(const CompressionBlk&) = delete;
86  CompressionBlk& operator=(const CompressionBlk&) = delete;
87  CompressionBlk(CompressionBlk&&) = delete;
96  CacheBlk& operator=(CacheBlk&& other) override;
97  ~CompressionBlk() = default;
98 
104  bool isCompressed() const;
105 
109  void setCompressed();
110 
114  void setUncompressed();
115 
116  /*
117  * Get size, in bits, of this compressed block's data.
118  *
119  * @return The compressed size.
120  */
121  std::size_t getSizeBits() const;
122 
128  void setSizeBits(const std::size_t size);
129 
136 
142  void setDecompressionLatency(const Cycles lat);
143 
144  void invalidate() override;
145 
156  OverwriteType checkExpansionContraction(const std::size_t size) const;
157 
163  std::string print() const override;
164 };
165 
170 class SuperBlk : public SectorBlk
171 {
172  protected:
174  std::size_t blkSize;
175 
182 
183  public:
184  SuperBlk();
185  SuperBlk(const SuperBlk&) = delete;
186  SuperBlk& operator=(const SuperBlk&) = delete;
187  ~SuperBlk() {};
188 
196  bool isCompressed(const CompressionBlk* ignored_blk = nullptr) const;
197 
204  bool canCoAllocate(const std::size_t compressed_size) const;
205 
211  void setBlkSize(const std::size_t blk_size);
212 
225  uint8_t calculateCompressionFactor(const std::size_t size) const;
226 
232  uint8_t getCompressionFactor() const;
233 
239  void setCompressionFactor(const uint8_t compression_factor);
240 
241  void invalidate() override;
242 
243  std::string print() const override;
244 };
245 
246 } // namespace gem5
247 
248 #endif //__MEM_CACHE_TAGS_SUPER_BLK_HH__
gem5::CompressionBlk::setSizeBits
void setSizeBits(const std::size_t size)
Set size, in bits, of this compressed block's data.
Definition: super_blk.cc:99
gem5::SuperBlk::blkSize
std::size_t blkSize
Block size, in bytes.
Definition: super_blk.hh:174
gem5::SuperBlk::compressionFactor
uint8_t compressionFactor
Superblock's compression factor.
Definition: super_blk.hh:181
gem5::SectorBlk
A Basic Sector block.
Definition: sector_blk.hh:134
gem5::CompressionBlk::getSizeBits
std::size_t getSizeBits() const
Definition: super_blk.cc:93
gem5::SuperBlk::setCompressionFactor
void setCompressionFactor(const uint8_t compression_factor)
Set the compression factor of this superblock.
Definition: super_blk.cc:233
gem5::SuperBlk::getCompressionFactor
uint8_t getCompressionFactor() const
Get the compression factor of this superblock.
Definition: super_blk.cc:227
gem5::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:214
gem5::CompressionBlk::getDecompressionLatency
Cycles getDecompressionLatency() const
Get number of cycles needed to decompress this block.
Definition: super_blk.cc:129
gem5::CompressionBlk::DATA_EXPANSION
@ DATA_EXPANSION
New data contents are considered larger than previous contents.
Definition: super_blk.hh:81
gem5::CacheBlk
A Basic Cache block.
Definition: cache_blk.hh:70
gem5::Cycles
Cycles is a wrapper class for representing cycle counts, i.e.
Definition: types.hh:78
gem5::SuperBlk::SuperBlk
SuperBlk()
Definition: super_blk.cc:171
gem5::CompressionBlk::UNCHANGED
@ UNCHANGED
New and old contents are considered of similar sizes.
Definition: super_blk.hh:79
gem5::CompressionBlk::CompressionBlk
CompressionBlk()
Definition: super_blk.cc:45
gem5::SuperBlk::operator=
SuperBlk & operator=(const SuperBlk &)=delete
gem5::CompressionBlk::print
std::string print() const override
Pretty-print sector offset and other CacheBlk information.
Definition: super_blk.cc:164
gem5::SuperBlk
A basic compression superblock.
Definition: super_blk.hh:170
gem5::CompressionBlk::setUncompressed
void setUncompressed()
Clear compression bit.
Definition: super_blk.cc:87
gem5::CompressionBlk::operator=
CompressionBlk & operator=(const CompressionBlk &)=delete
gem5::CompressionBlk::_decompressionLatency
Cycles _decompressionLatency
Number of cycles needed to decompress this block.
Definition: super_blk.hh:63
sector_blk.hh
Copyright (c) 2018, 2020 Inria All rights reserved.
gem5::CompressionBlk::_compressed
bool _compressed
Compression bit.
Definition: super_blk.hh:66
gem5::CompressionBlk::invalidate
void invalidate() override
Invalidate the block and inform sector block.
Definition: super_blk.cc:141
gem5::CompressionBlk::setCompressed
void setCompressed()
Set compression bit.
Definition: super_blk.cc:81
gem5::CompressionBlk::isCompressed
bool isCompressed() const
Check if this block holds compressed data.
Definition: super_blk.cc:75
gem5::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:197
gem5::SuperBlk::~SuperBlk
~SuperBlk()
Definition: super_blk.hh:187
gem5::CompressionBlk
A superblock is composed of sub-blocks, and each sub-block has information regarding its superblock a...
Definition: super_blk.hh:51
gem5::CompressionBlk::~CompressionBlk
~CompressionBlk()=default
gem5::SectorSubBlk
A sector is composed of sub-blocks, and each sub-block has information regarding its sector and a poi...
Definition: sector_blk.hh:51
gem5::SuperBlk::print
std::string print() const override
Print relevant information for this sector block and its sub-blocks.
Definition: super_blk.cc:244
gem5::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:148
gem5::SuperBlk::setBlkSize
void setBlkSize(const std::size_t blk_size)
Set block size.
Definition: super_blk.cc:207
gem5::CompressionBlk::DATA_CONTRACTION
@ DATA_CONTRACTION
New data contents are considered smaller than previous contents.
Definition: super_blk.hh:77
gem5::SuperBlk::isCompressed
bool isCompressed(const CompressionBlk *ignored_blk=nullptr) const
Returns whether the superblock contains compressed blocks or not.
Definition: super_blk.cc:184
gem5::SuperBlk::invalidate
void invalidate() override
Invalidate the block.
Definition: super_blk.cc:177
gem5::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:74
gem5::CompressionBlk::setDecompressionLatency
void setDecompressionLatency(const Cycles lat)
Set number of cycles needed to decompress this block.
Definition: super_blk.cc:135
gem5
Reference material can be found at the JEDEC website: UFS standard http://www.jedec....
Definition: decoder.cc:40
gem5::CompressionBlk::_size
std::size_t _size
Set size, in bits, of this compressed block's data.
Definition: super_blk.hh:57

Generated on Tue Sep 21 2021 12:25:30 for gem5 by doxygen 1.8.17