port.hh (13771:10d990934f15) port.hh (13782:9f6654f478e2)
1/*
2 * Copyright (c) 2011-2012,2015,2017 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 *
14 * Copyright (c) 2002-2005 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
22 * notice, this list of conditions and the following disclaimer in the
23 * documentation and/or other materials provided with the distribution;
24 * neither the name of the copyright holders nor the names of its
25 * contributors may be used to endorse or promote products derived from
26 * this software without specific prior written permission.
27 *
28 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
29 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
30 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
31 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
32 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
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: Ron Dreslinski
41 * Andreas Hansson
42 * William Wang
43 */
44
45/**
46 * @file
47 * Port Object Declaration.
48 */
49
50#ifndef __MEM_PORT_HH__
51#define __MEM_PORT_HH__
52
53#include "base/addr_range.hh"
54#include "mem/packet.hh"
55#include "sim/port.hh"
56
57class MemObject;
58
59/** Forward declaration */
60class BaseSlavePort;
61
62/**
63 * A BaseMasterPort is a protocol-agnostic master port, responsible
64 * only for the structural connection to a slave port. The final
65 * master port that inherits from the base class must override the
66 * bind member function for the specific slave port class.
67 */
68class BaseMasterPort : public Port
69{
70
71 protected:
72
73 BaseSlavePort* _baseSlavePort;
74
75 BaseMasterPort(const std::string& name, PortID id=InvalidPortID);
76 virtual ~BaseMasterPort();
77
78 public:
79
1/*
2 * Copyright (c) 2011-2012,2015,2017 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 *
14 * Copyright (c) 2002-2005 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
22 * notice, this list of conditions and the following disclaimer in the
23 * documentation and/or other materials provided with the distribution;
24 * neither the name of the copyright holders nor the names of its
25 * contributors may be used to endorse or promote products derived from
26 * this software without specific prior written permission.
27 *
28 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
29 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
30 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
31 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
32 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
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: Ron Dreslinski
41 * Andreas Hansson
42 * William Wang
43 */
44
45/**
46 * @file
47 * Port Object Declaration.
48 */
49
50#ifndef __MEM_PORT_HH__
51#define __MEM_PORT_HH__
52
53#include "base/addr_range.hh"
54#include "mem/packet.hh"
55#include "sim/port.hh"
56
57class MemObject;
58
59/** Forward declaration */
60class BaseSlavePort;
61
62/**
63 * A BaseMasterPort is a protocol-agnostic master port, responsible
64 * only for the structural connection to a slave port. The final
65 * master port that inherits from the base class must override the
66 * bind member function for the specific slave port class.
67 */
68class BaseMasterPort : public Port
69{
70
71 protected:
72
73 BaseSlavePort* _baseSlavePort;
74
75 BaseMasterPort(const std::string& name, PortID id=InvalidPortID);
76 virtual ~BaseMasterPort();
77
78 public:
79
80 virtual void bind(BaseSlavePort& slave_port) = 0;
81 virtual void unbind() = 0;
82 BaseSlavePort& getSlavePort() const;
80 BaseSlavePort& getSlavePort() const;
83 bool isConnected() const;
84
85};
86
87/**
88 * A BaseSlavePort is a protocol-agnostic slave port, responsible
89 * only for the structural connection to a master port.
90 */
91class BaseSlavePort : public Port
92{
93
94 protected:
95
96 BaseMasterPort* _baseMasterPort;
97
98 BaseSlavePort(const std::string& name, PortID id=InvalidPortID);
99 virtual ~BaseSlavePort();
100
101 public:
102
103 BaseMasterPort& getMasterPort() const;
81
82};
83
84/**
85 * A BaseSlavePort is a protocol-agnostic slave port, responsible
86 * only for the structural connection to a master port.
87 */
88class BaseSlavePort : public Port
89{
90
91 protected:
92
93 BaseMasterPort* _baseMasterPort;
94
95 BaseSlavePort(const std::string& name, PortID id=InvalidPortID);
96 virtual ~BaseSlavePort();
97
98 public:
99
100 BaseMasterPort& getMasterPort() const;
104 bool isConnected() const;
105
106};
107
108/** Forward declaration */
109class SlavePort;
110
111/**
112 * A MasterPort is a specialisation of a BaseMasterPort, which
113 * implements the default protocol for the three different level of
114 * transport functions. In addition to the basic functionality of
115 * sending packets, it also has functions to receive range changes or
116 * determine if the port is snooping or not.
117 */
118class MasterPort : public BaseMasterPort
119{
120
121 friend class SlavePort;
122
123 private:
124
125 SlavePort* _slavePort;
126
127 protected:
128
129 MemObject& owner;
130
131 public:
132
133 MasterPort(const std::string& name, MemObject* _owner,
134 PortID id=InvalidPortID);
135 virtual ~MasterPort();
136
137 /**
138 * Bind this master port to a slave port. This also does the
139 * mirror action and binds the slave port to the master port.
140 */
101
102};
103
104/** Forward declaration */
105class SlavePort;
106
107/**
108 * A MasterPort is a specialisation of a BaseMasterPort, which
109 * implements the default protocol for the three different level of
110 * transport functions. In addition to the basic functionality of
111 * sending packets, it also has functions to receive range changes or
112 * determine if the port is snooping or not.
113 */
114class MasterPort : public BaseMasterPort
115{
116
117 friend class SlavePort;
118
119 private:
120
121 SlavePort* _slavePort;
122
123 protected:
124
125 MemObject& owner;
126
127 public:
128
129 MasterPort(const std::string& name, MemObject* _owner,
130 PortID id=InvalidPortID);
131 virtual ~MasterPort();
132
133 /**
134 * Bind this master port to a slave port. This also does the
135 * mirror action and binds the slave port to the master port.
136 */
141 void bind(BaseSlavePort& slave_port);
137 void bind(Port &peer) override;
142
143 /**
144 * Unbind this master port and the associated slave port.
145 */
138
139 /**
140 * Unbind this master port and the associated slave port.
141 */
146 void unbind();
142 void unbind() override;
147
148 /**
149 * Send an atomic request packet, where the data is moved and the
150 * state is updated in zero time, without interleaving with other
151 * memory accesses.
152 *
153 * @param pkt Packet to send.
154 *
155 * @return Estimated latency of access.
156 */
157 Tick sendAtomic(PacketPtr pkt);
158
159 /**
160 * Send a functional request packet, where the data is instantly
161 * updated everywhere in the memory system, without affecting the
162 * current state of any block or moving the block.
163 *
164 * @param pkt Packet to send.
165 */
166 void sendFunctional(PacketPtr pkt);
167
168 /**
169 * Attempt to send a timing request to the slave port by calling
170 * its corresponding receive function. If the send does not
171 * succeed, as indicated by the return value, then the sender must
172 * wait for a recvReqRetry at which point it can re-issue a
173 * sendTimingReq.
174 *
175 * @param pkt Packet to send.
176 *
177 * @return If the send was succesful or not.
178 */
179 bool sendTimingReq(PacketPtr pkt);
180
181 /**
182 * Check if the slave can handle a timing request.
183 *
184 * If the send cannot be handled at the moment, as indicated by
185 * the return value, then the sender will receive a recvReqRetry
186 * at which point it can re-issue a sendTimingReq.
187 *
188 * @param pkt Packet to send.
189 *
190 * @return If the send was succesful or not.
191 */
192 bool tryTiming(PacketPtr pkt) const;
193
194 /**
195 * Attempt to send a timing snoop response packet to the slave
196 * port by calling its corresponding receive function. If the send
197 * does not succeed, as indicated by the return value, then the
198 * sender must wait for a recvRetrySnoop at which point it can
199 * re-issue a sendTimingSnoopResp.
200 *
201 * @param pkt Packet to send.
202 */
203 bool sendTimingSnoopResp(PacketPtr pkt);
204
205 /**
206 * Send a retry to the slave port that previously attempted a
207 * sendTimingResp to this master port and failed. Note that this
208 * is virtual so that the "fake" snoop response port in the
209 * coherent crossbar can override the behaviour.
210 */
211 virtual void sendRetryResp();
212
213 /**
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 */
222 virtual bool isSnooping() const { return false; }
223
224 /**
225 * Get the address ranges of the connected slave port.
226 */
227 AddrRangeList getAddrRanges() const;
228
229 /** Inject a PrintReq for the given address to print the state of
230 * that address throughout the memory system. For debugging.
231 */
232 void printAddr(Addr a);
233
234 protected:
235
236 /**
237 * Receive an atomic snoop request packet from the slave port.
238 */
239 virtual Tick recvAtomicSnoop(PacketPtr pkt)
240 {
241 panic("%s was not expecting an atomic snoop request\n", name());
242 return 0;
243 }
244
245 /**
246 * Receive a functional snoop request packet from the slave port.
247 */
248 virtual void recvFunctionalSnoop(PacketPtr pkt)
249 {
250 panic("%s was not expecting a functional snoop request\n", name());
251 }
252
253 /**
254 * Receive a timing response from the slave port.
255 */
256 virtual bool recvTimingResp(PacketPtr pkt) = 0;
257
258 /**
259 * Receive a timing snoop request from the slave port.
260 */
261 virtual void recvTimingSnoopReq(PacketPtr pkt)
262 {
263 panic("%s was not expecting a timing snoop request\n", name());
264 }
265
266 /**
267 * Called by the slave port if sendTimingReq was called on this
268 * master port (causing recvTimingReq to be called on the slave
269 * port) and was unsuccesful.
270 */
271 virtual void recvReqRetry() = 0;
272
273 /**
274 * Called by the slave port if sendTimingSnoopResp was called on this
275 * master port (causing recvTimingSnoopResp to be called on the slave
276 * port) and was unsuccesful.
277 */
278 virtual void recvRetrySnoopResp()
279 {
280 panic("%s was not expecting a snoop retry\n", name());
281 }
282
283 /**
284 * Called to receive an address range change from the peer slave
285 * port. The default implementation ignores the change and does
286 * nothing. Override this function in a derived class if the owner
287 * needs to be aware of the address ranges, e.g. in an
288 * interconnect component like a bus.
289 */
290 virtual void recvRangeChange() { }
291};
292
293/**
294 * A SlavePort is a specialisation of a port. In addition to the
295 * basic functionality of sending packets to its master peer, it also
296 * has functions specific to a slave, e.g. to send range changes
297 * and get the address ranges that the port responds to.
298 */
299class SlavePort : public BaseSlavePort
300{
301
302 friend class MasterPort;
303
304 private:
305
306 MasterPort* _masterPort;
307
308 protected:
309
310 MemObject& owner;
311
312 public:
313
314 SlavePort(const std::string& name, MemObject* _owner,
315 PortID id=InvalidPortID);
316 virtual ~SlavePort();
317
318 /**
319 * Send an atomic snoop request packet, where the data is moved
320 * and the state is updated in zero time, without interleaving
321 * with other memory accesses.
322 *
323 * @param pkt Snoop packet to send.
324 *
325 * @return Estimated latency of access.
326 */
327 Tick sendAtomicSnoop(PacketPtr pkt);
328
329 /**
330 * Send a functional snoop request packet, where the data is
331 * instantly updated everywhere in the memory system, without
332 * affecting the current state of any block or moving the block.
333 *
334 * @param pkt Snoop packet to send.
335 */
336 void sendFunctionalSnoop(PacketPtr pkt);
337
338 /**
339 * Attempt to send a timing response to the master port by calling
340 * its corresponding receive function. If the send does not
341 * succeed, as indicated by the return value, then the sender must
342 * wait for a recvRespRetry at which point it can re-issue a
343 * sendTimingResp.
344 *
345 * @param pkt Packet to send.
346 *
347 * @return If the send was succesful or not.
348 */
349 bool sendTimingResp(PacketPtr pkt);
350
351 /**
352 * Attempt to send a timing snoop request packet to the master port
353 * by calling its corresponding receive function. Snoop requests
354 * always succeed and hence no return value is needed.
355 *
356 * @param pkt Packet to send.
357 */
358 void sendTimingSnoopReq(PacketPtr pkt);
359
360 /**
361 * Send a retry to the master port that previously attempted a
362 * sendTimingReq to this slave port and failed.
363 */
364 void sendRetryReq();
365
366 /**
367 * Send a retry to the master port that previously attempted a
368 * sendTimingSnoopResp to this slave port and failed.
369 */
370 void sendRetrySnoopResp();
371
372 /**
373 * Find out if the peer master port is snooping or not.
374 *
375 * @return true if the peer master port is snooping
376 */
377 bool isSnooping() const { return _masterPort->isSnooping(); }
378
379 /**
380 * Called by the owner to send a range change
381 */
382 void sendRangeChange() const {
383 if (!_masterPort)
384 fatal("%s cannot sendRangeChange() without master port", name());
385 _masterPort->recvRangeChange();
386 }
387
388 /**
389 * Get a list of the non-overlapping address ranges the owner is
390 * responsible for. All slave ports must override this function
391 * and return a populated list with at least one item.
392 *
393 * @return a list of ranges responded to
394 */
395 virtual AddrRangeList getAddrRanges() const = 0;
396
143
144 /**
145 * Send an atomic request packet, where the data is moved and the
146 * state is updated in zero time, without interleaving with other
147 * memory accesses.
148 *
149 * @param pkt Packet to send.
150 *
151 * @return Estimated latency of access.
152 */
153 Tick sendAtomic(PacketPtr pkt);
154
155 /**
156 * Send a functional request packet, where the data is instantly
157 * updated everywhere in the memory system, without affecting the
158 * current state of any block or moving the block.
159 *
160 * @param pkt Packet to send.
161 */
162 void sendFunctional(PacketPtr pkt);
163
164 /**
165 * Attempt to send a timing request to the slave port by calling
166 * its corresponding receive function. If the send does not
167 * succeed, as indicated by the return value, then the sender must
168 * wait for a recvReqRetry at which point it can re-issue a
169 * sendTimingReq.
170 *
171 * @param pkt Packet to send.
172 *
173 * @return If the send was succesful or not.
174 */
175 bool sendTimingReq(PacketPtr pkt);
176
177 /**
178 * Check if the slave can handle a timing request.
179 *
180 * If the send cannot be handled at the moment, as indicated by
181 * the return value, then the sender will receive a recvReqRetry
182 * at which point it can re-issue a sendTimingReq.
183 *
184 * @param pkt Packet to send.
185 *
186 * @return If the send was succesful or not.
187 */
188 bool tryTiming(PacketPtr pkt) const;
189
190 /**
191 * Attempt to send a timing snoop response packet to the slave
192 * port by calling its corresponding receive function. If the send
193 * does not succeed, as indicated by the return value, then the
194 * sender must wait for a recvRetrySnoop at which point it can
195 * re-issue a sendTimingSnoopResp.
196 *
197 * @param pkt Packet to send.
198 */
199 bool sendTimingSnoopResp(PacketPtr pkt);
200
201 /**
202 * Send a retry to the slave port that previously attempted a
203 * sendTimingResp to this master port and failed. Note that this
204 * is virtual so that the "fake" snoop response port in the
205 * coherent crossbar can override the behaviour.
206 */
207 virtual void sendRetryResp();
208
209 /**
210 * Determine if this master port is snooping or not. The default
211 * implementation returns false and thus tells the neighbour we
212 * are not snooping. Any master port that wants to receive snoop
213 * requests (e.g. a cache connected to a bus) has to override this
214 * function.
215 *
216 * @return true if the port should be considered a snooper
217 */
218 virtual bool isSnooping() const { return false; }
219
220 /**
221 * Get the address ranges of the connected slave port.
222 */
223 AddrRangeList getAddrRanges() const;
224
225 /** Inject a PrintReq for the given address to print the state of
226 * that address throughout the memory system. For debugging.
227 */
228 void printAddr(Addr a);
229
230 protected:
231
232 /**
233 * Receive an atomic snoop request packet from the slave port.
234 */
235 virtual Tick recvAtomicSnoop(PacketPtr pkt)
236 {
237 panic("%s was not expecting an atomic snoop request\n", name());
238 return 0;
239 }
240
241 /**
242 * Receive a functional snoop request packet from the slave port.
243 */
244 virtual void recvFunctionalSnoop(PacketPtr pkt)
245 {
246 panic("%s was not expecting a functional snoop request\n", name());
247 }
248
249 /**
250 * Receive a timing response from the slave port.
251 */
252 virtual bool recvTimingResp(PacketPtr pkt) = 0;
253
254 /**
255 * Receive a timing snoop request from the slave port.
256 */
257 virtual void recvTimingSnoopReq(PacketPtr pkt)
258 {
259 panic("%s was not expecting a timing snoop request\n", name());
260 }
261
262 /**
263 * Called by the slave port if sendTimingReq was called on this
264 * master port (causing recvTimingReq to be called on the slave
265 * port) and was unsuccesful.
266 */
267 virtual void recvReqRetry() = 0;
268
269 /**
270 * Called by the slave port if sendTimingSnoopResp was called on this
271 * master port (causing recvTimingSnoopResp to be called on the slave
272 * port) and was unsuccesful.
273 */
274 virtual void recvRetrySnoopResp()
275 {
276 panic("%s was not expecting a snoop retry\n", name());
277 }
278
279 /**
280 * Called to receive an address range change from the peer slave
281 * port. The default implementation ignores the change and does
282 * nothing. Override this function in a derived class if the owner
283 * needs to be aware of the address ranges, e.g. in an
284 * interconnect component like a bus.
285 */
286 virtual void recvRangeChange() { }
287};
288
289/**
290 * A SlavePort is a specialisation of a port. In addition to the
291 * basic functionality of sending packets to its master peer, it also
292 * has functions specific to a slave, e.g. to send range changes
293 * and get the address ranges that the port responds to.
294 */
295class SlavePort : public BaseSlavePort
296{
297
298 friend class MasterPort;
299
300 private:
301
302 MasterPort* _masterPort;
303
304 protected:
305
306 MemObject& owner;
307
308 public:
309
310 SlavePort(const std::string& name, MemObject* _owner,
311 PortID id=InvalidPortID);
312 virtual ~SlavePort();
313
314 /**
315 * Send an atomic snoop request packet, where the data is moved
316 * and the state is updated in zero time, without interleaving
317 * with other memory accesses.
318 *
319 * @param pkt Snoop packet to send.
320 *
321 * @return Estimated latency of access.
322 */
323 Tick sendAtomicSnoop(PacketPtr pkt);
324
325 /**
326 * Send a functional snoop request packet, where the data is
327 * instantly updated everywhere in the memory system, without
328 * affecting the current state of any block or moving the block.
329 *
330 * @param pkt Snoop packet to send.
331 */
332 void sendFunctionalSnoop(PacketPtr pkt);
333
334 /**
335 * Attempt to send a timing response to the master port by calling
336 * its corresponding receive function. If the send does not
337 * succeed, as indicated by the return value, then the sender must
338 * wait for a recvRespRetry at which point it can re-issue a
339 * sendTimingResp.
340 *
341 * @param pkt Packet to send.
342 *
343 * @return If the send was succesful or not.
344 */
345 bool sendTimingResp(PacketPtr pkt);
346
347 /**
348 * Attempt to send a timing snoop request packet to the master port
349 * by calling its corresponding receive function. Snoop requests
350 * always succeed and hence no return value is needed.
351 *
352 * @param pkt Packet to send.
353 */
354 void sendTimingSnoopReq(PacketPtr pkt);
355
356 /**
357 * Send a retry to the master port that previously attempted a
358 * sendTimingReq to this slave port and failed.
359 */
360 void sendRetryReq();
361
362 /**
363 * Send a retry to the master port that previously attempted a
364 * sendTimingSnoopResp to this slave port and failed.
365 */
366 void sendRetrySnoopResp();
367
368 /**
369 * Find out if the peer master port is snooping or not.
370 *
371 * @return true if the peer master port is snooping
372 */
373 bool isSnooping() const { return _masterPort->isSnooping(); }
374
375 /**
376 * Called by the owner to send a range change
377 */
378 void sendRangeChange() const {
379 if (!_masterPort)
380 fatal("%s cannot sendRangeChange() without master port", name());
381 _masterPort->recvRangeChange();
382 }
383
384 /**
385 * Get a list of the non-overlapping address ranges the owner is
386 * responsible for. All slave ports must override this function
387 * and return a populated list with at least one item.
388 *
389 * @return a list of ranges responded to
390 */
391 virtual AddrRangeList getAddrRanges() const = 0;
392
393 /**
394 * We let the master port do the work, so these don't do anything.
395 */
396 void unbind() override {}
397 void bind(Port &peer) override {}
398
397 protected:
398
399 /**
400 * Called by the master port to unbind. Should never be called
401 * directly.
402 */
399 protected:
400
401 /**
402 * Called by the master port to unbind. Should never be called
403 * directly.
404 */
403 void unbind();
405 void slaveUnbind();
404
405 /**
406 * Called by the master port to bind. Should never be called
407 * directly.
408 */
406
407 /**
408 * Called by the master port to bind. Should never be called
409 * directly.
410 */
409 void bind(MasterPort& master_port);
411 void slaveBind(MasterPort& master_port);
410
411 /**
412 * Receive an atomic request packet from the master port.
413 */
414 virtual Tick recvAtomic(PacketPtr pkt) = 0;
415
416 /**
417 * Receive a functional request packet from the master port.
418 */
419 virtual void recvFunctional(PacketPtr pkt) = 0;
420
421 /**
422 * Receive a timing request from the master port.
423 */
424 virtual bool recvTimingReq(PacketPtr pkt) = 0;
425
426 /**
427 * Availability request from the master port.
428 */
429 virtual bool tryTiming(PacketPtr pkt) {
430 panic("%s was not expecting a %s\n", name(), __func__);
431 }
432
433 /**
434 * Receive a timing snoop response from the master port.
435 */
436 virtual bool recvTimingSnoopResp(PacketPtr pkt)
437 {
438 panic("%s was not expecting a timing snoop response\n", name());
439 }
440
441 /**
442 * Called by the master port if sendTimingResp was called on this
443 * slave port (causing recvTimingResp to be called on the master
444 * port) and was unsuccesful.
445 */
446 virtual void recvRespRetry() = 0;
447
448};
449
450#endif //__MEM_PORT_HH__
412
413 /**
414 * Receive an atomic request packet from the master port.
415 */
416 virtual Tick recvAtomic(PacketPtr pkt) = 0;
417
418 /**
419 * Receive a functional request packet from the master port.
420 */
421 virtual void recvFunctional(PacketPtr pkt) = 0;
422
423 /**
424 * Receive a timing request from the master port.
425 */
426 virtual bool recvTimingReq(PacketPtr pkt) = 0;
427
428 /**
429 * Availability request from the master port.
430 */
431 virtual bool tryTiming(PacketPtr pkt) {
432 panic("%s was not expecting a %s\n", name(), __func__);
433 }
434
435 /**
436 * Receive a timing snoop response from the master port.
437 */
438 virtual bool recvTimingSnoopResp(PacketPtr pkt)
439 {
440 panic("%s was not expecting a timing snoop response\n", name());
441 }
442
443 /**
444 * Called by the master port if sendTimingResp was called on this
445 * slave port (causing recvTimingResp to be called on the master
446 * port) and was unsuccesful.
447 */
448 virtual void recvRespRetry() = 0;
449
450};
451
452#endif //__MEM_PORT_HH__