gem5  v19.0.0.0
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
super_blk.cc
Go to the documentation of this file.
1 
38 
39 #include "base/logging.hh"
40 
42  : SectorSubBlk(), _size(0), _decompressionLatency(0)
43 {
44 }
45 
46 bool
48 {
49  return (status & BlkCompressed) != 0;
50 }
51 
52 void
54 {
56 }
57 
58 void
60 {
62 }
63 
64 std::size_t
66 {
67  return _size;
68 }
69 
70 void
71 CompressionBlk::setSizeBits(const std::size_t size)
72 {
73  _size = size;
74 }
75 
76 Cycles
78 {
79  return _decompressionLatency;
80 }
81 
82 void
84 {
86 }
87 
88 std::string
90 {
91  return csprintf("%s compressed: %d size: %llu decompression latency: %d",
94 }
95 
96 bool
97 SuperBlk::isCompressed(const CompressionBlk* ignored_blk) const
98 {
99  for (const auto& blk : blks) {
100  if (blk->isValid() && (blk != ignored_blk)) {
101  return static_cast<CompressionBlk*>(blk)->isCompressed();
102  }
103  }
104 
105  // An invalid block is seen as compressed
106  return true;
107 }
108 
109 bool
110 SuperBlk::canCoAllocate(const std::size_t compressed_size) const
111 {
112  // Simple co-allocation function: at most numBlocksPerSector blocks that
113  // compress at least to (100/numBlocksPerSector)% of their original size
114  // can share a superblock
115  return (compressed_size <= (blkSize * 8) / blks.size());
116 }
117 
118 void
119 SuperBlk::setBlkSize(const std::size_t blk_size)
120 {
121  assert(blkSize == 0);
122  blkSize = blk_size;
123 }
void setDecompressionLatency(const Cycles lat)
Set number of cycles needed to decompress this block.
Definition: super_blk.cc:83
State status
The current status of this block.
Definition: cache_blk.hh:108
Cycles is a wrapper class for representing cycle counts, i.e.
Definition: types.hh:83
std::string print() const override
Pretty-print sector offset and other CacheBlk information.
Definition: sector_blk.cc:112
A sector is composed of sub-blocks, and each sub-block has information regarding its sector and a poi...
Definition: sector_blk.hh:50
Cycles getDecompressionLatency() const
Get number of cycles needed to decompress this block.
Definition: super_blk.cc:77
void setUncompressed()
Clear compression bit.
Definition: super_blk.cc:59
block holds compressed data
Definition: cache_blk.hh:80
std::size_t _size
Set size, in bits, of this compressed block&#39;s data.
Definition: super_blk.hh:56
void setSizeBits(const std::size_t size)
Set size, in bits, of this compressed block&#39;s data.
Definition: super_blk.cc:71
std::size_t getSizeBits() const
Definition: super_blk.cc:65
std::string csprintf(const char *format, const Args &...args)
Definition: cprintf.hh:162
bool canCoAllocate(const std::size_t compressed_size) const
Checks whether a superblock can co-allocate given compressed data block.
Definition: super_blk.cc:110
Copyright (c) 2018 Inria All rights reserved.
A superblock is composed of sub-blocks, and each sub-block has information regarding its superblock a...
Definition: super_blk.hh:50
void setCompressed()
Set compression bit.
Definition: super_blk.cc:53
bool isCompressed() const
Check if this block holds compressed data.
Definition: super_blk.cc:47
Cycles _decompressionLatency
Number of cycles needed to decompress this block.
Definition: super_blk.hh:62
bool isCompressed(const CompressionBlk *ignored_blk=nullptr) const
Returns whether the superblock contains compressed blocks or not.
Definition: super_blk.cc:97
std::string print() const override
Pretty-print sector offset and other CacheBlk information.
Definition: super_blk.cc:89
void setBlkSize(const std::size_t blk_size)
Set block size.
Definition: super_blk.cc:119

Generated on Fri Feb 28 2020 16:27:02 for gem5 by doxygen 1.8.13