48 #ifndef __MEM_CACHE_CACHE_BLK_HH__ 49 #define __MEM_CACHE_CACHE_BLK_HH__ 143 Addr req_low = req->getPaddr();
144 Addr req_high = req_low + req->getSize() -1;
145 return (contextId == req->contextId()) &&
146 (req_low >= lowAddr) && (req_high <=
highAddr);
152 Addr req_low = req->getPaddr();
153 Addr req_high = req_low + req->getSize() - 1;
155 return (req_low <= highAddr) && (req_high >=
lowAddr);
159 : contextId(req->contextId()),
160 lowAddr(req->getPaddr()),
161 highAddr(lowAddr + req->getSize() - 1)
187 return (status & needed_bits) == needed_bits;
199 return (status & needed_bits) == needed_bits;
290 assert(tick >= tickInserted);
305 virtual void insert(
const Addr tag,
const bool is_secure,
306 const int src_master_ID,
const uint32_t task_ID);
315 auto l = lockList.begin();
316 while (l != lockList.end()) {
317 if (l->intersects(pkt->
req))
318 l = lockList.erase(l);
323 lockList.emplace_front(pkt->
req);
332 auto l = lockList.begin();
333 while (
l != lockList.end()) {
334 if (
l->intersects(req) &&
l->contextId != req->contextId()) {
335 l = lockList.erase(
l);
378 case 0b111: s =
'M';
break;
379 case 0b011: s =
'O';
break;
380 case 0b101: s =
'E';
break;
381 case 0b001: s =
'S';
break;
382 case 0b000: s =
'I';
break;
383 default: s =
'T';
break;
385 return csprintf(
"state: %x (%c) valid: %d writable: %d readable: %d " 386 "dirty: %d | tag: %#x %s", status, s,
401 if (!pkt->
isLLSC() && lockList.empty())
409 bool success =
false;
411 auto l = lockList.begin();
412 while (!success &&
l != lockList.end()) {
413 if (
l->matches(pkt->
req)) {
424 req->setExtraData(success ? 1 : 0);
459 data =
new uint8_t[size];
475 const int src_master_ID=0,
const uint32_t task_ID=0)
override 515 void print(std::ostream &o,
int verbosity = 0,
516 const std::string &prefix =
"")
const;
519 #endif //__MEM_CACHE_CACHE_BLK_HH__ void insert(const Addr addr, const bool is_secure, const int src_master_ID=0, const uint32_t task_ID=0) override
Set member variables when a block insertion occurs.
Special instance of CacheBlk for use with tempBlk that deals with its block address regeneration...
State status
The current status of this block.
bool isValid() const
Checks that a block is valid.
Tick whenReady
Which curTick() will this block be accessible.
bool isWritable() const
Checks the write permissions of this block.
virtual void setValid()
Set valid bit.
std::string print() const override
Pretty-print tag, set and way, and interpret state bits to readable form including mapping to a MOESI...
Addr tag
Data block tag value.
Declaration of a request, the overall memory request consisting of the parts of the request that are ...
std::shared_ptr< Request > RequestPtr
void invalidate() override
Invalidate the block and clear all state.
Simple class to provide virtual print() method on cache blocks without allocating a vtable pointer fo...
unsigned refCount
Number of references to this block since it was brought in.
block holds compressed data
virtual void setSecure()
Set secure bit.
bool intersects(const RequestPtr &req) const
void clearLoadLocks(const RequestPtr &req)
Clear the any load lock that intersect the request, and is from a different context.
CacheBlkPrintWrapper(CacheBlk *_blk)
block was a hardware prefetch yet unaccessed
RequestPtr req
A pointer to the original request.
Tick tickInserted
Tick on which the block was inserted in the cache.
std::string csprintf(const char *format, const Args &...args)
bool checkWrite(PacketPtr pkt)
Handle interaction of load-locked operations and stores.
void trackLoadLocked(PacketPtr pkt)
Track the fact that a local locked was issued to the block.
virtual void insert(const Addr tag, const bool is_secure, const int src_master_ID, const uint32_t task_ID)
Set member variables when a block insertion occurs.
uint64_t Tick
Tick count type.
unsigned State
block state: OR of CacheBlkStatusBit
virtual std::string print() const
Prints relevant information about this entry.
bool isSecure() const
Check if this block holds data from the secure memory space.
void setWhenReady(const Tick tick)
Set tick at which block's data will be available for access.
Defines global host-dependent types: Counter, Tick, and (indirectly) {int,uint}{8,16,32,64}_t.
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
bool matches(const RequestPtr &req) const
A Packet is used to encapsulate a transfer between two objects in the memory system (e...
bool isReadable() const
Checks the read permissions of this block.
Abstract base class for objects which support being printed to a stream for debugging.
Represents that the indicated thread context has a "lock" on the block, in the LL/SC sense...
CacheBlk & operator=(const CacheBlk &)=delete
CacheBlkStatusBits
Cache block status bit assignments.
Declaration of the Packet class.
int srcMasterId
holds the source requestor ID for this block.
TempCacheBlk(unsigned size)
Creates a temporary cache block, with its own storage.
std::list< Lock > lockList
List of thread contexts that have performed a load-locked (LL) on the block since the last store...
Invalid master id for assertion checking only.
Addr getAddr() const
Get block's address.
A replaceable entry is a basic entry in a 2d table-like structure that needs to have replacement func...
uint32_t task_id
Task Id associated with this block.
Lock(const RequestPtr &req)
bool wasPrefetched() const
Check if this block was the result of a hardware prefetch, yet to be touched.
block holds data from the secure memory space
Tick getWhenReady() const
Get tick at which block's data will be available for access.
Addr _addr
Copy of the block's address, used to regenerate tempBlock's address.
read permission (yes, block can be valid but not readable)
uint8_t * data
Contains a copy of the data in this block for easy access.
int ContextID
Globally unique thread context ID.
virtual ~CacheBlkPrintWrapper()
virtual void invalidate()
Invalidate the block and clear all state.
bool isDirty() const
Check to see if a block has been written.