summaryrefslogtreecommitdiff
path: root/src/mem/cache/base.hh
diff options
context:
space:
mode:
Diffstat (limited to 'src/mem/cache/base.hh')
-rw-r--r--src/mem/cache/base.hh57
1 files changed, 31 insertions, 26 deletions
diff --git a/src/mem/cache/base.hh b/src/mem/cache/base.hh
index c4e39716f..87948294e 100644
--- a/src/mem/cache/base.hh
+++ b/src/mem/cache/base.hh
@@ -454,9 +454,11 @@ class BaseCache : public ClockedObject
* @param pkt The memory request to perform.
* @param blk The cache block to be updated.
* @param lat The latency of the access.
+ * @param writebacks List for any writebacks that need to be performed.
* @return Boolean indicating whether the request was satisfied.
*/
- virtual bool access(PacketPtr pkt, CacheBlk *&blk, Cycles &lat);
+ virtual bool access(PacketPtr pkt, CacheBlk *&blk, Cycles &lat,
+ PacketList &writebacks);
/*
* Handle a timing request that hit in the cache
@@ -549,9 +551,11 @@ class BaseCache : public ClockedObject
*
* @param pkt The packet with the requests
* @param blk The referenced block
+ * @param writebacks A list with packets for any performed writebacks
* @return Cycles for handling the request
*/
- virtual Cycles handleAtomicReqMiss(PacketPtr pkt, CacheBlk *&blk) = 0;
+ virtual Cycles handleAtomicReqMiss(PacketPtr pkt, CacheBlk *&blk,
+ PacketList &writebacks) = 0;
/**
* Performs the access specified by the request.
@@ -591,18 +595,13 @@ class BaseCache : public ClockedObject
/**
* Insert writebacks into the write buffer
- *
- * @param pkt The writeback packet.
- * @param forward_time Tick to which the writeback should be scheduled.
*/
- virtual void doWritebacks(PacketPtr pkt, Tick forward_time) = 0;
+ virtual void doWritebacks(PacketList& writebacks, Tick forward_time) = 0;
/**
- * Send writebacks down the memory hierarchy in atomic mode.
- *
- * @param pkt The writeback packet.
+ * Send writebacks down the memory hierarchy in atomic mode
*/
- virtual void doWritebacksAtomic(PacketPtr pkt) = 0;
+ virtual void doWritebacksAtomic(PacketList& writebacks) = 0;
/**
* Create an appropriate downstream bus request packet.
@@ -648,7 +647,8 @@ class BaseCache : public ClockedObject
*/
void writebackTempBlockAtomic() {
assert(tempBlockWriteback != nullptr);
- doWritebacksAtomic(tempBlockWriteback);
+ PacketList writebacks{tempBlockWriteback};
+ doWritebacksAtomic(writebacks);
tempBlockWriteback = nullptr;
}
@@ -680,12 +680,11 @@ class BaseCache : public ClockedObject
*
* @param blk The block to be overwriten.
* @param data A pointer to the data to be compressed (blk's new data).
- * @param delay The delay until the packet's metadata is present.
- * @param tag_latency Latency to access the tags of the replacement victim.
+ * @param writebacks List for any writebacks that need to be performed.
* @return Whether operation is successful or not.
*/
bool updateCompressionData(CacheBlk *blk, const uint64_t* data,
- uint32_t delay, Cycles tag_latency);
+ PacketList &writebacks);
/**
* Perform any necessary updates to the block and perform any data
@@ -718,27 +717,34 @@ class BaseCache : public ClockedObject
* Populates a cache block and handles all outstanding requests for the
* satisfied fill request. This version takes two memory requests. One
* contains the fill data, the other is an optional target to satisfy.
+ * Note that the reason we return a list of writebacks rather than
+ * inserting them directly in the write buffer is that this function
+ * is called by both atomic and timing-mode accesses, and in atomic
+ * mode we don't mess with the write buffer (we just perform the
+ * writebacks atomically once the original request is complete).
*
* @param pkt The memory request with the fill data.
* @param blk The cache block if it already exists.
+ * @param writebacks List for any writebacks that need to be performed.
* @param allocate Whether to allocate a block or use the temp block
* @return Pointer to the new cache block.
*/
- CacheBlk *handleFill(PacketPtr pkt, CacheBlk *blk, bool allocate);
+ CacheBlk *handleFill(PacketPtr pkt, CacheBlk *blk,
+ PacketList &writebacks, bool allocate);
/**
- * Allocate a new block for the packet's data. The victim block might be
- * valid, and thus the necessary writebacks are done. May return nullptr
- * if there are no replaceable blocks. If a replaceable block is found,
- * it inserts the new block in its place. The new block, however, is not
- * set as valid yet.
+ * Allocate a new block and perform any necessary writebacks
+ *
+ * Find a victim block and if necessary prepare writebacks for any
+ * existing data. May return nullptr if there are no replaceable
+ * blocks. If a replaceable block is found, it inserts the new block in
+ * its place. The new block, however, is not set as valid yet.
*
* @param pkt Packet holding the address to update
- * @param tag_latency Latency to access the tags of the replacement victim.
+ * @param writebacks A list of writeback packets for the evicted blocks
* @return the allocated block
*/
- CacheBlk *allocateBlock(const PacketPtr pkt, Cycles tag_latency);
-
+ CacheBlk *allocateBlock(const PacketPtr pkt, PacketList &writebacks);
/**
* Evict a cache block.
*
@@ -755,10 +761,9 @@ class BaseCache : public ClockedObject
* Performs a writeback if necesssary and invalidates the block
*
* @param blk Block to invalidate
- * @param forward_time Tick to which the writeback should be scheduled if
- * in timing mode.
+ * @param writebacks Return a list of packets with writebacks
*/
- void evictBlock(CacheBlk *blk, Tick forward_time);
+ void evictBlock(CacheBlk *blk, PacketList &writebacks);
/**
* Invalidate a cache block.