diff options
author | Nikos Nikoleris <nikos.nikoleris@arm.com> | 2016-10-10 13:48:08 +0100 |
---|---|---|
committer | Nikos Nikoleris <nikos.nikoleris@arm.com> | 2018-10-18 09:40:05 +0000 |
commit | bf305c14c47c4bd228c0910ea3bb30ab4bc935e1 (patch) | |
tree | 0effb6c54e8e8206c4f549cc78eba9d05bdd4765 | |
parent | e57d8f2d897bc26aade774e090842367e38e974b (diff) | |
download | gem5-bf305c14c47c4bd228c0910ea3bb30ab4bc935e1.tar.xz |
mem: Delay servicing an MSHR after its allocation
An MSHR is allocated and the computed latency determines when the MSHR
will be ready and can be serviced by the cache. This patch adds a
function that allows changing the time that an MSHR is ready and
adjusts the queue such that other MSHRs can be serviced first if they
are ready.
Change-Id: Ie908191fcb3c2d84d4c6f855c8b1e41ca5881bff
Reviewed-on: https://gem5-review.googlesource.com/c/12906
Reviewed-by: Daniel Carvalho <odanrc@yahoo.com.br>
Maintainer: Nikos Nikoleris <nikos.nikoleris@arm.com>
-rw-r--r-- | src/mem/cache/mshr.hh | 10 | ||||
-rw-r--r-- | src/mem/cache/mshr_queue.cc | 13 | ||||
-rw-r--r-- | src/mem/cache/mshr_queue.hh | 11 |
3 files changed, 32 insertions, 2 deletions
diff --git a/src/mem/cache/mshr.hh b/src/mem/cache/mshr.hh index 56b81b6b2..b94dfb9c5 100644 --- a/src/mem/cache/mshr.hh +++ b/src/mem/cache/mshr.hh @@ -514,6 +514,16 @@ class MSHR : public QueueEntry, public Printable bool trySatisfyFunctional(PacketPtr pkt); /** + * Adds a delay relative to the current tick to the current MSHR + * @param delay_ticks the desired delay in ticks + */ + void delay(Tick delay_ticks) + { + assert(readyTime <= curTick()); + readyTime = curTick() + delay_ticks; + } + + /** * Prints the contents of this MSHR for debugging. */ void print(std::ostream &os, diff --git a/src/mem/cache/mshr_queue.cc b/src/mem/cache/mshr_queue.cc index e44a21954..f4b80540c 100644 --- a/src/mem/cache/mshr_queue.cc +++ b/src/mem/cache/mshr_queue.cc @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012-2013, 2015-2016 ARM Limited + * Copyright (c) 2012-2013, 2015-2016, 2018 ARM Limited * All rights reserved. * * The license below extends only to copyright in the software and shall @@ -85,6 +85,17 @@ MSHRQueue::moveToFront(MSHR *mshr) } void +MSHRQueue::delay(MSHR *mshr, Tick delay_ticks) +{ + mshr->delay(delay_ticks); + auto it = std::find_if(mshr->readyIter, readyList.end(), + [mshr] (const MSHR* _mshr) { + return mshr->readyTime >= _mshr->readyTime; + }); + readyList.splice(it, readyList, mshr->readyIter); +} + +void MSHRQueue::markInService(MSHR *mshr, bool pending_modified_resp) { mshr->markInService(pending_modified_resp); diff --git a/src/mem/cache/mshr_queue.hh b/src/mem/cache/mshr_queue.hh index 1b960a5a2..1e4eaeb51 100644 --- a/src/mem/cache/mshr_queue.hh +++ b/src/mem/cache/mshr_queue.hh @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012-2013, 2015-2016 ARM Limited + * Copyright (c) 2012-2013, 2015-2016, 2018 ARM Limited * All rights reserved. * * The license below extends only to copyright in the software and shall @@ -107,6 +107,15 @@ class MSHRQueue : public Queue<MSHR> void moveToFront(MSHR *mshr); /** + * Adds a delay to the provided MSHR and moves MSHRs that will be + * ready earlier than this entry to the top of the list + * + * @param mshr that needs to be delayed + * @param delay_ticks ticks of the desired delay + */ + void delay(MSHR *mshr, Tick delay_ticks); + + /** * Mark the given MSHR as in service. This removes the MSHR from the * readyList or deallocates the MSHR if it does not expect a response. * |