bool done = false;
while (i != end && !done) {
- if (time < i->first)
+ if (time < i->first) {
+ if (i == cpuSidePort->transmitList.begin()) {
+ //Inserting at begining, reschedule
+ sendEvent->reschedule(time);
+ }
cpuSidePort->transmitList.insert(i,std::pair<Tick,PacketPtr>
(time,pkt));
+ done = true;
+ }
i++;
}
}
bool done = false;
while (i != end && !done) {
- if (time < i->first)
+ if (time < i->first) {
+ if (i == cpuSidePort->transmitList.begin()) {
+ //Inserting at begining, reschedule
+ sendEvent->reschedule(time);
+ }
cpuSidePort->transmitList.insert(i,std::pair<Tick,PacketPtr>
(time,pkt));
+ done = true;
+ }
i++;
}
}
bool done = false;
while (i != end && !done) {
- if (time < i->first)
- memSidePort->transmitList.insert(i,std::pair<Tick,PacketPtr>(time,pkt));
+ if (time < i->first) {
+ if (i == memSidePort->transmitList.begin()) {
+ //Inserting at begining, reschedule
+ memSendEvent->reschedule(time);
+ }
+ memSidePort->transmitList.insert(i,std::pair<Tick,PacketPtr>(time,pkt));
+ done = true;
+ }
i++;
}
}
bool done = false;
while (i != end && !done) {
- if (time+curTick < i->first)
+ if (time+curTick < i->first) {
+ if (i == transmitList.begin()) {
+ //Inserting at begining, reschedule
+ sendEvent.reschedule(time+curTick);
+ }
transmitList.insert(i,std::pair<Tick,PacketPtr>(time+curTick,pkt));
+ done = true;
+ }
i++;
}
}