gem5  v20.1.0.0
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 
47 #ifndef __MEM_BRIDGE_HH__
48 #define __MEM_BRIDGE_HH__
49 
50 #include <deque>
51 
52 #include "base/types.hh"
53 #include "mem/port.hh"
54 #include "params/Bridge.hh"
55 #include "sim/clocked_object.hh"
56 
70 class Bridge : public ClockedObject
71 {
72  protected:
73 
79  {
80 
81  public:
82 
83  const Tick tick;
84  const PacketPtr pkt;
85 
86  DeferredPacket(PacketPtr _pkt, Tick _tick) : tick(_tick), pkt(_pkt)
87  { }
88  };
89 
90  // Forward declaration to allow the response port to have a pointer
91  class BridgeRequestPort;
92 
100  {
101 
102  private:
103 
106 
111 
113  const Cycles delay;
114 
117 
125 
127  unsigned int outstandingResponses;
128 
130  bool retryReq;
131 
133  unsigned int respQueueLimit;
134 
139  std::unique_ptr<Packet> pendingDelete;
140 
146  bool respQueueFull() const;
147 
153  void trySendTiming();
154 
157 
158  public:
159 
171  BridgeResponsePort(const std::string& _name, Bridge& _bridge,
172  BridgeRequestPort& _memSidePort, Cycles _delay,
173  int _resp_limit, std::vector<AddrRange> _ranges);
174 
182  void schedTimingResp(PacketPtr pkt, Tick when);
183 
189  void retryStalledReq();
190 
191  protected:
192 
195  bool recvTimingReq(PacketPtr pkt);
196 
199  void recvRespRetry();
200 
204 
207  void recvFunctional(PacketPtr pkt);
208 
212  };
213 
214 
221  {
222 
223  private:
224 
227 
232 
234  const Cycles delay;
235 
243 
245  const unsigned int reqQueueLimit;
246 
252  void trySendTiming();
253 
256 
257  public:
258 
269  BridgeRequestPort(const std::string& _name, Bridge& _bridge,
270  BridgeResponsePort& _cpuSidePort, Cycles _delay,
271  int _req_limit);
272 
278  bool reqQueueFull() const;
279 
287  void schedTimingReq(PacketPtr pkt, Tick when);
288 
298 
299  protected:
300 
303  bool recvTimingResp(PacketPtr pkt);
304 
307  void recvReqRetry();
308  };
309 
312 
315 
316  public:
317 
318  Port &getPort(const std::string &if_name,
319  PortID idx=InvalidPortID) override;
320 
321  void init() override;
322 
323  typedef BridgeParams Params;
324 
325  Bridge(Params *p);
326 };
327 
328 #endif //__MEM_BRIDGE_HH__
Bridge::getPort
Port & getPort(const std::string &if_name, PortID idx=InvalidPortID) override
Get a port with a given name and index.
Definition: bridge.cc:87
Bridge::BridgeRequestPort::recvReqRetry
void recvReqRetry()
When receiving a retry request from the peer port, pass it to the bridge.
Definition: bridge.cc:327
Bridge::BridgeRequestPort::reqQueueLimit
const unsigned int reqQueueLimit
Max queue size for request packets.
Definition: bridge.hh:245
ResponsePort
A ResponsePort is a specialization of a port.
Definition: port.hh:265
Bridge::BridgeResponsePort::respQueueFull
bool respQueueFull() const
Is this side blocked from accepting new response packets.
Definition: bridge.cc:110
InvalidPortID
const PortID InvalidPortID
Definition: types.hh:238
Bridge::BridgeRequestPort::sendEvent
EventFunctionWrapper sendEvent
Send event for the request queue.
Definition: bridge.hh:255
Bridge::BridgeRequestPort::schedTimingReq
void schedTimingReq(PacketPtr pkt, Tick when)
Queue a request packet to be sent out later and also schedule a send if necessary.
Definition: bridge.cc:214
Bridge::BridgeResponsePort::sendEvent
EventFunctionWrapper sendEvent
Send event for the response queue.
Definition: bridge.hh:156
Tick
uint64_t Tick
Tick count type.
Definition: types.hh:63
Bridge::BridgeRequestPort::BridgeRequestPort
BridgeRequestPort(const std::string &_name, Bridge &_bridge, BridgeResponsePort &_cpuSidePort, Cycles _delay, int _req_limit)
Constructor for the BridgeRequestPort.
Definition: bridge.cc:66
Bridge::BridgeResponsePort::retryReq
bool retryReq
If we should send a retry when space becomes available.
Definition: bridge.hh:130
Bridge::BridgeResponsePort::memSidePort
BridgeRequestPort & memSidePort
Request port on the other side of the bridge.
Definition: bridge.hh:110
PortID
int16_t PortID
Port index/ID type, and a symbolic name for an invalid port id.
Definition: types.hh:237
Bridge::BridgeRequestPort::trySendTiming
void trySendTiming()
Handle send event, scheduled when the packet at the head of the outbound queue is ready to transmit (...
Definition: bridge.cc:245
std::vector< AddrRange >
Bridge::init
void init() override
init() is called after all C++ SimObjects have been created and all ports are connected.
Definition: bridge.cc:99
Bridge::DeferredPacket::DeferredPacket
DeferredPacket(PacketPtr _pkt, Tick _tick)
Definition: bridge.hh:86
Bridge::BridgeRequestPort::delay
const Cycles delay
Minimum delay though this bridge.
Definition: bridge.hh:234
ClockedObject
The ClockedObject class extends the SimObject with a clock and accessor functions to relate ticks to ...
Definition: clocked_object.hh:231
Bridge::BridgeRequestPort::trySatisfyFunctional
bool trySatisfyFunctional(PacketPtr pkt)
Check a functional request against the packets in our request queue.
Definition: bridge.cc:372
EventFunctionWrapper
Definition: eventq.hh:1101
Bridge::BridgeRequestPort::recvTimingResp
bool recvTimingResp(PacketPtr pkt)
When receiving a timing request from the peer port, pass it to the bridge.
Definition: bridge.cc:122
Bridge::BridgeResponsePort::pendingDelete
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:139
Bridge::Params
BridgeParams Params
Definition: bridge.hh:323
Bridge::BridgeResponsePort::respQueueLimit
unsigned int respQueueLimit
Max queue size for reserved responses.
Definition: bridge.hh:133
Bridge::Bridge
Bridge(Params *p)
Definition: bridge.cc:77
Bridge::BridgeResponsePort::bridge
Bridge & bridge
The bridge to which this port belongs.
Definition: bridge.hh:105
Bridge::BridgeResponsePort::ranges
const AddrRangeList ranges
Address ranges to pass through the bridge.
Definition: bridge.hh:116
Bridge::BridgeRequestPort::reqQueueFull
bool reqQueueFull() const
Is this side blocked from accepting new request packets.
Definition: bridge.cc:116
Port
Ports are used to interface objects to each other.
Definition: port.hh:56
port.hh
Bridge::BridgeResponsePort::trySendTiming
void trySendTiming()
Handle send event, scheduled when the packet at the head of the response queue is ready to transmit (...
Definition: bridge.cc:283
Bridge::BridgeResponsePort::transmitList
std::deque< DeferredPacket > transmitList
Response packet queue.
Definition: bridge.hh:124
RequestPort
A RequestPort is a specialisation of a Port, which implements the default protocol for the three diff...
Definition: port.hh:74
Bridge::cpuSidePort
BridgeResponsePort cpuSidePort
Response port of the bridge.
Definition: bridge.hh:311
Bridge::BridgeResponsePort::getAddrRanges
AddrRangeList getAddrRanges() const
When receiving a address range request the peer port, pass it to the bridge.
Definition: bridge.cc:389
Bridge::DeferredPacket::pkt
const PacketPtr pkt
Definition: bridge.hh:84
Bridge::BridgeRequestPort
Port on the side that forwards requests and receives responses.
Definition: bridge.hh:220
Bridge::BridgeResponsePort::recvRespRetry
void recvRespRetry()
When receiving a retry request from the peer port, pass it to the bridge.
Definition: bridge.cc:333
Bridge::BridgeRequestPort::bridge
Bridge & bridge
The bridge to which this port belongs.
Definition: bridge.hh:226
Bridge::DeferredPacket
A deferred packet stores a packet along with its scheduled transmission time.
Definition: bridge.hh:78
types.hh
Bridge::DeferredPacket::tick
const Tick tick
Definition: bridge.hh:83
Bridge::BridgeResponsePort::recvFunctional
void recvFunctional(PacketPtr pkt)
When receiving a Functional request from the peer port, pass it to the bridge.
Definition: bridge.cc:348
Bridge::BridgeRequestPort::cpuSidePort
BridgeResponsePort & cpuSidePort
The response port on the other side of the bridge.
Definition: bridge.hh:231
clocked_object.hh
Packet
A Packet is used to encapsulate a transfer between two objects in the memory system (e....
Definition: packet.hh:257
Bridge::memSidePort
BridgeRequestPort memSidePort
Request port of the bridge.
Definition: bridge.hh:314
std::deque
STL deque class.
Definition: stl.hh:44
Bridge::BridgeResponsePort::retryStalledReq
void retryStalledReq()
Retry any stalled request that we have failed to accept at an earlier point in time.
Definition: bridge.cc:204
Bridge::BridgeResponsePort::outstandingResponses
unsigned int outstandingResponses
Counter to track the outstanding responses.
Definition: bridge.hh:127
Cycles
Cycles is a wrapper class for representing cycle counts, i.e.
Definition: types.hh:83
Bridge
A bridge is used to interface two different crossbars (or in general a memory-mapped requestor and re...
Definition: bridge.hh:70
Bridge::BridgeResponsePort
The port on the side that receives requests and sends responses.
Definition: bridge.hh:99
Bridge::BridgeResponsePort::schedTimingResp
void schedTimingResp(PacketPtr pkt, Tick when)
Queue a response packet to be sent out later and also schedule a send if necessary.
Definition: bridge.cc:231
MipsISA::p
Bitfield< 0 > p
Definition: pra_constants.hh:323
Bridge::BridgeResponsePort::recvAtomic
Tick recvAtomic(PacketPtr pkt)
When receiving a Atomic requestfrom the peer port, pass it to the bridge.
Definition: bridge.cc:339
std::list< AddrRange >
Bridge::BridgeResponsePort::delay
const Cycles delay
Minimum request delay though this bridge.
Definition: bridge.hh:113
Bridge::BridgeResponsePort::recvTimingReq
bool recvTimingReq(PacketPtr pkt)
When receiving a timing request from the peer port, pass it to the bridge.
Definition: bridge.cc:144
Bridge::BridgeRequestPort::transmitList
std::deque< DeferredPacket > transmitList
Request packet queue.
Definition: bridge.hh:242
Bridge::BridgeResponsePort::BridgeResponsePort
BridgeResponsePort(const std::string &_name, Bridge &_bridge, BridgeRequestPort &_memSidePort, Cycles _delay, int _resp_limit, std::vector< AddrRange > _ranges)
Constructor for the BridgeResponsePort.
Definition: bridge.cc:53

Generated on Wed Sep 30 2020 14:02:12 for gem5 by doxygen 1.8.17