gem5  v21.1.0.2
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 namespace gem5
57 {
58 
59 namespace ruby
60 {
61 
62 class AbstractController;
63 
64 class RubyPort : public ClockedObject
65 {
66  public:
68  {
69  private:
72 
73  public:
74  MemRequestPort(const std::string &_name, RubyPort *_port);
75 
76  protected:
77  bool recvTimingResp(PacketPtr pkt);
78  void recvRangeChange() {}
79  };
80 
82  {
83  private:
87 
88  public:
89  MemResponsePort(const std::string &_name, RubyPort *_port,
90  bool _access_backing_store,
91  PortID id, bool _no_retry_on_stall);
92  void hitCallback(PacketPtr pkt);
93  void evictionCallback(Addr address);
94 
95  protected:
96  bool recvTimingReq(PacketPtr pkt);
97 
99 
100  void recvFunctional(PacketPtr pkt);
101 
103  { AddrRangeList ranges; return ranges; }
104 
105  void addToRetryList();
106 
107  private:
108  bool isShadowRomAddress(Addr addr) const;
109  bool isPhysMemAddress(PacketPtr pkt) const;
110  };
111 
113  {
114  private:
117 
118  public:
119  PioRequestPort(const std::string &_name, RubyPort *_port);
120 
121  protected:
122  bool recvTimingResp(PacketPtr pkt);
123  void recvRangeChange();
124  };
125 
127  {
128  private:
130 
131  public:
132  PioResponsePort(const std::string &_name, RubyPort *_port);
133 
134  protected:
135  bool recvTimingReq(PacketPtr pkt);
136 
138 
140  { panic("recvFunctional should never be called on pio response "
141  "port!"); }
142 
144  };
145 
147  {
149  SenderState(MemResponsePort * _port) : port(_port)
150  {}
151  };
152 
153  typedef RubyPortParams Params;
154  RubyPort(const Params &p);
155  virtual ~RubyPort() {}
156 
157  void init() override;
158 
159  Port &getPort(const std::string &if_name,
160  PortID idx=InvalidPortID) override;
161 
162  virtual RequestStatus makeRequest(PacketPtr pkt) = 0;
163  virtual int outstandingCount() const = 0;
164  virtual bool isDeadlockEventScheduled() const = 0;
165  virtual void descheduleDeadlockEvent() = 0;
166 
167  //
168  // Called by the controller to give the sequencer a pointer.
169  // A pointer to the controller is needed for atomic support.
170  //
171  void setController(AbstractController* _cntrl) { m_controller = _cntrl; }
172  uint32_t getId() { return m_version; }
173  DrainState drain() override;
174 
175  bool isCPUSequencer() { return m_isCPUSequencer; }
176 
177  virtual int functionalWrite(Packet *func_pkt);
178 
179  protected:
180  void trySendRetries();
181  void ruby_hit_callback(PacketPtr pkt);
182  void testDrainComplete();
183  void ruby_eviction_callback(Addr address);
184 
193  bool recvTimingResp(PacketPtr pkt, PortID request_port_id);
194 
196  uint32_t m_version;
201 
203 
204  private:
206  {
207  return (std::find(retryList.begin(), retryList.end(), port) !=
208  retryList.end());
209  }
211  {
212  if (onRetryList(port)) return;
213  retryList.push_back(port);
214  }
215 
220  unsigned int gotAddrRanges;
221 
225 
226  //
227  // Based on similar code in the M5 bus. Stores pointers to those ports
228  // that should be called when the Sequencer becomes available after a stall.
229  //
231 
233 };
234 
235 } // namespace ruby
236 } // namespace gem5
237 
238 #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:252
gem5::ruby::RubyPort::m_version
uint32_t m_version
Definition: RubyPort.hh:196
gem5::ruby::RubyPort::SenderState::port
MemResponsePort * port
Definition: RubyPort.hh:148
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:101
gem5::ruby::RubyPort::isCPUSequencer
bool isCPUSequencer()
Definition: RubyPort.hh:175
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:664
gem5::ruby::RubyPort::MemResponsePort::recvFunctional
void recvFunctional(PacketPtr pkt)
Receive a functional request packet from the peer.
Definition: RubyPort.cc:379
gem5::QueuedRequestPort
The QueuedRequestPort combines two queues, a request queue and a snoop response queue,...
Definition: qport.hh:109
gem5::ruby::RubyPort::CpuPortIter
std::vector< MemResponsePort * >::iterator CpuPortIter
Vector of M5 Ports attached to this Ruby port.
Definition: RubyPort.hh:223
gem5::ruby::RubyPort::system
System * system
Definition: RubyPort.hh:200
gem5::ruby::RubyPort::memResponsePort
MemResponsePort memResponsePort
Definition: RubyPort.hh:219
gem5::ruby::RubyPort::response_ports
std::vector< MemResponsePort * > response_ports
Definition: RubyPort.hh:202
gem5::ruby::RubyPort::pioResponsePort
PioResponsePort pioResponsePort
Definition: RubyPort.hh:217
gem5::ruby::RubyPort::MemResponsePort
Definition: RubyPort.hh:81
gem5::ruby::RubyPort::MemRequestPort::recvTimingResp
bool recvTimingResp(PacketPtr pkt)
Receive a timing response from the peer.
Definition: RubyPort.cc:180
gem5::ruby::RubyPort::SenderState::SenderState
SenderState(MemResponsePort *_port)
Definition: RubyPort.hh:149
gem5::ruby::RubyPort::MemResponsePort::access_backing_store
bool access_backing_store
Definition: RubyPort.hh:85
gem5::ruby::RubyPort::PioRequestPort::reqQueue
ReqPacketQueue reqQueue
Definition: RubyPort.hh:115
gem5::ruby::RubyPort::MemResponsePort::recvAtomic
Tick recvAtomic(PacketPtr pkt)
Receive an atomic request packet from the peer.
Definition: RubyPort.cc:319
gem5::ruby::RubyPort::ruby_hit_callback
void ruby_hit_callback(PacketPtr pkt)
Definition: RubyPort.cc:441
std::vector
STL vector class.
Definition: stl.hh:37
gem5::ruby::RubyPort::retryList
std::vector< MemResponsePort * > retryList
Definition: RubyPort.hh:230
gem5::ruby::RubyPort::trySendRetries
void trySendRetries()
Definition: RubyPort.cc:464
gem5::InvalidPortID
const PortID InvalidPortID
Definition: types.hh:253
gem5::ruby::RubyPort::PioResponsePort
Definition: RubyPort.hh:126
gem5::ruby::RubyPort::MemResponsePort::isShadowRomAddress
bool isShadowRomAddress(Addr addr) const
Definition: RubyPort.cc:616
gem5::ruby::AbstractController
Definition: AbstractController.hh:82
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:146
gem5::ruby::RubyPort::MemResponsePort::hitCallback
void hitCallback(PacketPtr pkt)
Definition: RubyPort.cc:524
gem5::ruby::RubyPort::m_mandatory_q_ptr
MessageBuffer * m_mandatory_q_ptr
Definition: RubyPort.hh:198
gem5::ruby::RubyPort::gotAddrRanges
unsigned int gotAddrRanges
Definition: RubyPort.hh:220
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:157
gem5::DrainState
DrainState
Object drain/handover states.
Definition: drain.hh:74
gem5::ruby::RubyPort::MemResponsePort::isPhysMemAddress
bool isPhysMemAddress(PacketPtr pkt) const
Definition: RubyPort.cc:631
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:199
gem5::System
Definition: system.hh:77
gem5::ruby::RubyPort::setController
void setController(AbstractController *_cntrl)
Definition: RubyPort.hh:171
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:640
gem5::ruby::RubyPort::PioResponsePort::PioResponsePort
PioResponsePort(const std::string &_name, RubyPort *_port)
Definition: RubyPort.cc:141
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:283
gem5::ruby::RubyPort::MemRequestPort::recvRangeChange
void recvRangeChange()
Called to receive an address range change from the peer response port.
Definition: RubyPort.hh:78
gem5::MipsISA::p
Bitfield< 0 > p
Definition: pra_constants.hh:326
gem5::Tick
uint64_t Tick
Tick count type.
Definition: types.hh:58
gem5::ruby::RubyPort::MemResponsePort::queue
RespPacketQueue queue
Definition: RubyPort.hh:84
gem5::ruby::RubyPort::request_ports
std::vector< PioRequestPort * > request_ports
Definition: RubyPort.hh:224
gem5::ruby::RubyPort::PioResponsePort::queue
RespPacketQueue queue
Definition: RubyPort.hh:129
gem5::ruby::RubyPort::MemResponsePort::no_retry_on_stall
bool no_retry_on_stall
Definition: RubyPort.hh:86
gem5::ruby::RubyPort::isDeadlockEventScheduled
virtual bool isDeadlockEventScheduled() const =0
gem5::ruby::RubyPort::PioRequestPort::PioRequestPort
PioRequestPort(const std::string &_name, RubyPort *_port)
Definition: RubyPort.cc:133
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:218
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:457
RubySystem.hh
gem5::ruby::RubyPort::testDrainComplete
void testDrainComplete()
Definition: RubyPort.cc:490
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::PioResponsePort::recvFunctional
void recvFunctional(PacketPtr pkt)
Receive a functional request packet from the peer.
Definition: RubyPort.hh:139
gem5::ruby::RubyPort::PioRequestPort
Definition: RubyPort.hh:112
gem5::ruby::RubyPort::m_ruby_system
RubySystem * m_ruby_system
Definition: RubyPort.hh:195
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:70
MessageBuffer.hh
gem5::ruby::RubySystem
Definition: RubySystem.hh:63
gem5::ruby::RubyPort::functionalWrite
virtual int functionalWrite(Packet *func_pkt)
Definition: RubyPort.cc:674
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:600
gem5::ruby::RubyPort::PioResponsePort::recvAtomic
Tick recvAtomic(PacketPtr pkt)
Receive an atomic request packet from the peer.
Definition: RubyPort.cc:227
gem5::Port
Ports are used to interface objects to each other.
Definition: port.hh:61
gem5::ruby::RubyPort::Params
RubyPortParams Params
Definition: RubyPort.hh:153
tport.hh
gem5::ruby::RubyPort::m_controller
AbstractController * m_controller
Definition: RubyPort.hh:197
clocked_object.hh
gem5::ruby::RubyPort::addToRetryList
void addToRetryList(MemResponsePort *port)
Definition: RubyPort.hh:210
gem5::ruby::RubyPort::m_isCPUSequencer
bool m_isCPUSequencer
Definition: RubyPort.hh:232
gem5::ReqPacketQueue
Definition: packet_queue.hh:226
gem5::ruby::RubyPort::onRetryList
bool onRetryList(MemResponsePort *port)
Definition: RubyPort.hh:205
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:206
gem5
Reference material can be found at the JEDEC website: UFS standard http://www.jedec....
Definition: decoder.cc:40
gem5::ruby::RubyPort::MemResponsePort::addToRetryList
void addToRetryList()
Definition: RubyPort.cc:364
gem5::ruby::RubyPort::~RubyPort
virtual ~RubyPort()
Definition: RubyPort.hh:155
gem5::ruby::RubyPort::PioRequestPort::snoopRespQueue
SnoopRespPacketQueue snoopRespQueue
Definition: RubyPort.hh:116
gem5::ruby::RubyPort
Definition: RubyPort.hh:64
gem5::ruby::RubyPort::MemRequestPort::snoopRespQueue
SnoopRespPacketQueue snoopRespQueue
Definition: RubyPort.hh:71
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:504
gem5::ruby::RubyPort::MemRequestPort::MemRequestPort
MemRequestPort(const std::string &_name, RubyPort *_port)
Definition: RubyPort.cc:148
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:247
panic
#define panic(...)
This implements a cprintf based panic() function.
Definition: logging.hh:177
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:102
gem5::X86ISA::addr
Bitfield< 3 > addr
Definition: types.hh:84
gem5::ruby::RubyPort::getId
uint32_t getId()
Definition: RubyPort.hh:172
gem5::ruby::RubyPort::PioRequestPort::recvTimingResp
bool recvTimingResp(PacketPtr pkt)
Receive a timing response from the peer.
Definition: RubyPort.cc:169
gem5::ruby::RubyPort::pioRequestPort
PioRequestPort pioRequestPort
Definition: RubyPort.hh:216

Generated on Tue Sep 21 2021 12:25:42 for gem5 by doxygen 1.8.17