From f012166bb600ebaeefa48e74f7dd7fdfc9742506 Mon Sep 17 00:00:00 2001 From: Andreas Hansson Date: Tue, 2 Dec 2014 06:07:52 -0500 Subject: mem: Cleanup Packet::checkFunctional and hasData usage This patch cleans up the use of hasData and checkFunctional in the packet. The hasData function is unfortunately suggesting that it checks if the packet has a valid data pointer, when it does in fact only check if the specific packet type is specified to have a data payload. The confusion led to a bug in checkFunctional. The latter function is also tidied up to avoid name overloading. --- src/mem/cache/cache_impl.hh | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src/mem/cache/cache_impl.hh') diff --git a/src/mem/cache/cache_impl.hh b/src/mem/cache/cache_impl.hh index 8e8079d58..296f31ebd 100644 --- a/src/mem/cache/cache_impl.hh +++ b/src/mem/cache/cache_impl.hh @@ -1481,6 +1481,10 @@ Cache::handleFill(PacketPtr pkt, BlkType *blk, if (blk == NULL) { // better have read new data... assert(pkt->hasData()); + + // only read reaponses have data + assert(pkt->isRead()); + // need to do a replacement blk = allocateBlock(addr, is_secure, writebacks); if (blk == NULL) { @@ -1538,8 +1542,10 @@ Cache::handleFill(PacketPtr pkt, BlkType *blk, DPRINTF(Cache, "Block addr %x (%s) moving from state %x to %s\n", addr, is_secure ? "s" : "ns", old_state, blk->print()); - // if we got new data, copy it in + // if we got new data, copy it in (checking for a read response + // and a response that has data is the same in the end) if (pkt->isRead()) { + assert(pkt->hasData()); std::memcpy(blk->data, pkt->getConstPtr(), blkSize); } -- cgit v1.2.3