Go to the documentation of this file.
50 sequentialAccess(
p->sequential_access),
51 replacementPolicy(
p->replacement_policy),
52 numBlocksPerSector(
p->num_blocks_per_sector),
53 numSectors(numBlocks / numBlocksPerSector),
54 sectorShift(
floorLog2(blkSize)), sectorMask(numBlocksPerSector - 1),
55 sectorStats(stats, *this)
59 "Block size must be at least 4 and a power of 2");
61 "# of blocks per sector must be non-zero and a power of 2");
72 unsigned blk_index = 0;
73 for (
unsigned sec_blk_index = 0; sec_blk_index <
numSectors;
89 blk = &
blks[blk_index];
144 if (blk !=
nullptr) {
152 if (blk !=
nullptr) {
210 for (
const auto& sector : entries) {
212 if (blk->getTag() == tag && blk->isValid() &&
213 blk->isSecure() == is_secure) {
233 for (
const auto& sector : sector_entries) {
235 if ((tag == sector_blk->
getTag()) && sector_blk->
isValid() &&
236 (is_secure == sector_blk->
isSecure())){
237 victim_sector = sector_blk;
243 if (victim_sector ==
nullptr){
254 if ((tag == victim_sector->
getTag()) &&
255 (is_secure == victim_sector->
isSecure())){
261 for (
const auto& blk : victim_sector->
blks){
262 if (blk->isValid()) {
263 evict_blks.push_back(blk);
291 :
Stats::Group(&base_group), tags(_tags),
292 evictionsReplacement(this,
"evictions_replacement",
293 "Number of blocks evicted due to a replacement")
302 evictionsReplacement.init(tags.numBlocksPerSector + 1);
303 for (
unsigned i = 0;
i <= tags.numBlocksPerSector; ++
i) {
305 evictionsReplacement.subdesc(
i,
"Number of replacements that caused " \
330 SectorTagsParams::create()
333 fatal_if(!indexing_policy,
"An indexing policy is required");
virtual void regStats()
Callback to set stat parameters.
virtual void invalidate(const std::shared_ptr< ReplacementData > &replacement_data) const =0
Invalidate replacement data to set it as the next probable victim.
virtual Addr regenerateAddr(const Addr tag, const ReplaceableEntry *entry) const =0
Regenerate an entry's address from its tag and assigned indexing bits.
const std::string to_string(sc_enc enc)
std::enable_if< std::is_integral< T >::value, int >::type floorLog2(T x)
virtual std::shared_ptr< ReplacementData > instantiateEntry()=0
Instantiate a replacement data entry.
Addr getTag() const
Get tag associated to this block.
std::vector< SectorSubBlk * > blks
List of blocks associated to this sector.
void setSectorBlock(SectorBlk *sector_blk)
Set sector block associated to this block.
void setEntry(ReplaceableEntry *entry, const uint64_t index)
Associate a pointer to an entry to its physical counterpart.
virtual ReplaceableEntry * getVictim(const ReplacementCandidates &candidates) const =0
Find replacement victim among candidates.
unsigned refCount
Number of references to this block since it was brought in.
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
virtual std::vector< ReplaceableEntry * > getPossibleEntries(const Addr addr) const =0
Find all possible entries for insertion and replacement of an address.
bool isValid() const
Checks that a sector block is valid.
Addr tag
Data block tag value.
bool isValid() const
Checks that a block is valid.
bool isSecure() const
Checks that a sector block is secure.
uint8_t * data
Contains a copy of the data in this block for easy access.
void setSectorOffset(const int sector_offset)
Set offset of this sub-block within the sector.
int getSectorOffset() const
Get offset of this sub-block within the sector.
A Packet is used to encapsulate a transfer between two objects in the memory system (e....
virtual void touch(const std::shared_ptr< ReplacementData > &replacement_data) const =0
Update replacement data.
const SectorBlk * getSectorBlock() const
Get sector block associated to this block.
Cycles is a wrapper class for representing cycle counts, i.e.
A sector is composed of sub-blocks, and each sub-block has information regarding its sector and a poi...
std::shared_ptr< ReplacementData > replacementData
Replacement data associated to this entry.
virtual void reset(const std::shared_ptr< ReplacementData > &replacement_data) const =0
Reset replacement data.
#define fatal_if(cond,...)
Conditional fatal macro that checks the supplied condition and only causes a fatal error if the condi...
bool isPowerOf2(const T &n)
Generated on Wed Sep 30 2020 14:02:12 for gem5 by doxygen 1.8.17