tport.cc (8232:b28d06a175be) tport.cc (8708:7ccbdea0fa12)
1/*
2 * Copyright (c) 2006 The Regents of The University of Michigan
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are
7 * met: redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer;

--- 15 unchanged lines hidden (view full) ---

24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 *
28 * Authors: Ali Saidi
29 */
30
31#include "debug/Bus.hh"
1/*
2 * Copyright (c) 2006 The Regents of The University of Michigan
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are
7 * met: redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer;

--- 15 unchanged lines hidden (view full) ---

24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 *
28 * Authors: Ali Saidi
29 */
30
31#include "debug/Bus.hh"
32#include "mem/mem_object.hh"
32#include "mem/tport.hh"
33
34using namespace std;
35
36SimpleTimingPort::SimpleTimingPort(string pname, MemObject *_owner)
33#include "mem/tport.hh"
34
35using namespace std;
36
37SimpleTimingPort::SimpleTimingPort(string pname, MemObject *_owner)
37 : Port(pname, _owner), sendEvent(0), drainEvent(NULL),
38 : Port(pname, _owner), sendEvent(NULL), drainEvent(NULL),
38 waitingOnRetry(false)
39{
40 sendEvent = new EventWrapper<SimpleTimingPort,
41 &SimpleTimingPort::processSendEvent>(this);
42}
43
44SimpleTimingPort::~SimpleTimingPort()
45{

--- 53 unchanged lines hidden (view full) ---

99 schedSendTiming(pkt, curTick() + latency);
100 } else {
101 delete pkt;
102 }
103
104 return true;
105}
106
39 waitingOnRetry(false)
40{
41 sendEvent = new EventWrapper<SimpleTimingPort,
42 &SimpleTimingPort::processSendEvent>(this);
43}
44
45SimpleTimingPort::~SimpleTimingPort()
46{

--- 53 unchanged lines hidden (view full) ---

100 schedSendTiming(pkt, curTick() + latency);
101 } else {
102 delete pkt;
103 }
104
105 return true;
106}
107
108void
109SimpleTimingPort::schedSendEvent(Tick when)
110{
111 if (waitingOnRetry) {
112 assert(!sendEvent->scheduled());
113 return;
114 }
107
115
116 if (!sendEvent->scheduled()) {
117 owner->schedule(sendEvent, when);
118 } else if (sendEvent->when() > when) {
119 owner->reschedule(sendEvent, when);
120 }
121}
122
108void
109SimpleTimingPort::schedSendTiming(PacketPtr pkt, Tick when)
110{
111 assert(when > curTick());
112 assert(when < curTick() + SimClock::Int::ms);
113
114 // Nothing is on the list: add it and schedule an event
115 if (transmitList.empty() || when < transmitList.front().tick) {

--- 32 unchanged lines hidden (view full) ---

148 // we get confused by having a non-active packet on transmitList
149 DeferredPacket dp = transmitList.front();
150 transmitList.pop_front();
151 bool success = sendTiming(dp.pkt);
152
153 if (success) {
154 if (!transmitList.empty() && !sendEvent->scheduled()) {
155 Tick time = transmitList.front().tick;
123void
124SimpleTimingPort::schedSendTiming(PacketPtr pkt, Tick when)
125{
126 assert(when > curTick());
127 assert(when < curTick() + SimClock::Int::ms);
128
129 // Nothing is on the list: add it and schedule an event
130 if (transmitList.empty() || when < transmitList.front().tick) {

--- 32 unchanged lines hidden (view full) ---

163 // we get confused by having a non-active packet on transmitList
164 DeferredPacket dp = transmitList.front();
165 transmitList.pop_front();
166 bool success = sendTiming(dp.pkt);
167
168 if (success) {
169 if (!transmitList.empty() && !sendEvent->scheduled()) {
170 Tick time = transmitList.front().tick;
156 schedule(sendEvent, time <= curTick() ? curTick()+1 : time);
171 owner->schedule(sendEvent, time <= curTick() ? curTick()+1 : time);
157 }
158
159 if (transmitList.empty() && drainEvent && !sendEvent->scheduled()) {
160 drainEvent->process();
161 drainEvent = NULL;
162 }
163 } else {
164 // Unsuccessful, need to put back on transmitList. Callee

--- 39 unchanged lines hidden ---
172 }
173
174 if (transmitList.empty() && drainEvent && !sendEvent->scheduled()) {
175 drainEvent->process();
176 drainEvent = NULL;
177 }
178 } else {
179 // Unsuccessful, need to put back on transmitList. Callee

--- 39 unchanged lines hidden ---