diff --git a/src/mem/cache/mshr.hh b/src/mem/cache/mshr.hh index 56b81b6b23..b94dfb9c53 100644 --- a/src/mem/cache/mshr.hh +++ b/src/mem/cache/mshr.hh @@ -513,6 +513,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. */ diff --git a/src/mem/cache/mshr_queue.cc b/src/mem/cache/mshr_queue.cc index e44a21954b..f4b80540c7 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 @@ -84,6 +84,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) { diff --git a/src/mem/cache/mshr_queue.hh b/src/mem/cache/mshr_queue.hh index 1b960a5a20..1e4eaeb514 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 @@ -106,6 +106,15 @@ class MSHRQueue : public Queue */ 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.