gem5 v24.0.0.0
Loading...
Searching...
No Matches
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
40namespace gem5
41{
42
43class SuperBlk;
44
52{
53 private:
57 std::size_t _size;
58
64
67
68 public:
74 enum OverwriteType : int
75 {
82 };
83
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
170class 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;
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__
A Basic Cache block.
Definition cache_blk.hh:72
A superblock is composed of sub-blocks, and each sub-block has information regarding its superblock a...
Definition super_blk.hh:52
CompressionBlk(const CompressionBlk &)=delete
CompressionBlk & operator=(const CompressionBlk &)=delete
void setCompressed()
Set compression bit.
Definition super_blk.cc:81
std::string print() const override
Pretty-print sector offset and other CacheBlk information.
Definition super_blk.cc:164
std::size_t getSizeBits() const
Definition super_blk.cc:93
void setUncompressed()
Clear compression bit.
Definition super_blk.cc:87
void setSizeBits(const std::size_t size)
Set size, in bits, of this compressed block's data.
Definition super_blk.cc:99
bool isCompressed() const
Check if this block holds compressed data.
Definition super_blk.cc:75
Cycles _decompressionLatency
Number of cycles needed to decompress this block.
Definition super_blk.hh:63
std::size_t _size
Set size, in bits, of this compressed block's data.
Definition super_blk.hh:57
void setDecompressionLatency(const Cycles lat)
Set number of cycles needed to decompress this block.
Definition super_blk.cc:135
OverwriteType
When an overwrite happens, the data size may change an not fit in its current container any longer.
Definition super_blk.hh:75
@ UNCHANGED
New and old contents are considered of similar sizes.
Definition super_blk.hh:79
@ DATA_EXPANSION
New data contents are considered larger than previous contents.
Definition super_blk.hh:81
@ DATA_CONTRACTION
New data contents are considered smaller than previous contents.
Definition super_blk.hh:77
Cycles getDecompressionLatency() const
Get number of cycles needed to decompress this block.
Definition super_blk.cc:129
~CompressionBlk()=default
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
CompressionBlk(CompressionBlk &&)=delete
void invalidate() override
Invalidate the block and clear all state.
Definition super_blk.cc:141
bool _compressed
Compression bit.
Definition super_blk.hh:66
Cycles is a wrapper class for representing cycle counts, i.e.
Definition types.hh:79
A Basic Sector block.
A sector is composed of sub-blocks, and each sub-block has information regarding its sector and a poi...
Definition sector_blk.hh:52
A basic compression superblock.
Definition super_blk.hh:171
std::size_t blkSize
Block size, in bytes.
Definition super_blk.hh:174
std::string print() const override
Print relevant information for this sector block and its sub-blocks.
Definition super_blk.cc:244
SuperBlk(const SuperBlk &)=delete
void setCompressionFactor(const uint8_t compression_factor)
Set the compression factor of this superblock.
Definition super_blk.cc:233
bool isCompressed(const CompressionBlk *ignored_blk=nullptr) const
Returns whether the superblock contains compressed blocks or not.
Definition super_blk.cc:184
void setBlkSize(const std::size_t blk_size)
Set block size.
Definition super_blk.cc:207
void invalidate() override
Invalidate the block.
Definition super_blk.cc:177
SuperBlk & operator=(const SuperBlk &)=delete
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
uint8_t compressionFactor
Superblock's compression factor.
Definition super_blk.hh:181
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
uint8_t getCompressionFactor() const
Get the compression factor of this superblock.
Definition super_blk.cc:227
Copyright (c) 2024 - Pranith Kumar Copyright (c) 2020 Inria All rights reserved.
Definition binary32.hh:36
Copyright (c) 2018, 2020 Inria All rights reserved.

Generated on Tue Jun 18 2024 16:24:05 for gem5 by doxygen 1.11.0