- while (i != end && !done) {
- 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++;
- }
- assert(done);
-}
-
-void
-SimpleTimingPort::SendEvent::process()
-{
- assert(port->transmitList.size());
- assert(port->transmitList.front().first <= curTick);
- if (port->Port::sendTiming(port->transmitList.front().second)) {
- //send successful, remove packet
- port->transmitList.pop_front();
- if (!port->transmitList.empty()) {
- Tick time = port->transmitList.front().first;
- schedule(time <= curTick ? curTick+1 : time);
- }
- if (port->transmitList.empty() && port->drainEvent) {
- port->drainEvent->process();
- port->drainEvent = NULL;
- }
- return;
+ bool needsResponse = pkt->needsResponse();
+ Tick latency = recvAtomic(pkt);
+ // turn packet around to go back to requester if response expected
+ if (needsResponse) {
+ // recvAtomic() should already have turned packet into
+ // atomic response
+ assert(pkt->isResponse());
+ schedTimingResp(pkt, curTick() + latency);
+ } else {
+ // queue the packet for deletion
+ pendingDelete.reset(pkt);