41#ifndef __CACHE_TAGGED_ENTRY_HH__
42#define __CACHE_TAGGED_ENTRY_HH__
50#include "params/TaggedIndexingPolicy.hh"
51#include "params/TaggedSetAssociative.hh"
64 using Params = TaggedIndexingPolicyParams;
82 return (key.address >> setShift) & setMask;
94 return sets[extractSet(key)];
101 return (key.address << tagShift) | (entry->
getSet() << setShift);
118 : _valid(false), _secure(false), _tag(
MaxAddr)
133 virtual bool isValid()
const {
return _valid; }
159 return isValid() && (getTag() == extractTag(key.
address)) &&
173 setTag(extractTag(key.
address));
190 return csprintf(
"tag: %#x secure: %d valid: %d | %s", getTag(),
248 return [ip] (
Addr addr) {
return ip->extractTag(
addr); };
Defines global host-dependent types: Counter, Tick, and (indirectly) {int,uint}{8,...
A common base class for indexing table locations.
typename Types::KeyType KeyType
typename Types::Params Params
A replaceable entry is a basic entry in a 2d table-like structure that needs to have replacement func...
uint32_t getSet() const
Get set number.
virtual std::string print() const
Prints relevant information about this entry.
A tagged entry is an entry containing a tag.
virtual bool isValid() const
Checks if the entry is valid.
void registerTagExtractor(TagExtractor ext)
std::string print() const override
Prints relevant information about this entry.
void clearSecure()
Clear secure bit.
bool match(const KeyType &key) const
Checks if the given tag information corresponds to this entry's.
virtual void setTag(Addr tag)
Set tag associated to this block.
virtual void invalidate()
Invalidate the block.
virtual void insert(const KeyType &key)
Insert the block by assigning it a tag and marking it valid.
bool isSecure() const
Check if this block holds data from the secure memory space.
Addr _tag
The entry's tag.
virtual Addr getTag() const
Get tag associated to this block.
std::function< Addr(Addr)> TagExtractor
TagExtractor extractTag
Callback used to extract the tag from the entry.
virtual void setValid()
Set valid bit.
virtual void setSecure()
Set secure bit.
This version of set associative indexing deals with a Lookup structure made of address and secure bit...
PARAMS(TaggedSetAssociative)
Addr regenerateAddr(const KeyType &key, const ReplaceableEntry *entry) const override
Regenerate an entry's address from its tag and assigned indexing bits.
virtual uint32_t extractSet(const KeyType &key) const
std::vector< ReplaceableEntry * > getPossibleEntries(const KeyType &key) const override
Find all possible entries for insertion and replacement of an address.
TaggedSetAssociative(const Params &p)
TaggedIndexingPolicyParams Params
static constexpr std::enable_if_t< std::is_integral_v< T >, int > floorLog2(T x)
bool isSecure(ThreadContext *tc)
Copyright (c) 2024 Arm Limited All rights reserved.
IndexingPolicyTemplate< TaggedTypes > TaggedIndexingPolicy
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
static constexpr auto genTagExtractor(BTBIndexingPolicy *ip)
This helper generates a tag extractor function object which will be typically used by Replaceable ent...
std::string csprintf(const char *format, const Args &...args)