diff options
author | Andreas Hansson <andreas.hansson@arm.com> | 2013-02-19 05:56:06 -0500 |
---|---|---|
committer | Andreas Hansson <andreas.hansson@arm.com> | 2013-02-19 05:56:06 -0500 |
commit | b3fc8839c4727da575ed916cbd6a76d8ad5fc644 (patch) | |
tree | 4a200b41d9d2c2222ca88d85af82dd17c330ea7f /src/mem/cache/cache_impl.hh | |
parent | 362160c8aeeb5b655158061ad57404124b4618f3 (diff) | |
download | gem5-b3fc8839c4727da575ed916cbd6a76d8ad5fc644.tar.xz |
mem: Make packet bus-related time accounting relative
This patch changes the bus-related time accounting done in the packet
to be relative. Besides making it easier to align the cache timing to
cache clock cycles, it also makes it possible to create a Last-Level
Cache (LLC) directly to a memory controller without a bus inbetween.
The bus is unique in that it does not ever make the packets wait to
reflect the time spent forwarding them. Instead, the cache is
currently responsible for making the packets wait. Thus, the bus
annotates the packets with the time needed for the first word to
appear, and also the last word. The cache then delays the packets in
its queues before passing them on. It is worth noting that every
object attached to a bus (devices, memories, bridges, etc) should be
doing this if we opt for keeping this way of accounting for the bus
timing.
Diffstat (limited to 'src/mem/cache/cache_impl.hh')
-rw-r--r-- | src/mem/cache/cache_impl.hh | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/src/mem/cache/cache_impl.hh b/src/mem/cache/cache_impl.hh index a7e6a6186..7aa922055 100644 --- a/src/mem/cache/cache_impl.hh +++ b/src/mem/cache/cache_impl.hh @@ -898,8 +898,9 @@ Cache<TagStore>::handleResponse(PacketPtr pkt) // responseLatency is the latency of the return path // from lower level caches/memory to an upper level cache or // the core. - completion_time = responseLatency * clockPeriod() + - (transfer_offset ? pkt->finishTime : pkt->firstWordTime); + completion_time = curTick() + responseLatency * clockPeriod() + + (transfer_offset ? pkt->busLastWordDelay : + pkt->busFirstWordDelay); assert(!target->pkt->req->isUncacheable()); @@ -914,15 +915,15 @@ Cache<TagStore>::handleResponse(PacketPtr pkt) // responseLatency is the latency of the return path // from lower level caches/memory to an upper level cache or // the core. - completion_time = responseLatency * clockPeriod() + - pkt->finishTime; + completion_time = curTick() + responseLatency * clockPeriod() + + pkt->busLastWordDelay; target->pkt->req->setExtraData(0); } else { // not a cache fill, just forwarding response // responseLatency is the latency of the return path // from lower level cahces/memory to the core. - completion_time = responseLatency * clockPeriod() + - pkt->finishTime; + completion_time = curTick() + responseLatency * clockPeriod() + + pkt->busLastWordDelay; if (pkt->isRead() && !is_error) { target->pkt->setData(pkt->getPtr<uint8_t>()); } @@ -984,7 +985,8 @@ Cache<TagStore>::handleResponse(PacketPtr pkt) } MSHRQueue *mq = mshr->queue; mq->markPending(mshr); - requestMemSideBus((RequestCause)mq->index, pkt->finishTime); + requestMemSideBus((RequestCause)mq->index, curTick() + + pkt->busLastWordDelay); } else { mq->deallocate(mshr); if (wasFull && !mq->isFull()) { @@ -1217,7 +1219,7 @@ Cache<TagStore>::handleFill(PacketPtr pkt, BlkType *blk, std::memcpy(blk->data, pkt->getPtr<uint8_t>(), blkSize); } - blk->whenReady = pkt->finishTime; + blk->whenReady = curTick() + pkt->busLastWordDelay; return blk; } @@ -1575,7 +1577,7 @@ Cache<TagStore>::getTimingPacket() pkt = new Packet(tgt_pkt); pkt->cmd = MemCmd::UpgradeFailResp; pkt->senderState = mshr; - pkt->firstWordTime = pkt->finishTime = curTick(); + pkt->busFirstWordDelay = pkt->busLastWordDelay = 0; handleResponse(pkt); return NULL; } else if (mshr->isForwardNoResponse()) { |