summaryrefslogtreecommitdiff
path: root/src/mem/tport.cc
diff options
context:
space:
mode:
authorAli Saidi <saidi@eecs.umich.edu>2006-10-31 13:23:17 -0500
committerAli Saidi <saidi@eecs.umich.edu>2006-10-31 13:23:17 -0500
commitc68f7feaa8bcecaf28f4110fc98b5d57bc755061 (patch)
tree91da2494880b3336e231e661bb096e623d8cc58d /src/mem/tport.cc
parent697b432ba8103d4e05368194989636406d5b85d9 (diff)
downloadgem5-c68f7feaa8bcecaf28f4110fc98b5d57bc755061.tar.xz
add the ability to insert into the middle of the timing port send list
--HG-- extra : convert_revision : 5422025f74ba7013f98d1d1dcbd1070f580aae61
Diffstat (limited to 'src/mem/tport.cc')
-rw-r--r--src/mem/tport.cc21
1 files changed, 20 insertions, 1 deletions
diff --git a/src/mem/tport.cc b/src/mem/tport.cc
index b9d5cbe4a..086d91279 100644
--- a/src/mem/tport.cc
+++ b/src/mem/tport.cc
@@ -44,6 +44,7 @@ SimpleTimingPort::recvFunctional(PacketPtr pkt)
if (target->intersect(pkt))
done = fixPacket(pkt, target);
+ i++;
}
//Then just do an atomic access and throw away the returned latency
@@ -98,11 +99,29 @@ SimpleTimingPort::recvRetry()
void
SimpleTimingPort::sendTiming(PacketPtr pkt, Tick time)
{
+ // Nothing is on the list: add it and schedule an event
if (transmitList.empty()) {
assert(!sendEvent.scheduled());
sendEvent.schedule(curTick+time);
+ transmitList.push_back(std::pair<Tick,PacketPtr>(time+curTick,pkt));
+ return;
+ }
+
+ // something is on the list and this belongs at the end
+ if (time+curTick >= transmitList.back().first) {
+ transmitList.push_back(std::pair<Tick,PacketPtr>(time+curTick,pkt));
+ return;
+ }
+ // Something is on the list and this belongs somewhere else
+ std::list<std::pair<Tick,PacketPtr> >::iterator i = transmitList.begin();
+ std::list<std::pair<Tick,PacketPtr> >::iterator end = transmitList.end();
+ bool done = false;
+
+ while (i != end && !done) {
+ if (time+curTick < i->first)
+ transmitList.insert(i,std::pair<Tick,PacketPtr>(time+curTick,pkt));
+ i++;
}
- transmitList.push_back(std::pair<Tick,PacketPtr>(time+curTick,pkt));
}
void