gem5  v19.0.0.0
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
bridge.hh
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2011-2013 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) 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
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: Ali Saidi
41  * Steve Reinhardt
42  * Andreas Hansson
43  */
44 
51 #ifndef __MEM_BRIDGE_HH__
52 #define __MEM_BRIDGE_HH__
53 
54 #include <deque>
55 
56 #include "base/types.hh"
57 #include "mem/port.hh"
58 #include "params/Bridge.hh"
59 #include "sim/clocked_object.hh"
60 
74 class Bridge : public ClockedObject
75 {
76  protected:
77 
83  {
84 
85  public:
86 
87  const Tick tick;
88  const PacketPtr pkt;
89 
90  DeferredPacket(PacketPtr _pkt, Tick _tick) : tick(_tick), pkt(_pkt)
91  { }
92  };
93 
94  // Forward declaration to allow the slave port to have a pointer
95  class BridgeMasterPort;
96 
103  class BridgeSlavePort : public SlavePort
104  {
105 
106  private:
107 
110 
115 
117  const Cycles delay;
118 
121 
129 
131  unsigned int outstandingResponses;
132 
134  bool retryReq;
135 
137  unsigned int respQueueLimit;
138 
143  std::unique_ptr<Packet> pendingDelete;
144 
150  bool respQueueFull() const;
151 
157  void trySendTiming();
158 
161 
162  public:
163 
174  BridgeSlavePort(const std::string& _name, Bridge& _bridge,
175  BridgeMasterPort& _masterPort, Cycles _delay,
176  int _resp_limit, std::vector<AddrRange> _ranges);
177 
185  void schedTimingResp(PacketPtr pkt, Tick when);
186 
192  void retryStalledReq();
193 
194  protected:
195 
198  bool recvTimingReq(PacketPtr pkt);
199 
202  void recvRespRetry();
203 
206  Tick recvAtomic(PacketPtr pkt);
207 
210  void recvFunctional(PacketPtr pkt);
211 
214  AddrRangeList getAddrRanges() const;
215  };
216 
217 
224  {
225 
226  private:
227 
230 
235 
237  const Cycles delay;
238 
246 
248  const unsigned int reqQueueLimit;
249 
255  void trySendTiming();
256 
259 
260  public:
261 
271  BridgeMasterPort(const std::string& _name, Bridge& _bridge,
272  BridgeSlavePort& _slavePort, Cycles _delay,
273  int _req_limit);
274 
280  bool reqQueueFull() const;
281 
289  void schedTimingReq(PacketPtr pkt, Tick when);
290 
299  bool trySatisfyFunctional(PacketPtr pkt);
300 
301  protected:
302 
305  bool recvTimingResp(PacketPtr pkt);
306 
309  void recvReqRetry();
310  };
311 
314 
317 
318  public:
319 
320  Port &getPort(const std::string &if_name,
321  PortID idx=InvalidPortID) override;
322 
323  void init() override;
324 
325  typedef BridgeParams Params;
326 
327  Bridge(Params *p);
328 };
329 
330 #endif //__MEM_BRIDGE_HH__
A MasterPort is a specialisation of a BaseMasterPort, which implements the default protocol for the t...
Definition: port.hh:75
Ports are used to interface objects to each other.
Definition: port.hh:60
bool retryReq
If we should send a retry when space becomes available.
Definition: bridge.hh:134
Bridge & bridge
The bridge to which this port belongs.
Definition: bridge.hh:229
Cycles is a wrapper class for representing cycle counts, i.e.
Definition: types.hh:83
const PortID InvalidPortID
Definition: types.hh:238
const Cycles delay
Minimum request delay though this bridge.
Definition: bridge.hh:117
unsigned int outstandingResponses
Counter to track the outstanding responses.
Definition: bridge.hh:131
const AddrRangeList ranges
Address ranges to pass through the bridge.
Definition: bridge.hh:120
const PacketPtr pkt
Definition: bridge.hh:88
A SlavePort is a specialisation of a port.
Definition: port.hh:258
BridgeParams Params
Definition: bridge.hh:325
std::deque< DeferredPacket > transmitList
Request packet queue.
Definition: bridge.hh:245
BridgeMasterPort & masterPort
Master port on the other side of the bridge.
Definition: bridge.hh:114
uint64_t Tick
Tick count type.
Definition: types.hh:63
BridgeMasterPort masterPort
Master port of the bridge.
Definition: bridge.hh:316
BridgeSlavePort slavePort
Slave port of the bridge.
Definition: bridge.hh:313
The ClockedObject class extends the SimObject with a clock and accessor functions to relate ticks to ...
void init() override
init() is called after all C++ SimObjects have been created and all ports are connected.
Definition: bridge.cc:101
ClockedObject declaration and implementation.
EventFunctionWrapper sendEvent
Send event for the request queue.
Definition: bridge.hh:258
std::deque< DeferredPacket > transmitList
Response packet queue.
Definition: bridge.hh:128
Port Object Declaration.
const unsigned int reqQueueLimit
Max queue size for request packets.
Definition: bridge.hh:248
A deferred packet stores a packet along with its scheduled transmission time.
Definition: bridge.hh:82
Defines global host-dependent types: Counter, Tick, and (indirectly) {int,uint}{8,16,32,64}_t.
A Packet is used to encapsulate a transfer between two objects in the memory system (e...
Definition: packet.hh:255
The port on the side that receives requests and sends responses.
Definition: bridge.hh:103
const Tick tick
Definition: bridge.hh:87
Bridge(Params *p)
Definition: bridge.cc:79
STL deque class.
Definition: stl.hh:47
EventFunctionWrapper sendEvent
Send event for the response queue.
Definition: bridge.hh:160
Port & getPort(const std::string &if_name, PortID idx=InvalidPortID) override
Get a port with a given name and index.
Definition: bridge.cc:89
unsigned int respQueueLimit
Max queue size for reserved responses.
Definition: bridge.hh:137
A bridge is used to interface two different crossbars (or in general a memory-mapped master and slave...
Definition: bridge.hh:74
Port on the side that forwards requests and receives responses.
Definition: bridge.hh:223
int16_t PortID
Port index/ID type, and a symbolic name for an invalid port id.
Definition: types.hh:237
BridgeSlavePort & slavePort
The slave port on the other side of the bridge.
Definition: bridge.hh:234
DeferredPacket(PacketPtr _pkt, Tick _tick)
Definition: bridge.hh:90
const Cycles delay
Minimum delay though this bridge.
Definition: bridge.hh:237
Bitfield< 0 > p
Bridge & bridge
The bridge to which this port belongs.
Definition: bridge.hh:109
std::unique_ptr< Packet > pendingDelete
Upstream caches need this packet until true is returned, so hold it for deletion until a subsequent c...
Definition: bridge.hh:143

Generated on Fri Feb 28 2020 16:27:01 for gem5 by doxygen 1.8.13