46#ifndef __MEM_CACHE_CACHE_BLK_HH__
47#define __MEM_CACHE_CACHE_BLK_HH__
128 Addr req_low = req->getPaddr();
129 Addr req_high = req_low + req->getSize() -1;
130 return (
contextId == req->contextId()) &&
137 Addr req_low = req->getPaddr();
138 Addr req_high = req_low + req->getSize() - 1;
178 assert(other.isValid());
180 insert(other.getTag(), other.isSecure());
182 if (other.wasPrefetched()) {
191 std::swap(
lockList, other.lockList);
327 const int src_requestor_ID,
const uint32_t task_ID,
328 const uint64_t partition_id);
340 if (
l->intersects(pkt->
req))
357 if (
l->intersects(req) &&
l->contextId != req->contextId()) {
402 case 0b111:
s =
'M';
break;
403 case 0b011:
s =
'O';
break;
404 case 0b101:
s =
'E';
break;
405 case 0b001:
s =
'S';
break;
406 case 0b000:
s =
'I';
break;
407 default:
s =
'T';
break;
409 return csprintf(
"state: %x (%c) writable: %d readable: %d "
410 "dirty: %d prefetched: %d | %s",
coherence,
s,
433 bool success =
false;
436 while (!success &&
l !=
lockList.end()) {
437 if (
l->matches(pkt->
req)) {
448 req->setExtraData(success ? 1 : 0);
531 data =
new uint8_t[size];
534 using CacheBlk::operator=;
577 void print(std::ostream &o,
int verbosity = 0,
578 const std::string &prefix =
"")
const;
Defines global host-dependent types: Counter, Tick, and (indirectly) {int,uint}{8,...
Simple class to provide virtual print() method on cache blocks without allocating a vtable pointer fo...
void print(std::ostream &o, int verbosity=0, const std::string &prefix="") const
CacheBlkPrintWrapper(CacheBlk *_blk)
virtual ~CacheBlkPrintWrapper()
Represents that the indicated thread context has a "lock" on the block, in the LL/SC sense.
Lock(const RequestPtr &req)
bool matches(const RequestPtr &req) const
bool intersects(const RequestPtr &req) const
virtual CacheBlk & operator=(CacheBlk &&other)
Move assignment operator.
void setWhenReady(const Tick tick)
Set tick at which block's data will be available for access.
CoherenceBits
Cache block's enum listing the supported coherence bits.
@ ReadableBit
Read permission.
@ AllBits
Helper enum value that includes all other bits.
@ WritableBit
write permission
@ DirtyBit
dirty (modified)
Tick whenReady
Which curTick() will this block be accessible.
uint32_t getSrcRequestorId() const
Get the requestor id associated to this block.
int _srcRequestorId
holds the source requestor ID for this block.
Tick getWhenReady() const
Get tick at which block's data will be available for access.
void clearPrefetched()
Clear the prefetching bit.
unsigned _refCount
Number of references to this block since it was brought in.
void setPrefetched()
Marks this blocks as a recently prefetched block.
void insert(const Addr tag, const bool is_secure, const int src_requestor_ID, const uint32_t task_ID, const uint64_t partition_id)
Set member variables when a block insertion occurs.
Tick getAge() const
Get the block's age, that is, the number of ticks since its insertion.
unsigned getRefCount() const
Get the number of references to this block since insertion.
uint64_t getPartitionId() const
Getter for _partitionId.
CacheBlk & operator=(const CacheBlk &)=delete
std::string print() const override
Pretty-print tag, set and way, and interpret state bits to readable form including mapping to a MOESI...
bool isSet(unsigned bits) const
Checks the given coherence bits are set.
void setTaskId(const uint32_t task_id)
Set the task id value.
bool _prefetched
Whether this block is an unaccessed hardware prefetch.
void setTickInserted()
Set the current tick as this block's insertion tick.
CacheBlk(const CacheBlk &&)=delete
uint64_t _partitionId
Partition ID of the activity that allocated this block.
virtual void invalidate() override
Invalidate the block and clear all state.
uint32_t _taskId
Task Id associated with this block.
bool checkWrite(PacketPtr pkt)
Handle interaction of load-locked operations and stores.
void clearCoherenceBits(unsigned bits)
Clear the corresponding coherence bits.
void clearLoadLocks(const RequestPtr &req)
Clear the any load lock that intersect the request, and is from a different context.
void increaseRefCount()
Get the number of references to this block since insertion.
uint32_t getTaskId() const
Get the task id associated to this block.
void setPartitionId(const uint64_t partitionId)
Setter for _partitionId.
void trackLoadLocked(PacketPtr pkt)
Track the fact that a local locked was issued to the block.
bool wasPrefetched() const
Check if this block was the result of a hardware prefetch, yet to be touched.
CacheBlk(const CacheBlk &)=delete
void setSrcRequestorId(const uint32_t id)
Set the source requestor id.
void setRefCount(const unsigned count)
Set the number of references to this block since insertion.
std::list< Lock > lockList
List of thread contexts that have performed a load-locked (LL) on the block since the last store.
uint8_t * data
Contains a copy of the data in this block for easy access.
unsigned coherence
The current coherence status of this block.
Tick _tickInserted
Tick on which the block was inserted in the cache.
void setCoherenceBits(unsigned bits)
Sets the corresponding coherence bits.
virtual bool isValid() const
Checks if the entry is valid.
A Packet is used to encapsulate a transfer between two objects in the memory system (e....
RequestPtr req
A pointer to the original request.
Abstract base class for objects which support being printed to a stream for debugging.
@ invldRequestorId
Invalid requestor id for assertion checking only.
A tagged entry is an entry containing a tag.
void invalidate() override
Invalidate the block.
std::string print() const override
Prints relevant information about this entry.
virtual void insert(const Addr tag, const bool is_secure)
Insert the block by assigning it a tag and marking it valid.
Special instance of CacheBlk for use with tempBlk that deals with its block address regeneration.
void insert(const Addr addr, const bool is_secure) override
Insert the block by assigning it a tag and marking it valid.
Addr getAddr() const
Get block's address.
TempCacheBlk(unsigned size)
Creates a temporary cache block, with its own storage.
void invalidate() override
Invalidate the block and clear all state.
TempCacheBlk & operator=(const TempCacheBlk &)=delete
Addr _addr
Copy of the block's address, used to regenerate tempBlock's address.
TempCacheBlk(const TempCacheBlk &)=delete
constexpr T bits(T val, unsigned first, unsigned last)
Extract the bitfield from position 'first' to 'last' (inclusive) from 'val' and right justify it.
Copyright (c) 2024 - Pranith Kumar Copyright (c) 2020 Inria All rights reserved.
std::shared_ptr< Request > RequestPtr
Tick curTick()
The universal simulation clock.
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
uint64_t Tick
Tick count type.
int ContextID
Globally unique thread context ID.
std::string csprintf(const char *format, const Args &...args)
Declaration of the Packet class.
Declaration of a request, the overall memory request consisting of the parts of the request that are ...