Go to the documentation of this file.
53 sequentialAccess(
p.sequential_access),
54 replacementPolicy(
p.replacement_policy),
55 numBlocksPerSector(
p.num_blocks_per_sector),
56 numSectors(numBlocks / numBlocksPerSector),
57 sectorShift(
floorLog2(blkSize)), sectorMask(numBlocksPerSector - 1),
58 sectorStats(stats, *this)
61 fatal_if(!
p.indexing_policy,
"An indexing policy is required");
65 "Block size must be at least 4 and a power of 2");
67 "# of blocks per sector must be non-zero and a power of 2");
78 unsigned blk_index = 0;
79 for (
unsigned sec_blk_index = 0; sec_blk_index <
numSectors;
95 blk = &
blks[blk_index];
151 if (blk !=
nullptr) {
159 if (blk !=
nullptr) {
206 const bool dest_was_valid =
225 if (!src_sector_blk->
isValid()) {
229 if (dest_was_valid) {
235 }
else if (!dest_was_valid) {
242 if (dest_was_valid) {
264 for (
const auto& sector : entries) {
266 if (blk->matchTag(tag, is_secure)) {
286 for (
const auto& sector : sector_entries) {
288 if (sector_blk->
matchTag(tag, is_secure)) {
289 victim_sector = sector_blk;
295 if (victim_sector ==
nullptr){
306 if (victim_sector->
matchTag(tag, is_secure)) {
312 for (
const auto& blk : victim_sector->
blks){
313 if (blk->isValid()) {
314 evict_blks.push_back(blk);
336 const Addr sec_addr =
343 : statistics::
Group(&base_group), tags(_tags),
344 ADD_STAT(evictionsReplacement, statistics::units::
Count::get(),
345 "Number of blocks evicted due to a replacement")
354 evictionsReplacement.init(tags.numBlocksPerSector + 1);
355 for (
unsigned i = 0;
i <= tags.numBlocksPerSector; ++
i) {
357 evictionsReplacement.subdesc(
i,
"Number of replacements that caused " \
void setSectorBlock(SectorBlk *sector_blk)
Set sector block associated to this block.
void setSectorOffset(const int sector_offset)
Set offset of this sub-block within the sector.
virtual void reset(const std::shared_ptr< ReplacementData > &replacement_data, const PacketPtr pkt)
Reset replacement data.
const std::string to_string(sc_enc enc)
static constexpr std::enable_if_t< std::is_integral_v< T >, int > floorLog2(T x)
virtual bool matchTag(Addr tag, bool is_secure) const
Checks if the given tag information corresponds to this entry's.
virtual Addr getTag() const
Get tag associated to this block.
SectorBlk * getSectorBlock() const
Get sector block associated to this block.
static constexpr bool isPowerOf2(const T &n)
std::vector< SectorSubBlk * > blks
List of blocks associated to this sector.
virtual std::shared_ptr< ReplacementData > instantiateEntry()=0
Instantiate a replacement data entry.
virtual std::vector< ReplaceableEntry * > getPossibleEntries(const Addr addr) const =0
Find all possible entries for insertion and replacement of an address.
Cycles is a wrapper class for representing cycle counts, i.e.
void increaseRefCount()
Get the number of references to this block since insertion.
#define ADD_STAT(n,...)
Convenience macro to add a stat to a statistics group.
A Packet is used to encapsulate a transfer between two objects in the memory system (e....
virtual ReplaceableEntry * getVictim(const ReplacementCandidates &candidates) const =0
Find replacement victim among candidates.
bool isValid() const override
Checks that a sector block is valid.
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
virtual void regStats()
Callback to set stat parameters.
uint8_t * data
Contains a copy of the data in this block for easy access.
virtual void touch(const std::shared_ptr< ReplacementData > &replacement_data, const PacketPtr pkt)
Update replacement data.
A sector is composed of sub-blocks, and each sub-block has information regarding its sector and a poi...
void setEntry(ReplaceableEntry *entry, const uint64_t index)
Associate a pointer to an entry to its physical counterpart.
virtual Addr regenerateAddr(const Addr tag, const ReplaceableEntry *entry) const =0
Regenerate an entry's address from its tag and assigned indexing bits.
std::shared_ptr< replacement_policy::ReplacementData > replacementData
Replacement data associated to this entry.
int getSectorOffset() const
Get offset of this sub-block within the sector.
#define fatal_if(cond,...)
Conditional fatal macro that checks the supplied condition and only causes a fatal error if the condi...
Reference material can be found at the JEDEC website: UFS standard http://www.jedec....
virtual bool isValid() const
Checks if the entry is valid.
virtual void invalidate(const std::shared_ptr< ReplacementData > &replacement_data)=0
Invalidate replacement data to set it as the next probable victim.
Counter value() const
Return the current value of this stat as its base type.
Generated on Sun Jul 30 2023 01:56:57 for gem5 by doxygen 1.8.17