port.hh (9031:32ecc0217c5e) port.hh (9087:b5a084a6159b)
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

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

65typedef std::list<Range<Addr> > AddrRangeList;
66typedef std::list<Range<Addr> >::iterator AddrRangeIter;
67
68class MemObject;
69
70/**
71 * Ports are used to interface memory objects to each other. A port is
72 * either a master or a slave and the connected peer is always of the
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

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

65typedef std::list<Range<Addr> > AddrRangeList;
66typedef std::list<Range<Addr> >::iterator AddrRangeIter;
67
68class MemObject;
69
70/**
71 * Ports are used to interface memory objects to each other. A port is
72 * either a master or a slave and the connected peer is always of the
73 * opposite role.
74 *
75 * Each port has a name and an owner, and enables three basic types of
76 * accesses to the peer port: functional, atomic and timing.
73 * opposite role. Each port has a name, an owner, and an identifier.
77 */
78class Port
79{
80
81 private:
82
83 /** Descriptive name (for DPRINTF output) */
84 std::string portName;
85
86 protected:
87
88 /**
89 * A numeric identifier to distinguish ports in a vector, and set
90 * to InvalidPortID in case this port is not part of a vector.
91 */
92 const PortID id;
93
74 */
75class Port
76{
77
78 private:
79
80 /** Descriptive name (for DPRINTF output) */
81 std::string portName;
82
83 protected:
84
85 /**
86 * A numeric identifier to distinguish ports in a vector, and set
87 * to InvalidPortID in case this port is not part of a vector.
88 */
89 const PortID id;
90
94 /** A pointer to the peer port. */
95 Port* peer;
96
97 /** A reference to the MemObject that owns this port. */
98 MemObject& owner;
99
100 /**
101 * Abstract base class for ports
102 *
103 * @param _name Port name including the owners name
104 * @param _owner The MemObject that is the structural owner of this port

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

114 public:
115
116 /** Return port name (for DPRINTF). */
117 const std::string name() const { return portName; }
118
119 /** Get the port id. */
120 PortID getId() const { return id; }
121
91 /** A reference to the MemObject that owns this port. */
92 MemObject& owner;
93
94 /**
95 * Abstract base class for ports
96 *
97 * @param _name Port name including the owners name
98 * @param _owner The MemObject that is the structural owner of this port

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

108 public:
109
110 /** Return port name (for DPRINTF). */
111 const std::string name() const { return portName; }
112
113 /** Get the port id. */
114 PortID getId() const { return id; }
115
122 protected:
123
124 /**
125 * Called by a peer port if sendTimingReq, sendTimingResp or
126 * sendTimingSnoopResp was unsuccesful, and had to wait.
127 */
128 virtual void recvRetry() = 0;
129
130 public:
131
132 /**
133 * Send a retry to a peer port that previously attempted a
134 * sendTimingReq, sendTimingResp or sendTimingSnoopResp which was
135 * unsuccessful.
136 */
137 void sendRetry() { return peer->recvRetry(); }
138
139};
140
141/** Forward declaration */
142class SlavePort;
143
144/**
145 * A MasterPort is a specialisation of a port. In addition to the
146 * basic functionality of sending packets to its slave peer, it also

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

206 * sender must wait for a recvRetry at which point it can re-issue
207 * a sendTimingSnoopResp.
208 *
209 * @param pkt Packet to send.
210 */
211 bool sendTimingSnoopResp(PacketPtr pkt);
212
213 /**
116};
117
118/** Forward declaration */
119class SlavePort;
120
121/**
122 * A MasterPort is a specialisation of a port. In addition to the
123 * basic functionality of sending packets to its slave peer, it also

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

183 * sender must wait for a recvRetry at which point it can re-issue
184 * a sendTimingSnoopResp.
185 *
186 * @param pkt Packet to send.
187 */
188 bool sendTimingSnoopResp(PacketPtr pkt);
189
190 /**
191 * Send a retry to the slave port that previously attempted a
192 * sendTimingResp to this master port and failed.
193 */
194 void sendRetry();
195
196 /**
214 * Determine if this master port is snooping or not. The default
215 * implementation returns false and thus tells the neighbour we
216 * are not snooping. Any master port that wants to receive snoop
217 * requests (e.g. a cache connected to a bus) has to override this
218 * function.
219 *
220 * @return true if the port should be considered a snooper
221 */

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

265 * Receive a timing snoop request from the slave port.
266 */
267 virtual void recvTimingSnoopReq(PacketPtr pkt)
268 {
269 panic("%s was not expecting a timing snoop request\n", name());
270 }
271
272 /**
197 * Determine if this master port is snooping or not. The default
198 * implementation returns false and thus tells the neighbour we
199 * are not snooping. Any master port that wants to receive snoop
200 * requests (e.g. a cache connected to a bus) has to override this
201 * function.
202 *
203 * @return true if the port should be considered a snooper
204 */

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

248 * Receive a timing snoop request from the slave port.
249 */
250 virtual void recvTimingSnoopReq(PacketPtr pkt)
251 {
252 panic("%s was not expecting a timing snoop request\n", name());
253 }
254
255 /**
256 * Called by the slave port if sendTimingReq or
257 * sendTimingSnoopResp was called on this master port (causing
258 * recvTimingReq and recvTimingSnoopResp to be called on the
259 * slave port) and was unsuccesful.
260 */
261 virtual void recvRetry() = 0;
262
263 /**
273 * Called to receive an address range change from the peer slave
274 * port. the default implementation ignored the change and does
275 * nothing. Override this function in a derived class if the owner
276 * needs to be aware of he laesddress ranges, e.g. in an
277 * interconnect component like a bus.
278 */
279 virtual void recvRangeChange() { }
280};

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

342 * by calling its corresponding receive function. Snoop requests
343 * always succeed and hence no return value is needed.
344 *
345 * @param pkt Packet to send.
346 */
347 void sendTimingSnoopReq(PacketPtr pkt);
348
349 /**
264 * Called to receive an address range change from the peer slave
265 * port. the default implementation ignored the change and does
266 * nothing. Override this function in a derived class if the owner
267 * needs to be aware of he laesddress ranges, e.g. in an
268 * interconnect component like a bus.
269 */
270 virtual void recvRangeChange() { }
271};

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

333 * by calling its corresponding receive function. Snoop requests
334 * always succeed and hence no return value is needed.
335 *
336 * @param pkt Packet to send.
337 */
338 void sendTimingSnoopReq(PacketPtr pkt);
339
340 /**
341 * Send a retry to the master port that previously attempted a
342 * sendTimingReq or sendTimingSnoopResp to this slave port and
343 * failed.
344 */
345 void sendRetry();
346
347 /**
350 * Called by a peer port in order to determine the block size of
351 * the owner of this port.
352 */
353 virtual unsigned deviceBlockSize() const { return 0; }
354
355 /** Called by the associated device if it wishes to find out the blocksize
356 of the device on attached to the peer port.
357 */

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

391 /**
392 * Receive a timing snoop response from the master port.
393 */
394 virtual bool recvTimingSnoopResp(PacketPtr pkt)
395 {
396 panic("%s was not expecting a timing snoop response\n", name());
397 }
398
348 * Called by a peer port in order to determine the block size of
349 * the owner of this port.
350 */
351 virtual unsigned deviceBlockSize() const { return 0; }
352
353 /** Called by the associated device if it wishes to find out the blocksize
354 of the device on attached to the peer port.
355 */

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

389 /**
390 * Receive a timing snoop response from the master port.
391 */
392 virtual bool recvTimingSnoopResp(PacketPtr pkt)
393 {
394 panic("%s was not expecting a timing snoop response\n", name());
395 }
396
397 /**
398 * Called by the master port if sendTimingResp was called on this
399 * slave port (causing recvTimingResp to be called on the master
400 * port) and was unsuccesful.
401 */
402 virtual void recvRetry() = 0;
403
399};
400
401#endif //__MEM_PORT_HH__
404};
405
406#endif //__MEM_PORT_HH__