gem5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
RubyPort.hh
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2012-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) 2009-2013 Advanced Micro Devices, Inc.
15  * Copyright (c) 2011 Mark D. Hill and David A. Wood
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 
42 #ifndef __MEM_RUBY_SYSTEM_RUBYPORT_HH__
43 #define __MEM_RUBY_SYSTEM_RUBYPORT_HH__
44 
45 #include <cassert>
46 #include <string>
47 
48 #include "mem/protocol/RequestStatus.hh"
51 #include "mem/mem_object.hh"
52 #include "mem/tport.hh"
53 #include "params/RubyPort.hh"
54 
55 class AbstractController;
56 
57 class RubyPort : public MemObject
58 {
59  public:
61  {
62  private:
65 
66  public:
67  MemMasterPort(const std::string &_name, RubyPort *_port);
68 
69  protected:
70  bool recvTimingResp(PacketPtr pkt);
71  void recvRangeChange() {}
72  };
73 
75  {
76  private:
80 
81  public:
82  MemSlavePort(const std::string &_name, RubyPort *_port,
83  bool _access_backing_store,
84  PortID id, bool _no_retry_on_stall);
85  void hitCallback(PacketPtr pkt);
86  void evictionCallback(Addr address);
87 
88  protected:
89  bool recvTimingReq(PacketPtr pkt);
90 
92  { panic("RubyPort::MemSlavePort::recvAtomic() not implemented!\n"); }
93 
94  void recvFunctional(PacketPtr pkt);
95 
97  { AddrRangeList ranges; return ranges; }
98 
99  void addToRetryList();
100 
101  private:
102  bool isPhysMemAddress(Addr addr) const;
103  };
104 
106  {
107  private:
110 
111  public:
112  PioMasterPort(const std::string &_name, RubyPort *_port);
113 
114  protected:
115  bool recvTimingResp(PacketPtr pkt);
116  void recvRangeChange();
117  };
118 
120  {
121  private:
123 
124  public:
125  PioSlavePort(const std::string &_name, RubyPort *_port);
126 
127  protected:
128  bool recvTimingReq(PacketPtr pkt);
129 
131  { panic("recvAtomic not supported with ruby!"); }
132 
134  { panic("recvFunctional should never be called on pio slave port!"); }
135 
137  };
138 
140  {
142  SenderState(MemSlavePort * _port) : port(_port)
143  {}
144  };
145 
146  typedef RubyPortParams Params;
147  RubyPort(const Params *p);
148  virtual ~RubyPort() {}
149 
150  void init() override;
151 
152  BaseMasterPort &getMasterPort(const std::string &if_name,
153  PortID idx = InvalidPortID) override;
154  BaseSlavePort &getSlavePort(const std::string &if_name,
155  PortID idx = InvalidPortID) override;
156 
157  virtual RequestStatus makeRequest(PacketPtr pkt) = 0;
158  virtual int outstandingCount() const = 0;
159  virtual bool isDeadlockEventScheduled() const = 0;
160  virtual void descheduleDeadlockEvent() = 0;
161 
162  //
163  // Called by the controller to give the sequencer a pointer.
164  // A pointer to the controller is needed for atomic support.
165  //
166  void setController(AbstractController* _cntrl) { m_controller = _cntrl; }
167  uint32_t getId() { return m_version; }
168  DrainState drain() override;
169 
170  bool isCPUSequencer() { return m_isCPUSequencer; }
171 
172  protected:
173  void trySendRetries();
174  void ruby_hit_callback(PacketPtr pkt);
175  void testDrainComplete();
176  void ruby_eviction_callback(Addr address);
177 
186  bool recvTimingResp(PacketPtr pkt, PortID master_port_id);
187 
189  uint32_t m_version;
194 
196 
197  private:
199  {
200  return (std::find(retryList.begin(), retryList.end(), port) !=
201  retryList.end());
202  }
204  {
205  if (onRetryList(port)) return;
206  retryList.push_back(port);
207  }
208 
213  unsigned int gotAddrRanges;
214 
218 
219  //
220  // Based on similar code in the M5 bus. Stores pointers to those ports
221  // that should be called when the Sequencer becomes available after a stall.
222  //
224 
226 };
227 
228 #endif // __MEM_RUBY_SYSTEM_RUBYPORT_HH__
std::vector< MemSlavePort * > slave_ports
Definition: RubyPort.hh:195
void recvRangeChange()
Called to receive an address range change from the peer slave port.
Definition: RubyPort.hh:71
void evictionCallback(Addr address)
bool recvTimingReq(PacketPtr pkt)
Receive a timing request from the master port.
Definition: RubyPort.cc:230
PioSlavePort(const std::string &_name, RubyPort *_port)
Definition: RubyPort.cc:147
void setController(AbstractController *_cntrl)
Definition: RubyPort.hh:166
const PortID InvalidPortID
Definition: types.hh:182
DrainState
Object drain/handover states.
Definition: drain.hh:71
#define panic(...)
Definition: misc.hh:153
void init() override
init() is called after all C++ SimObjects have been created and all ports are connected.
Definition: RubyPort.cc:84
AbstractController * m_controller
Definition: RubyPort.hh:190
std::vector< MemSlavePort * > retryList
Definition: RubyPort.hh:223
bool isPhysMemAddress(Addr addr) const
Definition: RubyPort.cc:527
bool recvTimingResp(PacketPtr pkt)
Receive a timing response from the slave port.
Definition: RubyPort.cc:184
The QueuedMasterPort combines two queues, a request queue and a snoop response queue, that both share the same port.
Definition: qport.hh:107
ip6_addr_t addr
Definition: inet.hh:335
MemObject declaration.
void trySendRetries()
Definition: RubyPort.cc:385
virtual int outstandingCount() const =0
SnoopRespPacketQueue snoopRespQueue
Definition: RubyPort.hh:64
Definition: system.hh:83
SenderState(MemSlavePort *_port)
Definition: RubyPort.hh:142
A queued port is a port that has an infinite queue for outgoing packets and thus decouples the module...
Definition: qport.hh:59
ReqPacketQueue reqQueue
Definition: RubyPort.hh:63
bool recvTimingReq(PacketPtr pkt)
Receive a timing request from the master port.
Definition: RubyPort.cc:209
A BaseSlavePort is a protocol-agnostic slave port, responsible only for the structural connection to ...
Definition: port.hh:139
RubySystem * m_ruby_system
Definition: RubyPort.hh:188
RubyPortParams Params
Definition: RubyPort.hh:146
STL vector class.
Definition: stl.hh:40
virtual RequestStatus makeRequest(PacketPtr pkt)=0
bool isCPUSequencer()
Definition: RubyPort.hh:170
Declaration of SimpleTimingPort.
bool onRetryList(MemSlavePort *port)
Definition: RubyPort.hh:198
void hitCallback(PacketPtr pkt)
Definition: RubyPort.cc:445
void ruby_eviction_callback(Addr address)
Definition: RubyPort.cc:534
void addToRetryList(MemSlavePort *port)
Definition: RubyPort.hh:203
PioSlavePort pioSlavePort
Definition: RubyPort.hh:210
MemMasterPort(const std::string &_name, RubyPort *_port)
Definition: RubyPort.cc:154
ReqPacketQueue reqQueue
Definition: RubyPort.hh:108
uint32_t getId()
Definition: RubyPort.hh:167
uint64_t Tick
Tick count type.
Definition: types.hh:63
Tick recvAtomic(PacketPtr pkt)
Receive an atomic request packet from the master port.
Definition: RubyPort.hh:91
AddrRangeList getAddrRanges() const
Get a list of the non-overlapping address ranges the owner is responsible for.
Definition: RubyPort.hh:96
System * system
Definition: RubyPort.hh:193
unsigned int gotAddrRanges
Definition: RubyPort.hh:213
uint32_t m_version
Definition: RubyPort.hh:189
RespPacketQueue queue
Definition: RubyPort.hh:122
virtual bool isDeadlockEventScheduled() const =0
bool m_usingRubyTester
Definition: RubyPort.hh:192
MemObjectParams Params
Definition: mem_object.hh:63
virtual void descheduleDeadlockEvent()=0
void recvRangeChange()
Called to receive an address range change from the peer slave port.
Definition: RubyPort.cc:555
void ruby_hit_callback(PacketPtr pkt)
Definition: RubyPort.cc:362
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
Definition: types.hh:142
Tick recvAtomic(PacketPtr pkt)
Receive an atomic request packet from the master port.
Definition: RubyPort.hh:130
SnoopRespPacketQueue snoopRespQueue
Definition: RubyPort.hh:109
A Packet is used to encapsulate a transfer between two objects in the memory system (e...
Definition: packet.hh:245
PioMasterPort(const std::string &_name, RubyPort *_port)
Definition: RubyPort.cc:139
bool recvTimingResp(PacketPtr pkt, PortID master_port_id)
Called by the PIO port when receiving a timing response.
void recvFunctional(PacketPtr pkt)
Receive a functional request packet from the master port.
Definition: RubyPort.cc:306
A virtual base opaque structure used to hold state associated with the packet (e.g., an MSHR), specific to a MemObject that sees the packet.
Definition: packet.hh:377
PioMasterPort pioMasterPort
Definition: RubyPort.hh:209
MessageBuffer * m_mandatory_q_ptr
Definition: RubyPort.hh:191
bool m_isCPUSequencer
Definition: RubyPort.hh:225
void testDrainComplete()
Definition: RubyPort.cc:411
RubyPort(const Params *p)
Definition: RubyPort.cc:54
The MemObject class extends the ClockedObject with accessor functions to get its master and slave por...
Definition: mem_object.hh:60
void recvFunctional(PacketPtr pkt)
Receive a functional request packet from the master port.
Definition: RubyPort.hh:133
A BaseMasterPort is a protocol-agnostic master port, responsible only for the structural connection t...
Definition: port.hh:115
virtual ~RubyPort()
Definition: RubyPort.hh:148
MemMasterPort memMasterPort
Definition: RubyPort.hh:211
std::vector< PioMasterPort * > master_ports
Definition: RubyPort.hh:217
int16_t PortID
Port index/ID type, and a symbolic name for an invalid port id.
Definition: types.hh:181
BaseSlavePort & getSlavePort(const std::string &if_name, PortID idx=InvalidPortID) override
Get a slave port with a given name and index.
Definition: RubyPort.cc:116
MemSlavePort memSlavePort
Definition: RubyPort.hh:212
RespPacketQueue queue
Definition: RubyPort.hh:77
Bitfield< 0 > p
bool recvTimingResp(PacketPtr pkt)
Receive a timing response from the slave port.
Definition: RubyPort.cc:173
AddrRangeList getAddrRanges() const
Get a list of the non-overlapping address ranges the owner is responsible for.
Definition: RubyPort.cc:511
std::vector< MemSlavePort * >::iterator CpuPortIter
Vector of M5 Ports attached to this Ruby port.
Definition: RubyPort.hh:216
BaseMasterPort & getMasterPort(const std::string &if_name, PortID idx=InvalidPortID) override
Get a master port with a given name and index.
Definition: RubyPort.cc:91
DrainState drain() override
Notify an object that it needs to drain its state.
Definition: RubyPort.cc:425
MemSlavePort(const std::string &_name, RubyPort *_port, bool _access_backing_store, PortID id, bool _no_retry_on_stall)
Definition: RubyPort.cc:162
MemSlavePort * port
Definition: RubyPort.hh:141

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