gem5  v20.1.0.0
RubyPort.hh
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2012-2013,2019 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 
50 #include "mem/ruby/protocol/RequestStatus.hh"
52 #include "mem/tport.hh"
53 #include "params/RubyPort.hh"
54 #include "sim/clocked_object.hh"
55 
56 class AbstractController;
57 
58 class RubyPort : public ClockedObject
59 {
60  public:
62  {
63  private:
66 
67  public:
68  MemRequestPort(const std::string &_name, RubyPort *_port);
69 
70  protected:
71  bool recvTimingResp(PacketPtr pkt);
72  void recvRangeChange() {}
73  };
74 
76  {
77  private:
81 
82  public:
83  MemResponsePort(const std::string &_name, RubyPort *_port,
84  bool _access_backing_store,
85  PortID id, bool _no_retry_on_stall);
86  void hitCallback(PacketPtr pkt);
87  void evictionCallback(Addr address);
88 
89  protected:
90  bool recvTimingReq(PacketPtr pkt);
91 
93 
94  void recvFunctional(PacketPtr pkt);
95 
97  { AddrRangeList ranges; return ranges; }
98 
99  void addToRetryList();
100 
101  private:
102  bool isPhysMemAddress(PacketPtr pkt) const;
103  };
104 
106  {
107  private:
110 
111  public:
112  PioRequestPort(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  PioResponsePort(const std::string &_name, RubyPort *_port);
126 
127  protected:
128  bool recvTimingReq(PacketPtr pkt);
129 
131 
133  { panic("recvFunctional should never be called on pio response "
134  "port!"); }
135 
137  };
138 
140  {
142  SenderState(MemResponsePort * _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  Port &getPort(const std::string &if_name,
153  PortID idx=InvalidPortID) override;
154 
155  virtual RequestStatus makeRequest(PacketPtr pkt) = 0;
156  virtual int outstandingCount() const = 0;
157  virtual bool isDeadlockEventScheduled() const = 0;
158  virtual void descheduleDeadlockEvent() = 0;
159 
160  //
161  // Called by the controller to give the sequencer a pointer.
162  // A pointer to the controller is needed for atomic support.
163  //
164  void setController(AbstractController* _cntrl) { m_controller = _cntrl; }
165  uint32_t getId() { return m_version; }
166  DrainState drain() override;
167 
168  bool isCPUSequencer() { return m_isCPUSequencer; }
169 
170  virtual int functionalWrite(Packet *func_pkt);
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 request_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__
MachineID.hh
SnoopRespPacketQueue
Definition: packet_queue.hh:258
RubyPort::MemResponsePort::recvAtomic
Tick recvAtomic(PacketPtr pkt)
Receive an atomic request packet from the peer.
Definition: RubyPort.cc:310
RubyPort::isDeadlockEventScheduled
virtual bool isDeadlockEventScheduled() const =0
RubyPort::m_usingRubyTester
bool m_usingRubyTester
Definition: RubyPort.hh:192
RubyPort::ruby_hit_callback
void ruby_hit_callback(PacketPtr pkt)
Definition: RubyPort.cc:432
RubyPort::init
void init() override
init() is called after all C++ SimObjects have been created and all ports are connected.
Definition: RubyPort.cc:85
RubyPort::Params
RubyPortParams Params
Definition: RubyPort.hh:146
InvalidPortID
const PortID InvalidPortID
Definition: types.hh:238
RubyPort::~RubyPort
virtual ~RubyPort()
Definition: RubyPort.hh:148
RubyPort::PioRequestPort::recvTimingResp
bool recvTimingResp(PacketPtr pkt)
Receive a timing response from the peer.
Definition: RubyPort.cc:160
RubyPort::MemResponsePort::addToRetryList
void addToRetryList()
Definition: RubyPort.cc:355
RubyPort::PioResponsePort::recvAtomic
Tick recvAtomic(PacketPtr pkt)
Receive an atomic request packet from the peer.
Definition: RubyPort.cc:218
RubyPort::PioResponsePort::recvTimingReq
bool recvTimingReq(PacketPtr pkt)
Receive a timing request from the peer.
Definition: RubyPort.cc:197
RubyPort::testDrainComplete
void testDrainComplete()
Definition: RubyPort.cc:481
RubyPort::RubyPort
RubyPort(const Params *p)
Definition: RubyPort.cc:54
RubyPort::recvTimingResp
bool recvTimingResp(PacketPtr pkt, PortID request_port_id)
Called by the PIO port when receiving a timing response.
RubyPort::PioResponsePort::recvFunctional
void recvFunctional(PacketPtr pkt)
Receive a functional request packet from the peer.
Definition: RubyPort.hh:132
Tick
uint64_t Tick
Tick count type.
Definition: types.hh:63
RubyPort::SenderState::SenderState
SenderState(MemResponsePort *_port)
Definition: RubyPort.hh:142
PortID
int16_t PortID
Port index/ID type, and a symbolic name for an invalid port id.
Definition: types.hh:237
RubyPort::MemResponsePort::no_retry_on_stall
bool no_retry_on_stall
Definition: RubyPort.hh:80
RubyPort::drain
DrainState drain() override
Draining is the process of clearing out the states of SimObjects.These are the SimObjects that are pa...
Definition: RubyPort.cc:495
std::vector
STL vector class.
Definition: stl.hh:37
AbstractController
Definition: AbstractController.hh:74
RubyPort::MemResponsePort::recvFunctional
void recvFunctional(PacketPtr pkt)
Receive a functional request packet from the peer.
Definition: RubyPort.cc:370
RubyPort::getPort
Port & getPort(const std::string &if_name, PortID idx=InvalidPortID) override
Get a port with a given name and index.
Definition: RubyPort.cc:92
RubyPort::PioResponsePort::getAddrRanges
AddrRangeList getAddrRanges() const
Get a list of the non-overlapping address ranges the owner is responsible for.
Definition: RubyPort.cc:590
RubyPort::onRetryList
bool onRetryList(MemResponsePort *port)
Definition: RubyPort.hh:198
RubyPort::getId
uint32_t getId()
Definition: RubyPort.hh:165
RubyPort::MemRequestPort::MemRequestPort
MemRequestPort(const std::string &_name, RubyPort *_port)
Definition: RubyPort.cc:139
RubyPort::makeRequest
virtual RequestStatus makeRequest(PacketPtr pkt)=0
RubyPort::m_isCPUSequencer
bool m_isCPUSequencer
Definition: RubyPort.hh:225
RubyPort::PioRequestPort::snoopRespQueue
SnoopRespPacketQueue snoopRespQueue
Definition: RubyPort.hh:109
ClockedObject
The ClockedObject class extends the SimObject with a clock and accessor functions to relate ticks to ...
Definition: clocked_object.hh:231
RubyPort::m_mandatory_q_ptr
MessageBuffer * m_mandatory_q_ptr
Definition: RubyPort.hh:191
RubyPort::m_controller
AbstractController * m_controller
Definition: RubyPort.hh:190
DrainState
DrainState
Object drain/handover states.
Definition: drain.hh:71
RubyPort::response_ports
std::vector< MemResponsePort * > response_ports
Definition: RubyPort.hh:195
RubyPort::MemResponsePort
Definition: RubyPort.hh:75
Packet::SenderState
A virtual base opaque structure used to hold state associated with the packet (e.g....
Definition: packet.hh:431
RubyPort::MemRequestPort
Definition: RubyPort.hh:61
QueuedRequestPort
The QueuedRequestPort combines two queues, a request queue and a snoop response queue,...
Definition: qport.hh:106
System
Definition: system.hh:73
RubySystem
Definition: RubySystem.hh:52
RubyPort
Definition: RubyPort.hh:58
Port
Ports are used to interface objects to each other.
Definition: port.hh:56
RubyPort::MemResponsePort::MemResponsePort
MemResponsePort(const std::string &_name, RubyPort *_port, bool _access_backing_store, PortID id, bool _no_retry_on_stall)
Definition: RubyPort.cc:148
RubyPort::PioResponsePort
Definition: RubyPort.hh:119
QueuedResponsePort
A queued port is a port that has an infinite queue for outgoing packets and thus decouples the module...
Definition: qport.hh:58
RubyPort::PioRequestPort
Definition: RubyPort.hh:105
RubyPort::memRequestPort
MemRequestPort memRequestPort
Definition: RubyPort.hh:211
RubyPort::system
System * system
Definition: RubyPort.hh:193
RubyPort::MemRequestPort::reqQueue
ReqPacketQueue reqQueue
Definition: RubyPort.hh:64
RubySystem.hh
RubyPort::memResponsePort
MemResponsePort memResponsePort
Definition: RubyPort.hh:212
Addr
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
Definition: types.hh:142
RespPacketQueue
Definition: packet_queue.hh:296
RubyPort::functionalWrite
virtual int functionalWrite(Packet *func_pkt)
Definition: RubyPort.cc:648
RubyPort::PioResponsePort::PioResponsePort
PioResponsePort(const std::string &_name, RubyPort *_port)
Definition: RubyPort.cc:132
RubyPort::MemResponsePort::access_backing_store
bool access_backing_store
Definition: RubyPort.hh:79
RubyPort::pioRequestPort
PioRequestPort pioRequestPort
Definition: RubyPort.hh:209
RubyPort::addToRetryList
void addToRetryList(MemResponsePort *port)
Definition: RubyPort.hh:203
RubyPort::MemResponsePort::evictionCallback
void evictionCallback(Addr address)
RubyPort::MemRequestPort::recvTimingResp
bool recvTimingResp(PacketPtr pkt)
Receive a timing response from the peer.
Definition: RubyPort.cc:171
MessageBuffer.hh
RubyPort::PioRequestPort::recvRangeChange
void recvRangeChange()
Called to receive an address range change from the peer response port.
Definition: RubyPort.cc:638
tport.hh
RubyPort::retryList
std::vector< MemResponsePort * > retryList
Definition: RubyPort.hh:223
RubyPort::request_ports
std::vector< PioRequestPort * > request_ports
Definition: RubyPort.hh:217
clocked_object.hh
RubyPort::descheduleDeadlockEvent
virtual void descheduleDeadlockEvent()=0
Packet
A Packet is used to encapsulate a transfer between two objects in the memory system (e....
Definition: packet.hh:257
RubyPort::SenderState::port
MemResponsePort * port
Definition: RubyPort.hh:141
RubyPort::MemResponsePort::hitCallback
void hitCallback(PacketPtr pkt)
Definition: RubyPort.cc:515
RubyPort::setController
void setController(AbstractController *_cntrl)
Definition: RubyPort.hh:164
RubyPort::MemRequestPort::snoopRespQueue
SnoopRespPacketQueue snoopRespQueue
Definition: RubyPort.hh:65
RubyPort::PioRequestPort::PioRequestPort
PioRequestPort(const std::string &_name, RubyPort *_port)
Definition: RubyPort.cc:124
RubyPort::pioResponsePort
PioResponsePort pioResponsePort
Definition: RubyPort.hh:210
RubyPort::outstandingCount
virtual int outstandingCount() const =0
RubyPort::gotAddrRanges
unsigned int gotAddrRanges
Definition: RubyPort.hh:213
RubyPort::isCPUSequencer
bool isCPUSequencer()
Definition: RubyPort.hh:168
MipsISA::p
Bitfield< 0 > p
Definition: pra_constants.hh:323
std::list< AddrRange >
MessageBuffer
Definition: MessageBuffer.hh:68
RubyPort::trySendRetries
void trySendRetries()
Definition: RubyPort.cc:455
RubyPort::MemResponsePort::isPhysMemAddress
bool isPhysMemAddress(PacketPtr pkt) const
Definition: RubyPort.cc:606
RubyPort::m_ruby_system
RubySystem * m_ruby_system
Definition: RubyPort.hh:188
RubyPort::m_version
uint32_t m_version
Definition: RubyPort.hh:189
RubyPort::MemRequestPort::recvRangeChange
void recvRangeChange()
Called to receive an address range change from the peer response port.
Definition: RubyPort.hh:72
RubyPort::MemResponsePort::getAddrRanges
AddrRangeList getAddrRanges() const
Get a list of the non-overlapping address ranges the owner is responsible for.
Definition: RubyPort.hh:96
RubyPort::SenderState
Definition: RubyPort.hh:139
ReqPacketQueue
Definition: packet_queue.hh:222
RubyPort::CpuPortIter
std::vector< MemResponsePort * >::iterator CpuPortIter
Vector of M5 Ports attached to this Ruby port.
Definition: RubyPort.hh:216
RubyPort::ruby_eviction_callback
void ruby_eviction_callback(Addr address)
Definition: RubyPort.cc:614
RubyPort::MemResponsePort::queue
RespPacketQueue queue
Definition: RubyPort.hh:78
RubyPort::MemResponsePort::recvTimingReq
bool recvTimingReq(PacketPtr pkt)
Receive a timing request from the peer.
Definition: RubyPort.cc:238
RubyPort::PioResponsePort::queue
RespPacketQueue queue
Definition: RubyPort.hh:122
RubyPort::PioRequestPort::reqQueue
ReqPacketQueue reqQueue
Definition: RubyPort.hh:108
panic
#define panic(...)
This implements a cprintf based panic() function.
Definition: logging.hh:171

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