tport.hh (8711:c7e14f52c682) tport.hh (8856:241ee47b0dc6)
1/*
1/*
2 * Copyright (c) 2012 ARM Limited
3 * All rights reserved.
4 *
5 * The license below extends only to copyright in the software and shall
6 * not be construed as granting a license to any other intellectual
7 * property including but not limited to intellectual property relating
8 * to a hardware implementation of the functionality of the software
9 * licensed hereunder. You may use the software subject to the license
10 * terms below provided that you ensure that this notice is replicated
11 * unmodified and in its entirety in all distributions of the software,
12 * modified or unmodified, in source code or in binary form.
13 *
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;
9 * redistributions in binary form must reproduce the above copyright

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

21 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
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
14 * Copyright (c) 2006 The Regents of The University of Michigan
15 * All rights reserved.
16 *
17 * Redistribution and use in source and binary forms, with or without
18 * modification, are permitted provided that the following conditions are
19 * met: redistributions of source code must retain the above copyright
20 * notice, this list of conditions and the following disclaimer;
21 * redistributions in binary form must reproduce the above copyright

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

33 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
34 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
35 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
36 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
37 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
38 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
39 *
40 * Authors: Ali Saidi
41 * Andreas Hansson
29 */
30
31#ifndef __MEM_TPORT_HH__
32#define __MEM_TPORT_HH__
33
34/**
35 * @file
36 *

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

71
72 typedef std::list<DeferredPacket> DeferredPacketList;
73 typedef std::list<DeferredPacket>::iterator DeferredPacketIterator;
74
75 /** A list of outgoing timing response packets that haven't been
76 * serviced yet. */
77 DeferredPacketList transmitList;
78
42 */
43
44#ifndef __MEM_TPORT_HH__
45#define __MEM_TPORT_HH__
46
47/**
48 * @file
49 *

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

84
85 typedef std::list<DeferredPacket> DeferredPacketList;
86 typedef std::list<DeferredPacket>::iterator DeferredPacketIterator;
87
88 /** A list of outgoing timing response packets that haven't been
89 * serviced yet. */
90 DeferredPacketList transmitList;
91
92 /** Label to use for print request packets label stack. */
93 const std::string label;
94
79 /** This function attempts to send deferred packets. Scheduled to
80 * be called in the future via SendEvent. */
81 void processSendEvent();
82
83 /**
84 * This class is used to implemented sendTiming() with a delay. When
85 * a delay is requested a the event is scheduled if it isn't already.
86 * When the event time expires it attempts to send the packet.
87 * If it cannot, the packet sent when recvRetry() is called.
88 **/
95 /** This function attempts to send deferred packets. Scheduled to
96 * be called in the future via SendEvent. */
97 void processSendEvent();
98
99 /**
100 * This class is used to implemented sendTiming() with a delay. When
101 * a delay is requested a the event is scheduled if it isn't already.
102 * When the event time expires it attempts to send the packet.
103 * If it cannot, the packet sent when recvRetry() is called.
104 **/
89 Event *sendEvent;
105 EventWrapper<SimpleTimingPort,
106 &SimpleTimingPort::processSendEvent> sendEvent;
90
91 /** If we need to drain, keep the drain event around until we're done
92 * here.*/
93 Event *drainEvent;
94
95 /** Remember whether we're awaiting a retry from the bus. */
96 bool waitingOnRetry;
97
107
108 /** If we need to drain, keep the drain event around until we're done
109 * here.*/
110 Event *drainEvent;
111
112 /** Remember whether we're awaiting a retry from the bus. */
113 bool waitingOnRetry;
114
98 /** Check the list of buffered packets against the supplied
99 * functional request. */
100 bool checkFunctional(PacketPtr funcPkt);
101
102 /** Check whether we have a packet ready to go on the transmit list. */
103 bool deferredPacketReady()
104 { return !transmitList.empty() && transmitList.front().tick <= curTick(); }
105
106 Tick deferredPacketReadyTime()
107 { return transmitList.empty() ? MaxTick : transmitList.front().tick; }
108
109 /**

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

121 */
122 void schedSendTiming(PacketPtr pkt, Tick when);
123
124 /** Attempt to send the packet at the head of the deferred packet
125 * list. Caller must guarantee that the deferred packet list is
126 * non-empty and that the head packet is scheduled for curTick() (or
127 * earlier).
128 */
115 /** Check whether we have a packet ready to go on the transmit list. */
116 bool deferredPacketReady()
117 { return !transmitList.empty() && transmitList.front().tick <= curTick(); }
118
119 Tick deferredPacketReadyTime()
120 { return transmitList.empty() ? MaxTick : transmitList.front().tick; }
121
122 /**

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

134 */
135 void schedSendTiming(PacketPtr pkt, Tick when);
136
137 /** Attempt to send the packet at the head of the deferred packet
138 * list. Caller must guarantee that the deferred packet list is
139 * non-empty and that the head packet is scheduled for curTick() (or
140 * earlier).
141 */
129 void sendDeferredPacket();
142 virtual void sendDeferredPacket();
130
143
144 /**
145 * Attempt to send the packet at the front of the transmit list,
146 * and set waitingOnRetry accordingly. The packet is temporarily
147 * taken off the list, but put back at the front if not
148 * successfully sent.
149 */
150 void trySendTiming();
151
152 /**
153 * Based on the transmit list, or the provided time, schedule a
154 * send event if there are packets to send. If we are idle and
155 * asked to drain then do so.
156 *
157 * @param time an alternative time for the next send event
158 */
159 void scheduleSend(Tick time = MaxTick);
160
131 /** This function is notification that the device should attempt to send a
132 * packet again. */
133 virtual void recvRetry();
134
135 /** Implemented using recvAtomic(). */
136 void recvFunctional(PacketPtr pkt);
137
138 /** Implemented using recvAtomic(). */

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

144 * range changes (as the neighbouring port has a master role and
145 * do not have any address ranges. A subclass can override the
146 * default behaviuor if needed.
147 */
148 virtual void recvRangeChange() { }
149
150
151 public:
161 /** This function is notification that the device should attempt to send a
162 * packet again. */
163 virtual void recvRetry();
164
165 /** Implemented using recvAtomic(). */
166 void recvFunctional(PacketPtr pkt);
167
168 /** Implemented using recvAtomic(). */

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

174 * range changes (as the neighbouring port has a master role and
175 * do not have any address ranges. A subclass can override the
176 * default behaviuor if needed.
177 */
178 virtual void recvRangeChange() { }
179
180
181 public:
152 SimpleTimingPort(std::string pname, MemObject *_owner);
182 SimpleTimingPort(const std::string &_name, MemObject *_owner,
183 const std::string _label = "SimpleTimingPort");
153 ~SimpleTimingPort();
154
184 ~SimpleTimingPort();
185
186 /** Check the list of buffered packets against the supplied
187 * functional request. */
188 bool checkFunctional(PacketPtr pkt);
189
155 /** Hook for draining timing accesses from the system. The
156 * associated SimObject's drain() functions should be implemented
157 * something like this when this class is used:
158 \code
159 PioDevice::drain(Event *de)
160 {
161 unsigned int count;
162 count = SimpleTimingPort->drain(de);

--- 12 unchanged lines hidden ---
190 /** Hook for draining timing accesses from the system. The
191 * associated SimObject's drain() functions should be implemented
192 * something like this when this class is used:
193 \code
194 PioDevice::drain(Event *de)
195 {
196 unsigned int count;
197 count = SimpleTimingPort->drain(de);

--- 12 unchanged lines hidden ---