gem5  [DEVELOP-FOR-23.0]
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
RubyPort.hh
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2012-2013,2019,2021 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 namespace gem5
57 {
58 
59 namespace ruby
60 {
61 
62 class AbstractController;
63 
64 class RubyPort : public ClockedObject
65 {
66  public:
68  {
69  private:
73 
74  public:
75  MemRequestPort(const std::string &_name, RubyPort& _port);
76 
77  protected:
78  bool recvTimingResp(PacketPtr pkt);
79  void recvRangeChange() {}
80  };
81 
83  {
84  private:
89 
90  public:
91  MemResponsePort(const std::string &_name,
92  RubyPort& _port,
93  bool _access_backing_store,
94  PortID id, bool _no_retry_on_stall);
95  void hitCallback(PacketPtr pkt);
96  void evictionCallback(Addr address);
97 
98  protected:
99  bool recvTimingReq(PacketPtr pkt);
100 
102 
103  void recvFunctional(PacketPtr pkt);
104 
106  { AddrRangeList ranges; return ranges; }
107 
108  void addToRetryList();
109 
110  private:
111  bool isShadowRomAddress(Addr addr) const;
112  bool isPhysMemAddress(PacketPtr pkt) const;
113  };
114 
116  {
117  private:
121 
122  public:
123  PioRequestPort(const std::string &_name, RubyPort& _port);
124 
125  protected:
126  bool recvTimingResp(PacketPtr pkt);
127  void recvRangeChange();
128  };
129 
131  {
132  private:
135 
136  public:
137  PioResponsePort(const std::string &_name, RubyPort& _port);
138 
139  protected:
140  bool recvTimingReq(PacketPtr pkt);
141 
143 
145  { panic("recvFunctional should never be called on pio response "
146  "port!"); }
147 
149  };
150 
152  {
154  SenderState(MemResponsePort * _port) : port(_port)
155  {}
156  };
157 
158  typedef RubyPortParams Params;
159  RubyPort(const Params &p);
160  virtual ~RubyPort() {}
161 
162  void init() override;
163 
164  Port &getPort(const std::string &if_name,
165  PortID idx=InvalidPortID) override;
166 
167  virtual RequestStatus makeRequest(PacketPtr pkt) = 0;
168  virtual int outstandingCount() const = 0;
169  virtual bool isDeadlockEventScheduled() const = 0;
170  virtual void descheduleDeadlockEvent() = 0;
171 
172  //
173  // Called by the controller to give the sequencer a pointer.
174  // A pointer to the controller is needed for atomic support.
175  //
176  void setController(AbstractController* _cntrl) { m_controller = _cntrl; }
177  uint32_t getId() { return m_version; }
178  DrainState drain() override;
179 
180  bool isCPUSequencer() { return m_isCPUSequencer; }
181 
182  virtual int functionalWrite(Packet *func_pkt);
183 
184  protected:
185  void trySendRetries();
186  void ruby_hit_callback(PacketPtr pkt);
189  void testDrainComplete();
190  void ruby_eviction_callback(Addr address);
191 
200  bool recvTimingResp(PacketPtr pkt, PortID request_port_id);
201 
203  uint32_t m_version;
208 
210 
211  private:
213  {
214  return (std::find(retryList.begin(), retryList.end(), port) !=
215  retryList.end());
216  }
218  {
219  if (onRetryList(port)) return;
220  retryList.push_back(port);
221  }
222 
227  unsigned int gotAddrRanges;
228 
232 
233  //
234  // Based on similar code in the M5 bus. Stores pointers to those ports
235  // that should be called when the Sequencer becomes available after a stall.
236  //
238 
240 };
241 
242 } // namespace ruby
243 } // namespace gem5
244 
245 #endif // __MEM_RUBY_SYSTEM_RUBYPORT_HH__
MachineID.hh
gem5::ruby::RubyPort::MemResponsePort::evictionCallback
void evictionCallback(Addr address)
gem5::PortID
int16_t PortID
Port index/ID type, and a symbolic name for an invalid port id.
Definition: types.hh:245
gem5::ruby::RubyPort::m_version
uint32_t m_version
Definition: RubyPort.hh:203
gem5::ruby::RubyPort::SenderState::port
MemResponsePort * port
Definition: RubyPort.hh:153
gem5::ruby::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:104
gem5::ruby::RubyPort::isCPUSequencer
bool isCPUSequencer()
Definition: RubyPort.hh:180
gem5::ruby::RubyPort::MemResponsePort::MemResponsePort
MemResponsePort(const std::string &_name, RubyPort &_port, bool _access_backing_store, PortID id, bool _no_retry_on_stall)
Definition: RubyPort.cc:164
gem5::RespPacketQueue
Definition: packet_queue.hh:300
gem5::ruby::RubyPort::descheduleDeadlockEvent
virtual void descheduleDeadlockEvent()=0
gem5::ruby::RubyPort::PioRequestPort::recvRangeChange
void recvRangeChange()
Called to receive an address range change from the peer response port.
Definition: RubyPort.cc:719
gem5::ruby::RubyPort::MemResponsePort::recvFunctional
void recvFunctional(PacketPtr pkt)
Receive a functional request packet from the peer.
Definition: RubyPort.cc:391
gem5::QueuedRequestPort
The QueuedRequestPort combines two queues, a request queue and a snoop response queue,...
Definition: qport.hh:110
gem5::ruby::RubyPort::CpuPortIter
std::vector< MemResponsePort * >::iterator CpuPortIter
Vector of M5 Ports attached to this Ruby port.
Definition: RubyPort.hh:230
gem5::ruby::RubyPort::system
System * system
Definition: RubyPort.hh:207
gem5::ruby::RubyPort::memResponsePort
MemResponsePort memResponsePort
Definition: RubyPort.hh:226
gem5::ruby::RubyPort::response_ports
std::vector< MemResponsePort * > response_ports
Definition: RubyPort.hh:209
gem5::ruby::RubyPort::pioResponsePort
PioResponsePort pioResponsePort
Definition: RubyPort.hh:224
gem5::ruby::RubyPort::MemResponsePort
Definition: RubyPort.hh:82
gem5::ruby::RubyPort::MemRequestPort::recvTimingResp
bool recvTimingResp(PacketPtr pkt)
Receive a timing response from the peer.
Definition: RubyPort.cc:188
gem5::ruby::RubyPort::SenderState::SenderState
SenderState(MemResponsePort *_port)
Definition: RubyPort.hh:154
gem5::ruby::RubyPort::MemResponsePort::access_backing_store
bool access_backing_store
Definition: RubyPort.hh:87
gem5::ruby::RubyPort::MemResponsePort::owner
RubyPort & owner
Definition: RubyPort.hh:85
gem5::ruby::RubyPort::PioRequestPort::reqQueue
ReqPacketQueue reqQueue
Definition: RubyPort.hh:119
gem5::ruby::RubyPort::MemResponsePort::recvAtomic
Tick recvAtomic(PacketPtr pkt)
Receive an atomic request packet from the peer.
Definition: RubyPort.cc:322
gem5::ruby::RubyPort::ruby_hit_callback
void ruby_hit_callback(PacketPtr pkt)
Definition: RubyPort.cc:452
gem5::ruby::RubyPort::PioResponsePort::PioResponsePort
PioResponsePort(const std::string &_name, RubyPort &_port)
Definition: RubyPort.cc:146
std::vector
STL vector class.
Definition: stl.hh:37
gem5::ruby::RubyPort::retryList
std::vector< MemResponsePort * > retryList
Definition: RubyPort.hh:237
gem5::ruby::RubyPort::trySendRetries
void trySendRetries()
Definition: RubyPort.cc:523
gem5::InvalidPortID
const PortID InvalidPortID
Definition: types.hh:246
gem5::ruby::RubyPort::PioResponsePort
Definition: RubyPort.hh:130
gem5::ruby::RubyPort::MemResponsePort::isShadowRomAddress
bool isShadowRomAddress(Addr addr) const
Definition: RubyPort.cc:673
gem5::ruby::AbstractController
Definition: AbstractController.hh:83
gem5::ruby::RubyPort::recvTimingResp
bool recvTimingResp(PacketPtr pkt, PortID request_port_id)
Called by the PIO port when receiving a timing response.
gem5::ruby::RubyPort::SenderState
Definition: RubyPort.hh:151
gem5::ruby::RubyPort::MemResponsePort::hitCallback
void hitCallback(PacketPtr pkt)
Definition: RubyPort.cc:583
gem5::ruby::RubyPort::ruby_stale_translation_callback
void ruby_stale_translation_callback(Addr txnId)
Definition: RubyPort.cc:494
gem5::ruby::RubyPort::PioRequestPort::owner
RubyPort & owner
Definition: RubyPort.hh:118
gem5::ruby::RubyPort::m_mandatory_q_ptr
MessageBuffer * m_mandatory_q_ptr
Definition: RubyPort.hh:205
gem5::ruby::RubyPort::PioRequestPort::PioRequestPort
PioRequestPort(const std::string &_name, RubyPort &_port)
Definition: RubyPort.cc:136
gem5::ruby::RubyPort::gotAddrRanges
unsigned int gotAddrRanges
Definition: RubyPort.hh:227
gem5::DrainState
DrainState
Object drain/handover states.
Definition: drain.hh:74
gem5::ruby::RubyPort::MemResponsePort::isPhysMemAddress
bool isPhysMemAddress(PacketPtr pkt) const
Definition: RubyPort.cc:687
gem5::ruby::RubyPort::init
void init() override
init() is called after all C++ SimObjects have been created and all ports are connected.
Definition: RubyPort.cc:92
gem5::ruby::RubyPort::m_usingRubyTester
bool m_usingRubyTester
Definition: RubyPort.hh:206
gem5::System
Definition: system.hh:74
gem5::ruby::RubyPort::setController
void setController(AbstractController *_cntrl)
Definition: RubyPort.hh:176
gem5::ruby::RubyPort::makeRequest
virtual RequestStatus makeRequest(PacketPtr pkt)=0
gem5::ruby::RubyPort::ruby_eviction_callback
void ruby_eviction_callback(Addr address)
Definition: RubyPort.cc:695
gem5::VegaISA::p
Bitfield< 54 > p
Definition: pagetable.hh:70
gem5::QueuedResponsePort
A queued port is a port that has an infinite queue for outgoing packets and thus decouples the module...
Definition: qport.hh:61
gem5::Packet
A Packet is used to encapsulate a transfer between two objects in the memory system (e....
Definition: packet.hh:294
gem5::ruby::RubyPort::MemRequestPort::recvRangeChange
void recvRangeChange()
Called to receive an address range change from the peer response port.
Definition: RubyPort.hh:79
gem5::Tick
uint64_t Tick
Tick count type.
Definition: types.hh:58
gem5::ruby::RubyPort::MemResponsePort::queue
RespPacketQueue queue
Definition: RubyPort.hh:86
gem5::ruby::RubyPort::request_ports
std::vector< PioRequestPort * > request_ports
Definition: RubyPort.hh:231
gem5::ruby::RubyPort::PioResponsePort::queue
RespPacketQueue queue
Definition: RubyPort.hh:134
gem5::ruby::RubyPort::MemResponsePort::no_retry_on_stall
bool no_retry_on_stall
Definition: RubyPort.hh:88
gem5::ruby::RubyPort::isDeadlockEventScheduled
virtual bool isDeadlockEventScheduled() const =0
gem5::ruby::RubyPort::RubyPort
RubyPort(const Params &p)
Definition: RubyPort.cc:61
gem5::ruby::RubyPort::outstandingCount
virtual int outstandingCount() const =0
gem5::ruby::RubyPort::memRequestPort
MemRequestPort memRequestPort
Definition: RubyPort.hh:225
gem5::ruby::RubyPort::MemRequestPort
Definition: RubyPort.hh:67
gem5::Packet::SenderState
A virtual base opaque structure used to hold state associated with the packet (e.g....
Definition: packet.hh:468
RubySystem.hh
gem5::ruby::RubyPort::testDrainComplete
void testDrainComplete()
Definition: RubyPort.cc:549
gem5::Addr
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
Definition: types.hh:147
gem5::ruby::RubyPort::ruby_unaddressed_callback
void ruby_unaddressed_callback(PacketPtr pkt)
Definition: RubyPort.cc:475
gem5::ruby::RubyPort::PioResponsePort::recvFunctional
void recvFunctional(PacketPtr pkt)
Receive a functional request packet from the peer.
Definition: RubyPort.hh:144
gem5::ruby::RubyPort::PioRequestPort
Definition: RubyPort.hh:115
gem5::ruby::RubyPort::m_ruby_system
RubySystem * m_ruby_system
Definition: RubyPort.hh:202
gem5::ClockedObject
The ClockedObject class extends the SimObject with a clock and accessor functions to relate ticks to ...
Definition: clocked_object.hh:234
gem5::ruby::RubyPort::MemRequestPort::reqQueue
ReqPacketQueue reqQueue
Definition: RubyPort.hh:71
MessageBuffer.hh
gem5::ruby::RubySystem
Definition: RubySystem.hh:63
gem5::ruby::RubyPort::functionalWrite
virtual int functionalWrite(Packet *func_pkt)
Definition: RubyPort.cc:729
gem5::ruby::RubyPort::MemRequestPort::owner
RubyPort & owner
Definition: RubyPort.hh:70
gem5::ruby::RubyPort::PioResponsePort::getAddrRanges
AddrRangeList getAddrRanges() const
Get a list of the non-overlapping address ranges the owner is responsible for.
Definition: RubyPort.cc:658
gem5::ruby::RubyPort::PioResponsePort::recvAtomic
Tick recvAtomic(PacketPtr pkt)
Receive an atomic request packet from the peer.
Definition: RubyPort.cc:233
gem5::Port
Ports are used to interface objects to each other.
Definition: port.hh:61
gem5::ruby::RubyPort::Params
RubyPortParams Params
Definition: RubyPort.hh:158
tport.hh
gem5::ruby::RubyPort::m_controller
AbstractController * m_controller
Definition: RubyPort.hh:204
clocked_object.hh
gem5::ruby::RubyPort::addToRetryList
void addToRetryList(MemResponsePort *port)
Definition: RubyPort.hh:217
gem5::ruby::RubyPort::m_isCPUSequencer
bool m_isCPUSequencer
Definition: RubyPort.hh:239
gem5::ReqPacketQueue
Definition: packet_queue.hh:226
gem5::ruby::RubyPort::onRetryList
bool onRetryList(MemResponsePort *port)
Definition: RubyPort.hh:212
gem5::ruby::MessageBuffer
Definition: MessageBuffer.hh:74
std::list< AddrRange >
gem5::SnoopRespPacketQueue
Definition: packet_queue.hh:262
gem5::ruby::RubyPort::PioResponsePort::recvTimingReq
bool recvTimingReq(PacketPtr pkt)
Receive a timing request from the peer.
Definition: RubyPort.cc:213
gem5
Reference material can be found at the JEDEC website: UFS standard http://www.jedec....
Definition: gpu_translation_state.hh:37
gem5::ruby::RubyPort::MemResponsePort::addToRetryList
void addToRetryList()
Definition: RubyPort.cc:377
gem5::ruby::RubyPort::~RubyPort
virtual ~RubyPort()
Definition: RubyPort.hh:160
gem5::ruby::RubyPort::PioRequestPort::snoopRespQueue
SnoopRespPacketQueue snoopRespQueue
Definition: RubyPort.hh:120
gem5::ruby::RubyPort
Definition: RubyPort.hh:64
gem5::ruby::RubyPort::PioResponsePort::owner
RubyPort & owner
Definition: RubyPort.hh:133
gem5::ruby::RubyPort::MemRequestPort::snoopRespQueue
SnoopRespPacketQueue snoopRespQueue
Definition: RubyPort.hh:72
gem5::ruby::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:563
gem5::Named::_name
const std::string _name
Definition: named.hh:41
gem5::ruby::RubyPort::MemResponsePort::recvTimingReq
bool recvTimingReq(PacketPtr pkt)
Receive a timing request from the peer.
Definition: RubyPort.cc:252
panic
#define panic(...)
This implements a cprintf based panic() function.
Definition: logging.hh:188
gem5::ruby::RubyPort::MemResponsePort::getAddrRanges
AddrRangeList getAddrRanges() const
Get a list of the non-overlapping address ranges the owner is responsible for.
Definition: RubyPort.hh:105
gem5::X86ISA::addr
Bitfield< 3 > addr
Definition: types.hh:84
gem5::ruby::RubyPort::MemRequestPort::MemRequestPort
MemRequestPort(const std::string &_name, RubyPort &_port)
Definition: RubyPort.cc:153
gem5::ruby::RubyPort::getId
uint32_t getId()
Definition: RubyPort.hh:177
gem5::ruby::RubyPort::PioRequestPort::recvTimingResp
bool recvTimingResp(PacketPtr pkt)
Receive a timing response from the peer.
Definition: RubyPort.cc:178
gem5::ruby::RubyPort::pioRequestPort
PioRequestPort pioRequestPort
Definition: RubyPort.hh:223

Generated on Sun Jul 30 2023 01:56:59 for gem5 by doxygen 1.8.17