gem5  v22.1.0.0
sector_blk.hh
Go to the documentation of this file.
1 
34 #ifndef __MEM_CACHE_TAGS_SECTOR_BLK_HH__
35 #define __MEM_CACHE_TAGS_SECTOR_BLK_HH__
36 
37 #include <vector>
38 
39 #include "mem/cache/cache_blk.hh"
41 
42 namespace gem5
43 {
44 
45 class SectorBlk;
46 
51 class SectorSubBlk : public CacheBlk
52 {
53  protected:
58 
63 
64  public:
66  SectorSubBlk(const SectorSubBlk&) = delete;
67  SectorSubBlk& operator=(const SectorSubBlk&) = delete;
77  SectorSubBlk& operator=(SectorSubBlk&& other) = default;
78  ~SectorSubBlk() = default;
79 
85  void setSectorBlock(SectorBlk* sector_blk);
86 
92  SectorBlk* getSectorBlock() const;
93 
99  void setSectorOffset(const int sector_offset);
100 
106  int getSectorOffset() const;
107 
108  Addr getTag() const override;
109 
113  void setValid() override;
114 
115  void insert(const Addr tag, const bool is_secure) override;
116 
120  void invalidate() override;
121 
127  std::string print() const override;
128 };
129 
134 class SectorBlk : public TaggedEntry
135 {
136  private:
141  uint8_t _validCounter;
142 
143  public:
144  SectorBlk();
145  SectorBlk(const SectorBlk&) = delete;
146  SectorBlk& operator=(const SectorBlk&) = delete;
148 
151 
157  bool isValid() const override;
158 
164  uint8_t getNumValid() const;
165 
169  void validateSubBlk();
170 
174  void invalidateSubBlk();
175 
182  void setPosition(const uint32_t set, const uint32_t way) override;
183 
189  std::string print() const override;
190 };
191 
192 } // namespace gem5
193 
194 #endif //__MEM_CACHE_TAGS_SECTOR_BLK_HH__
Definitions of a simple cache block class.
A Basic Cache block.
Definition: cache_blk.hh:71
virtual void insert(const Addr tag, const bool is_secure)
Insert the block by assigning it a tag and marking it valid.
Definition: tagged_entry.hh:93
A Basic Sector block.
Definition: sector_blk.hh:135
void invalidateSubBlk()
Decrease the number of valid sub-blocks.
Definition: sector_blk.cc:139
std::vector< SectorSubBlk * > blks
List of blocks associated to this sector.
Definition: sector_blk.hh:147
std::string print() const override
Print relevant information for this sector block and its sub-blocks.
Definition: sector_blk.cc:158
bool isValid() const override
Checks that a sector block is valid.
Definition: sector_blk.cc:120
uint8_t getNumValid() const
Get the number of sub-blocks that have been validated.
Definition: sector_blk.cc:127
void setPosition(const uint32_t set, const uint32_t way) override
Sets the position of the sub-entries, besides its own.
Definition: sector_blk.cc:149
uint8_t _validCounter
Counter of the number of valid sub-blocks.
Definition: sector_blk.hh:141
SectorBlk & operator=(const SectorBlk &)=delete
SectorBlk(const SectorBlk &)=delete
void validateSubBlk()
Increase the number of valid sub-blocks.
Definition: sector_blk.cc:133
A sector is composed of sub-blocks, and each sub-block has information regarding its sector and a poi...
Definition: sector_blk.hh:52
~SectorSubBlk()=default
SectorSubBlk(const SectorSubBlk &)=delete
int getSectorOffset() const
Get offset of this sub-block within the sector.
Definition: sector_blk.cc:64
SectorBlk * _sectorBlk
Sector block associated to this block.
Definition: sector_blk.hh:57
void setSectorBlock(SectorBlk *sector_blk)
Set sector block associated to this block.
Definition: sector_blk.cc:45
SectorSubBlk(SectorSubBlk &&)=delete
void setSectorOffset(const int sector_offset)
Set offset of this sub-block within the sector.
Definition: sector_blk.cc:58
Addr getTag() const override
Get tag associated to this block.
Definition: sector_blk.cc:70
void invalidate() override
Invalidate the block and inform sector block.
Definition: sector_blk.cc:101
void setValid() override
Set valid bit and inform sector block.
Definition: sector_blk.cc:79
std::string print() const override
Pretty-print sector offset and other CacheBlk information.
Definition: sector_blk.cc:108
int _sectorOffset
The offset of this sub-block in the sector.
Definition: sector_blk.hh:62
SectorBlk * getSectorBlock() const
Get sector block associated to this block.
Definition: sector_blk.cc:52
SectorSubBlk & operator=(const SectorSubBlk &)=delete
SectorSubBlk & operator=(SectorSubBlk &&other)=default
Move assignment operator.
A tagged entry is an entry containing a tag.
Definition: tagged_entry.hh:47
STL vector class.
Definition: stl.hh:37
Bitfield< 12, 11 > set
Definition: misc_types.hh:709
Reference material can be found at the JEDEC website: UFS standard http://www.jedec....
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
Definition: types.hh:147

Generated on Wed Dec 21 2022 10:22:37 for gem5 by doxygen 1.9.1