gem5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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  * Authors: Ali Saidi
42  * Steve Reinhardt
43  * Andreas Hansson
44  * Erfan Azarkhish
45  */
46 
53 #ifndef __MEM_SERIAL_LINK_HH__
54 #define __MEM_SERIAL_LINK_HH__
55 
56 #include <deque>
57 
58 #include "base/types.hh"
59 #include "mem/mem_object.hh"
60 #include "params/SerialLink.hh"
61 
69 class SerialLink : public MemObject
70 {
71  protected:
72 
78  {
79 
80  public:
81 
82  const Tick tick;
83  const PacketPtr pkt;
84 
85  DeferredPacket(PacketPtr _pkt, Tick _tick) : tick(_tick), pkt(_pkt)
86  { }
87  };
88 
89  // Forward declaration to allow the slave port to have a pointer
90  class SerialLinkMasterPort;
91 
99  {
100 
101  private:
102 
105 
110 
112  const Cycles delay;
113 
116 
124 
126  unsigned int outstandingResponses;
127 
129  bool retryReq;
130 
132  unsigned int respQueueLimit;
133 
139  bool respQueueFull() const;
140 
146  void trySendTiming();
147 
151 
152  public:
153 
165  SerialLinkSlavePort(const std::string& _name, SerialLink&
166  _serial_link, SerialLinkMasterPort& _masterPort,
167  Cycles _delay, int _resp_limit, const
168  std::vector<AddrRange>& _ranges);
169 
177  void schedTimingResp(PacketPtr pkt, Tick when);
178 
184  void retryStalledReq();
185 
186  protected:
187 
190  bool recvTimingReq(PacketPtr pkt);
191 
194  void recvRespRetry();
195 
199 
202  void recvFunctional(PacketPtr pkt);
203 
207  };
208 
209 
216  {
217 
218  private:
219 
222 
227 
229  const Cycles delay;
230 
238 
240  const unsigned int reqQueueLimit;
241 
247  void trySendTiming();
248 
252 
253  public:
254 
265  SerialLinkMasterPort(const std::string& _name, SerialLink&
266  _serial_link, SerialLinkSlavePort& _slavePort, Cycles
267  _delay, int _req_limit);
268 
274  bool reqQueueFull() const;
275 
283  void schedTimingReq(PacketPtr pkt, Tick when);
284 
293  bool checkFunctional(PacketPtr pkt);
294 
295  protected:
296 
299  bool recvTimingResp(PacketPtr pkt);
300 
303  void recvReqRetry();
304  };
305 
308 
311 
313  unsigned num_lanes;
314 
316  uint64_t link_speed;
317 
318  public:
319 
320  virtual BaseMasterPort& getMasterPort(const std::string& if_name,
321  PortID idx = InvalidPortID);
322  virtual BaseSlavePort& getSlavePort(const std::string& if_name,
323  PortID idx = InvalidPortID);
324 
325  virtual void init();
326 
327  typedef SerialLinkParams Params;
328 
329  SerialLink(SerialLinkParams *p);
330 };
331 
332 #endif //__MEM_SERIAL_LINK_HH__
A MasterPort is a specialisation of a BaseMasterPort, which implements the default protocol for the t...
Definition: port.hh:167
Cycles is a wrapper class for representing cycle counts, i.e.
Definition: types.hh:83
const PortID InvalidPortID
Definition: types.hh:182
MemObject declaration.
A SlavePort is a specialisation of a port.
Definition: port.hh:331
MasterPort * _masterPort
Definition: port.hh:338
A BaseSlavePort is a protocol-agnostic slave port, responsible only for the structural connection to ...
Definition: port.hh:139
SlavePort * _slavePort
Definition: port.hh:174
uint64_t Tick
Tick count type.
Definition: types.hh:63
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:245
STL deque class.
Definition: stl.hh:47
The MemObject class extends the ClockedObject with accessor functions to get its master and slave por...
Definition: mem_object.hh:60
A BaseMasterPort is a protocol-agnostic master port, responsible only for the structural connection t...
Definition: port.hh:115
int16_t PortID
Port index/ID type, and a symbolic name for an invalid port id.
Definition: types.hh:181
Bitfield< 0 > p

Generated on Fri Jun 9 2017 13:03:50 for gem5 by doxygen 1.8.6