47#ifndef __MEM_CACHE_TAGS_FA_LRU_HH__
48#define __MEM_CACHE_TAGS_FA_LRU_HH__
53#include <unordered_map>
64#include "params/FALRU.hh"
74class ReplaceableEntry;
89 using CacheBlk::operator=;
104 std::string
print()
const override;
129 template <
class T1,
class T2>
132 return std::hash<T1>()(
p.first) ^ std::hash<T2>()(
p.second);
136 typedef std::unordered_map<TagHashKey, FALRUBlk *, PairHash>
TagHash;
224 const std::size_t
size,
226 const uint64_t partition_id=0)
override;
262 if (visitor(
blks[
i])) {
Defines global host-dependent types: Counter, Tick, and (indirectly) {int,uint}{8,...
Definitions of a simple cache block class.
virtual Addr getTag() const
Get tag associated to this block.
Cycles is a wrapper class for representing cycle counts, i.e.
A fully associative cache block.
FALRUBlk * next
The next block in LRU order.
FALRUBlk * prev
The previous block in LRU order.
std::string print() const override
Pretty-print inCachesMask and other CacheBlk information.
CachesMask inCachesMask
A bit mask of the caches that fit this block.
Mechanism that allows us to simultaneously collect miss statistics for multiple caches.
void check(const FALRUBlk *head, const FALRUBlk *tail) const
Check that the tracking mechanism is in consistent state.
void recordAccess(FALRUBlk *blk)
Notify of a block access.
const CachesMask inAllCachesMask
A mask for all cache being tracked.
void moveBlockToHead(FALRUBlk *blk)
Update boundaries as a block will be moved to the MRU.
void moveBlockToTail(FALRUBlk *blk)
Update boundaries as a block will be moved to the LRU.
std::vector< FALRUBlk * > boundaries
Array of pointers to blocks at the cache boundaries.
const unsigned blkSize
The size of the cache block.
const unsigned minTrackedSize
The smallest cache we are tracking.
CacheTracking(unsigned min_size, unsigned max_size, unsigned block_size, statistics::Group *parent)
const int numTrackedCaches
The number of different size caches being tracked.
A fully associative LRU cache.
std::pair< Addr, bool > TagHashKey
void moveToTail(FALRUBlk *blk)
Move a cache block to the LRU position.
std::unordered_map< TagHashKey, FALRUBlk *, PairHash > TagHash
CacheBlk * accessBlock(const PacketPtr pkt, Cycles &lat, CachesMask *in_cache_mask)
Access block and update replacement data.
TagHash tagHash
The address hash table.
Addr extractTag(Addr addr) const override
Generate the tag from the addres.
FALRU(const Params &p)
Construct and initialize this cache tagstore.
bool anyBlk(std::function< bool(CacheBlk &)> visitor) override
Find if any of the blocks satisfies a condition.
FALRUBlk BlkType
Typedef the block type used in this class.
ReplaceableEntry * findBlockBySetAndWay(int set, int way) const override
Find a block given set and way.
void moveBlock(CacheBlk *src_blk, CacheBlk *dest_blk) override
Move a block's metadata to another location decided by the replacement policy.
void invalidate(CacheBlk *blk) override
Invalidate a cache block.
void moveToHead(FALRUBlk *blk)
Move a cache block to the MRU position.
Addr regenerateBlkAddr(const CacheBlk *blk) const override
Regenerate the block address from the tag.
CacheBlk * findVictim(Addr addr, const bool is_secure, const std::size_t size, std::vector< CacheBlk * > &evict_blks, const uint64_t partition_id=0) override
Find replacement victim based on address.
CacheBlk * findBlock(Addr addr, bool is_secure) const override
Find the block in the cache, do not update the replacement data.
CacheTracking cacheTracking
void tagsInit() override
Initialize blocks as FALRUBlk instances.
FALRUBlk * tail
The LRU block.
FALRUBlk * head
The MRU block.
void insertBlock(const PacketPtr pkt, CacheBlk *blk) override
Insert the new block into the cache and update replacement data.
FALRUBlk * blks
The cache blocks.
A Packet is used to encapsulate a transfer between two objects in the memory system (e....
A replaceable entry is a basic entry in a 2d table-like structure that needs to have replacement func...
This is a simple scalar statistic, like a counter.
A vector of scalar stats.
statistics::Vector hits
Hits in each cache.
statistics::Vector misses
Misses in each cache.
statistics::Scalar accesses
Total number of accesses.
const FlagsType init
This Stat is Initialized.
Copyright (c) 2024 - Pranith Kumar Copyright (c) 2020 Inria All rights reserved.
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
Declaration of the Packet class.
Declaration of Statistics objects.
Hash table type mapping addresses to cache block pointers.
std::size_t operator()(const std::pair< T1, T2 > &p) const