gem5  v22.1.0.0
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:
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);
184  void testDrainComplete();
185  void ruby_eviction_callback(Addr address);
186 
195  bool recvTimingResp(PacketPtr pkt, PortID request_port_id);
196 
198  uint32_t m_version;
203 
205 
206  private:
208  {
209  return (std::find(retryList.begin(), retryList.end(), port) !=
210  retryList.end());
211  }
213  {
214  if (onRetryList(port)) return;
215  retryList.push_back(port);
216  }
217 
222  unsigned int gotAddrRanges;
223 
227 
228  //
229  // Based on similar code in the M5 bus. Stores pointers to those ports
230  // that should be called when the Sequencer becomes available after a stall.
231  //
233 
235 };
236 
237 } // namespace ruby
238 } // namespace gem5
239 
240 #endif // __MEM_RUBY_SYSTEM_RUBYPORT_HH__
The ClockedObject class extends the SimObject with a clock and accessor functions to relate ticks to ...
const std::string _name
Definition: named.hh:41
A Packet is used to encapsulate a transfer between two objects in the memory system (e....
Definition: packet.hh:294
Ports are used to interface objects to each other.
Definition: port.hh:62
The QueuedRequestPort combines two queues, a request queue and a snoop response queue,...
Definition: qport.hh:110
A queued port is a port that has an infinite queue for outgoing packets and thus decouples the module...
Definition: qport.hh:62
bool recvTimingResp(PacketPtr pkt)
Receive a timing response from the peer.
Definition: RubyPort.cc:183
void recvRangeChange()
Called to receive an address range change from the peer response port.
Definition: RubyPort.hh:78
SnoopRespPacketQueue snoopRespQueue
Definition: RubyPort.hh:71
MemRequestPort(const std::string &_name, RubyPort *_port)
Definition: RubyPort.cc:151
bool isShadowRomAddress(Addr addr) const
Definition: RubyPort.cc:677
Tick recvAtomic(PacketPtr pkt)
Receive an atomic request packet from the peer.
Definition: RubyPort.cc:321
void recvFunctional(PacketPtr pkt)
Receive a functional request packet from the peer.
Definition: RubyPort.cc:392
bool recvTimingReq(PacketPtr pkt)
Receive a timing request from the peer.
Definition: RubyPort.cc:250
AddrRangeList getAddrRanges() const
Get a list of the non-overlapping address ranges the owner is responsible for.
Definition: RubyPort.hh:102
MemResponsePort(const std::string &_name, RubyPort *_port, bool _access_backing_store, PortID id, bool _no_retry_on_stall)
Definition: RubyPort.cc:160
bool isPhysMemAddress(PacketPtr pkt) const
Definition: RubyPort.cc:692
void recvRangeChange()
Called to receive an address range change from the peer response port.
Definition: RubyPort.cc:725
SnoopRespPacketQueue snoopRespQueue
Definition: RubyPort.hh:116
bool recvTimingResp(PacketPtr pkt)
Receive a timing response from the peer.
Definition: RubyPort.cc:172
PioRequestPort(const std::string &_name, RubyPort *_port)
Definition: RubyPort.cc:136
PioResponsePort(const std::string &_name, RubyPort *_port)
Definition: RubyPort.cc:144
Tick recvAtomic(PacketPtr pkt)
Receive an atomic request packet from the peer.
Definition: RubyPort.cc:230
void recvFunctional(PacketPtr pkt)
Receive a functional request packet from the peer.
Definition: RubyPort.hh:139
bool recvTimingReq(PacketPtr pkt)
Receive a timing request from the peer.
Definition: RubyPort.cc:209
AddrRangeList getAddrRanges() const
Get a list of the non-overlapping address ranges the owner is responsible for.
Definition: RubyPort.cc:661
void ruby_hit_callback(PacketPtr pkt)
Definition: RubyPort.cc:454
std::vector< MemResponsePort * > response_ports
Definition: RubyPort.hh:204
virtual RequestStatus makeRequest(PacketPtr pkt)=0
void ruby_unaddressed_callback(PacketPtr pkt)
Definition: RubyPort.cc:477
void testDrainComplete()
Definition: RubyPort.cc:551
virtual int outstandingCount() const =0
std::vector< MemResponsePort * >::iterator CpuPortIter
Vector of M5 Ports attached to this Ruby port.
Definition: RubyPort.hh:225
void ruby_stale_translation_callback(Addr txnId)
Definition: RubyPort.cc:496
virtual void descheduleDeadlockEvent()=0
bool recvTimingResp(PacketPtr pkt, PortID request_port_id)
Called by the PIO port when receiving a timing response.
std::vector< MemResponsePort * > retryList
Definition: RubyPort.hh:232
RubySystem * m_ruby_system
Definition: RubyPort.hh:197
MemResponsePort memResponsePort
Definition: RubyPort.hh:221
void init() override
init() is called after all C++ SimObjects have been created and all ports are connected.
Definition: RubyPort.cc:92
PioResponsePort pioResponsePort
Definition: RubyPort.hh:219
bool onRetryList(MemResponsePort *port)
Definition: RubyPort.hh:207
PioRequestPort pioRequestPort
Definition: RubyPort.hh:218
RubyPort(const Params &p)
Definition: RubyPort.cc:61
virtual bool isDeadlockEventScheduled() const =0
virtual int functionalWrite(Packet *func_pkt)
Definition: RubyPort.cc:735
unsigned int gotAddrRanges
Definition: RubyPort.hh:222
void addToRetryList(MemResponsePort *port)
Definition: RubyPort.hh:212
virtual ~RubyPort()
Definition: RubyPort.hh:155
MemRequestPort memRequestPort
Definition: RubyPort.hh:220
Port & getPort(const std::string &if_name, PortID idx=InvalidPortID) override
Get a port with a given name and index.
Definition: RubyPort.cc:104
RubyPortParams Params
Definition: RubyPort.hh:153
void setController(AbstractController *_cntrl)
Definition: RubyPort.hh:171
AbstractController * m_controller
Definition: RubyPort.hh:199
DrainState drain() override
Draining is the process of clearing out the states of SimObjects.These are the SimObjects that are pa...
Definition: RubyPort.cc:565
void ruby_eviction_callback(Addr address)
Definition: RubyPort.cc:701
MessageBuffer * m_mandatory_q_ptr
Definition: RubyPort.hh:200
uint32_t getId()
Definition: RubyPort.hh:172
std::vector< PioRequestPort * > request_ports
Definition: RubyPort.hh:226
STL vector class.
Definition: stl.hh:37
ClockedObject declaration and implementation.
DrainState
Object drain/handover states.
Definition: drain.hh:75
#define panic(...)
This implements a cprintf based panic() function.
Definition: logging.hh:178
Bitfield< 54 > p
Definition: pagetable.hh:70
Bitfield< 3 > addr
Definition: types.hh:84
Reference material can be found at the JEDEC website: UFS standard http://www.jedec....
const PortID InvalidPortID
Definition: types.hh:246
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
Definition: types.hh:147
int16_t PortID
Port index/ID type, and a symbolic name for an invalid port id.
Definition: types.hh:245
uint64_t Tick
Tick count type.
Definition: types.hh:58
A virtual base opaque structure used to hold state associated with the packet (e.g....
Definition: packet.hh:468
SenderState(MemResponsePort *_port)
Definition: RubyPort.hh:149
Declaration of SimpleTimingPort.

Generated on Wed Dec 21 2022 10:22:38 for gem5 by doxygen 1.9.1