gem5  v20.1.0.0
serial_link.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  * Copyright (c) 2015 The University of Bologna
16  * All rights reserved.
17  *
18  * Redistribution and use in source and binary forms, with or without
19  * modification, are permitted provided that the following conditions are
20  * met: redistributions of source code must retain the above copyright
21  * notice, this list of conditions and the following disclaimer;
22  * redistributions in binary form must reproduce the above copyright
23  * notice, this list of conditions and the following disclaimer in the
24  * documentation and/or other materials provided with the distribution;
25  * neither the name of the copyright holders nor the names of its
26  * contributors may be used to endorse or promote products derived from
27  * this software without specific prior written permission.
28  *
29  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
30  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
31  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
32  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
33  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
34  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
35  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
36  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
37  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
38  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
39  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
40  */
41 
48 #ifndef __MEM_SERIAL_LINK_HH__
49 #define __MEM_SERIAL_LINK_HH__
50 
51 #include <deque>
52 
53 #include "base/types.hh"
54 #include "mem/port.hh"
55 #include "params/SerialLink.hh"
56 #include "sim/clocked_object.hh"
57 
65 class SerialLink : public ClockedObject
66 {
67  protected:
68 
74  {
75 
76  public:
77 
78  const Tick tick;
79  const PacketPtr pkt;
80 
81  DeferredPacket(PacketPtr _pkt, Tick _tick) : tick(_tick), pkt(_pkt)
82  { }
83  };
84 
85  // Forward declaration to allow the CPU-side port to have a pointer
86  class SerialLinkRequestPort;
87 
95  {
96 
97  private:
98 
101 
106 
108  const Cycles delay;
109 
112 
120 
122  unsigned int outstandingResponses;
123 
125  bool retryReq;
126 
128  unsigned int respQueueLimit;
129 
135  bool respQueueFull() const;
136 
142  void trySendTiming();
143 
146 
147  public:
148 
160  SerialLinkResponsePort(const std::string& _name, SerialLink&
161  _serial_link, SerialLinkRequestPort& _mem_side_port,
162  Cycles _delay, int _resp_limit, const
163  std::vector<AddrRange>& _ranges);
164 
172  void schedTimingResp(PacketPtr pkt, Tick when);
173 
179  void retryStalledReq();
180 
181  protected:
182 
185  bool recvTimingReq(PacketPtr pkt);
186 
189  void recvRespRetry();
190 
194 
197  void recvFunctional(PacketPtr pkt);
198 
202  };
203 
204 
211  {
212 
213  private:
214 
217 
223 
225  const Cycles delay;
226 
234 
236  const unsigned int reqQueueLimit;
237 
243  void trySendTiming();
244 
247 
248  public:
249 
260  SerialLinkRequestPort(const std::string& _name, SerialLink&
261  _serial_link, SerialLinkResponsePort& _cpu_side_port,
262  Cycles _delay, int _req_limit);
263 
269  bool reqQueueFull() const;
270 
278  void schedTimingReq(PacketPtr pkt, Tick when);
279 
289 
290  protected:
291 
294  bool recvTimingResp(PacketPtr pkt);
295 
298  void recvReqRetry();
299  };
300 
303 
306 
308  unsigned num_lanes;
309 
311  uint64_t link_speed;
312 
313  public:
314 
315  Port &getPort(const std::string &if_name,
316  PortID idx=InvalidPortID);
317 
318  virtual void init();
319 
320  typedef SerialLinkParams Params;
321 
322  SerialLink(SerialLinkParams *p);
323 };
324 
325 #endif //__MEM_SERIAL_LINK_HH__
ResponsePort
A ResponsePort is a specialization of a port.
Definition: port.hh:265
InvalidPortID
const PortID InvalidPortID
Definition: types.hh:238
Tick
uint64_t Tick
Tick count type.
Definition: types.hh:63
PortID
int16_t PortID
Port index/ID type, and a symbolic name for an invalid port id.
Definition: types.hh:237
std::vector< AddrRange >
ClockedObject
The ClockedObject class extends the SimObject with a clock and accessor functions to relate ticks to ...
Definition: clocked_object.hh:231
EventFunctionWrapper
Definition: eventq.hh:1101
Port
Ports are used to interface objects to each other.
Definition: port.hh:56
port.hh
RequestPort
A RequestPort is a specialisation of a Port, which implements the default protocol for the three diff...
Definition: port.hh:74
types.hh
clocked_object.hh
Packet
A Packet is used to encapsulate a transfer between two objects in the memory system (e....
Definition: packet.hh:257
std::deque
STL deque class.
Definition: stl.hh:44
Cycles
Cycles is a wrapper class for representing cycle counts, i.e.
Definition: types.hh:83
MipsISA::p
Bitfield< 0 > p
Definition: pra_constants.hh:323
std::list< AddrRange >

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