diff options
author | Lena Olson <lena@cs.wisc.edu> | 2012-09-11 14:14:49 -0400 |
---|---|---|
committer | Lena Olson <lena@cs.wisc.edu> | 2012-09-11 14:14:49 -0400 |
commit | 584eba3ab66c8f95e2344cf7115ec2fb13604eb1 (patch) | |
tree | a616f7cd709a46c6c1fe3c55d4d190f02e5261c7 /src/mem/cache/cache_impl.hh | |
parent | fe5deb4a22260b3e67839fb1efa978cff51e79ba (diff) | |
download | gem5-584eba3ab66c8f95e2344cf7115ec2fb13604eb1.tar.xz |
Cache: Split invalidateBlk up to seperate block vs. tags
This seperates the functionality to clear the state in a block into
blk.hh and the functionality to udpate the tag information into the
tags. This gets rid of the case where calling invalidateBlk on an
already-invalid block does something different than calling it on a
valid block, which was confusing.
Diffstat (limited to 'src/mem/cache/cache_impl.hh')
-rw-r--r-- | src/mem/cache/cache_impl.hh | 34 |
1 files changed, 22 insertions, 12 deletions
diff --git a/src/mem/cache/cache_impl.hh b/src/mem/cache/cache_impl.hh index 2fdbc5c1d..563160ac1 100644 --- a/src/mem/cache/cache_impl.hh +++ b/src/mem/cache/cache_impl.hh @@ -170,7 +170,9 @@ Cache<TagStore>::satisfyCpuSideRequest(PacketPtr pkt, BlkType *blk, pkt->assertMemInhibit(); } // on ReadExReq we give up our copy unconditionally - tags->invalidateBlk(blk); + assert(blk != tempBlock); + tags->invalidate(blk); + blk->invalidate(); } else if (blk->isWritable() && !pending_downgrade && !pkt->sharedAsserted() && !pkt->req->isInstFetch()) { // we can give the requester an exclusive copy (by not @@ -210,7 +212,9 @@ Cache<TagStore>::satisfyCpuSideRequest(PacketPtr pkt, BlkType *blk, // to just ack those as long as we have an exclusive // copy at this level. assert(pkt->isUpgrade()); - tags->invalidateBlk(blk); + assert(blk != tempBlock); + tags->invalidate(blk); + blk->invalidate(); } } @@ -280,7 +284,8 @@ Cache<TagStore>::access(PacketPtr pkt, BlkType *&blk, } else if (pkt->isWrite()) { blk = tags->findBlock(pkt->getAddr()); if (blk != NULL) { - tags->invalidateBlk(blk); + tags->invalidate(blk); + blk->invalidate(); } } @@ -444,7 +449,8 @@ Cache<TagStore>::timingAccess(PacketPtr pkt) } else if (pkt->isWrite()) { BlkType *blk = tags->findBlock(pkt->getAddr()); if (blk != NULL) { - tags->invalidateBlk(blk); + tags->invalidate(blk); + blk->invalidate(); } } @@ -644,7 +650,8 @@ Cache<TagStore>::atomicAccess(PacketPtr pkt) if (pkt->isInvalidate()) { BlkType *blk = tags->findBlock(pkt->getAddr()); if (blk && blk->isValid()) { - tags->invalidateBlk(blk); + tags->invalidate(blk); + blk->invalidate(); DPRINTF(Cache, "rcvd mem-inhibited %s on 0x%x: invalidating\n", pkt->cmdString(), pkt->getAddr()); } @@ -953,9 +960,11 @@ Cache<TagStore>::handleResponse(PacketPtr pkt) mshr->popTarget(); } - if (blk) { + if (blk && blk->isValid()) { if (pkt->isInvalidate() || mshr->hasPostInvalidate()) { - tags->invalidateBlk(blk); + assert(blk != tempBlock); + tags->invalidate(blk); + blk->invalidate(); } else if (mshr->hasPostDowngrade()) { blk->status &= ~BlkWritable; } @@ -988,8 +997,7 @@ Cache<TagStore>::handleResponse(PacketPtr pkt) if (blk->isDirty()) { allocateWriteBuffer(writebackBlk(blk), time, true); } - blk->status &= ~BlkValid; - tags->invalidateBlk(blk); + blk->invalidate(); } delete pkt; @@ -1087,8 +1095,8 @@ Cache<TagStore>::handleFill(PacketPtr pkt, BlkType *blk, tags->insertBlock(pkt->getAddr(), blk, id); } - // starting from scratch with a new block - blk->status = 0; + // we should never be overwriting a valid block + assert(!blk->isValid()); } else { // existing block... probably an upgrade assert(blk->tag == tags->extractTag(addr)); @@ -1259,7 +1267,9 @@ Cache<TagStore>::handleSnoop(PacketPtr pkt, BlkType *blk, // Do this last in case it deallocates block data or something // like that if (invalidate) { - tags->invalidateBlk(blk); + assert(blk != tempBlock); + tags->invalidate(blk); + blk->invalidate(); } } |