port.hh (8922:17f037ad8918) port.hh (8948:e95ee70f876c)
1/*
2 * Copyright (c) 2011-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

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

110 /** Return port name (for DPRINTF). */
111 const std::string name() const { return portName; }
112
113 protected:
114
115 /** These functions are protected because they should only be
116 * called by a peer port, never directly by any outside object. */
117
1/*
2 * Copyright (c) 2011-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

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

110 /** Return port name (for DPRINTF). */
111 const std::string name() const { return portName; }
112
113 protected:
114
115 /** These functions are protected because they should only be
116 * called by a peer port, never directly by any outside object. */
117
118 /** Called to recive a timing call from the peer port. */
118 /**
119 * Receive a timing request or response packet from the peer port.
120 */
119 virtual bool recvTiming(PacketPtr pkt) = 0;
120
121 virtual bool recvTiming(PacketPtr pkt) = 0;
122
121 /** Called to recive a atomic call from the peer port. */
122 virtual Tick recvAtomic(PacketPtr pkt) = 0;
123 /**
124 * Receive a timing snoop request or snoop response packet from
125 * the peer port.
126 */
127 virtual bool recvTimingSnoop(PacketPtr pkt)
128 {
129 panic("%s was not expecting a timing snoop\n", name());
130 return false;
131 }
123
132
124 /** Called to recive a functional call from the peer port. */
125 virtual void recvFunctional(PacketPtr pkt) = 0;
126
127 /**
133 /**
128 * Called by a peer port if sendTiming was unsuccesful, and had to
129 * wait.
134 * Called by a peer port if sendTiming or sendTimingSnoop was
135 * unsuccesful, and had to wait.
130 */
131 virtual void recvRetry() = 0;
132
133 public:
134
135 /**
136 */
137 virtual void recvRetry() = 0;
138
139 public:
140
141 /**
136 * Attempt to send a timing packet to the peer port by calling its
137 * receive function. If the send does not succeed, as indicated by
138 * the return value, then the sender must wait for a recvRetry at
139 * which point it can re-issue a sendTiming.
142 * Attempt to send a timing request or response packet to the peer
143 * port by calling its receive function. If the send does not
144 * succeed, as indicated by the return value, then the sender must
145 * wait for a recvRetry at which point it can re-issue a
146 * sendTiming.
140 *
141 * @param pkt Packet to send.
142 *
143 * @return If the send was succesful or not.
144 */
145 bool sendTiming(PacketPtr pkt) { return peer->recvTiming(pkt); }
146
147 /**
147 *
148 * @param pkt Packet to send.
149 *
150 * @return If the send was succesful or not.
151 */
152 bool sendTiming(PacketPtr pkt) { return peer->recvTiming(pkt); }
153
154 /**
148 * Send a retry to a peer port that previously attempted a sendTiming
149 * which was unsuccessful.
150 */
151 void sendRetry() { return peer->recvRetry(); }
152
153 /**
154 * Send an atomic packet, where the data is moved and the state
155 * is updated in zero time, without interleaving with other
156 * memory accesses.
155 * Attempt to send a timing snoop request or snoop response packet
156 * to the peer port by calling its receive function. If the send
157 * does not succeed, as indicated by the return value, then the
158 * sender must wait for a recvRetry at which point it can re-issue
159 * a sendTimingSnoop.
157 *
158 * @param pkt Packet to send.
159 *
160 *
161 * @param pkt Packet to send.
162 *
160 * @return Estimated latency of access.
161 */
162 Tick sendAtomic(PacketPtr pkt) { return peer->recvAtomic(pkt); }
163 * @return If the send was succesful or not.
164 */
165 bool sendTimingSnoop(PacketPtr pkt) { return peer->recvTimingSnoop(pkt); }
163
164 /**
166
167 /**
165 * Send a functional packet, where the data is instantly updated
166 * everywhere in the memory system, without affecting the current
167 * state of any block or moving the block.
168 *
169 * @param pkt Packet to send.
168 * Send a retry to a peer port that previously attempted a
169 * sendTiming or sendTimingSnoop which was unsuccessful.
170 */
170 */
171 void sendFunctional(PacketPtr pkt) { return peer->recvFunctional(pkt); }
171 void sendRetry() { return peer->recvRetry(); }
172
173};
174
175/** Forward declaration */
176class SlavePort;
177
178/**
179 * A MasterPort is a specialisation of a port. In addition to the

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

193 MasterPort(const std::string& name, MemObject* owner);
194 virtual ~MasterPort();
195
196 void bind(SlavePort& slave_port);
197 SlavePort& getSlavePort() const;
198 bool isConnected() const;
199
200 /**
172
173};
174
175/** Forward declaration */
176class SlavePort;
177
178/**
179 * A MasterPort is a specialisation of a port. In addition to the

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

193 MasterPort(const std::string& name, MemObject* owner);
194 virtual ~MasterPort();
195
196 void bind(SlavePort& slave_port);
197 SlavePort& getSlavePort() const;
198 bool isConnected() const;
199
200 /**
201 * Send an atomic request packet, where the data is moved and the
202 * state is updated in zero time, without interleaving with other
203 * memory accesses.
204 *
205 * @param pkt Packet to send.
206 *
207 * @return Estimated latency of access.
208 */
209 Tick sendAtomic(PacketPtr pkt);
210
211 /**
212 * Send a functional request packet, where the data is instantly
213 * updated everywhere in the memory system, without affecting the
214 * current state of any block or moving the block.
215 *
216 * @param pkt Packet to send.
217 */
218 void sendFunctional(PacketPtr pkt);
219
220 /**
221 * Receive an atomic snoop request packet from the slave port.
222 */
223 virtual Tick recvAtomicSnoop(PacketPtr pkt)
224 {
225 panic("%s was not expecting an atomic snoop\n", name());
226 return 0;
227 }
228
229 /**
230 * Receive a functional snoop request packet from the slave port.
231 */
232 virtual void recvFunctionalSnoop(PacketPtr pkt)
233 {
234 panic("%s was not expecting a functional snoop\n", name());
235 }
236
237 /**
201 * Called to receive an address range change from the peer slave
202 * port. the default implementation ignored the change and does
203 * nothing. Override this function in a derived class if the owner
204 * needs to be aware of he laesddress ranges, e.g. in an
205 * interconnect component like a bus.
206 */
207 virtual void recvRangeChange() { }
208

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

252 SlavePort(const std::string& name, MemObject* owner);
253 virtual ~SlavePort();
254
255 void bind(MasterPort& master_port);
256 MasterPort& getMasterPort() const;
257 bool isConnected() const;
258
259 /**
238 * Called to receive an address range change from the peer slave
239 * port. the default implementation ignored the change and does
240 * nothing. Override this function in a derived class if the owner
241 * needs to be aware of he laesddress ranges, e.g. in an
242 * interconnect component like a bus.
243 */
244 virtual void recvRangeChange() { }
245

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

289 SlavePort(const std::string& name, MemObject* owner);
290 virtual ~SlavePort();
291
292 void bind(MasterPort& master_port);
293 MasterPort& getMasterPort() const;
294 bool isConnected() const;
295
296 /**
297 * Send an atomic snoop request packet, where the data is moved
298 * and the state is updated in zero time, without interleaving
299 * with other memory accesses.
300 *
301 * @param pkt Snoop packet to send.
302 *
303 * @return Estimated latency of access.
304 */
305 Tick sendAtomicSnoop(PacketPtr pkt);
306
307 /**
308 * Send a functional snoop request packet, where the data is
309 * instantly updated everywhere in the memory system, without
310 * affecting the current state of any block or moving the block.
311 *
312 * @param pkt Snoop packet to send.
313 */
314 void sendFunctionalSnoop(PacketPtr pkt);
315
316 /**
317 * Receive an atomic request packet from the master port.
318 */
319 virtual Tick recvAtomic(PacketPtr pkt) = 0;
320
321 /**
322 * Receive a functional request packet from the master port.
323 */
324 virtual void recvFunctional(PacketPtr pkt) = 0;
325
326 /**
260 * Called by a peer port in order to determine the block size of
261 * the owner of this port.
262 */
263 virtual unsigned deviceBlockSize() const { return 0; }
264
265 /** Called by the associated device if it wishes to find out the blocksize
266 of the device on attached to the peer port.
267 */

--- 18 unchanged lines hidden ---
327 * Called by a peer port in order to determine the block size of
328 * the owner of this port.
329 */
330 virtual unsigned deviceBlockSize() const { return 0; }
331
332 /** Called by the associated device if it wishes to find out the blocksize
333 of the device on attached to the peer port.
334 */

--- 18 unchanged lines hidden ---