gem5 v24.0.0.0
Loading...
Searching...
No Matches
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
56namespace gem5
57{
58
59namespace ruby
60{
61
62class AbstractController;
63
64class 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);
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 {
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 //
177 uint32_t getId() { return m_version; }
178 DrainState drain() override;
179
181
182 virtual int functionalWrite(Packet *func_pkt);
183
184 protected:
185 void trySendRetries();
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__
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:295
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:111
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:188
void recvRangeChange()
Called to receive an address range change from the peer response port.
Definition RubyPort.hh:79
SnoopRespPacketQueue snoopRespQueue
Definition RubyPort.hh:72
MemRequestPort(const std::string &_name, RubyPort &_port)
Definition RubyPort.cc:153
bool isShadowRomAddress(Addr addr) const
Definition RubyPort.cc:673
Tick recvAtomic(PacketPtr pkt)
Receive an atomic request packet from the peer.
Definition RubyPort.cc:322
MemResponsePort(const std::string &_name, RubyPort &_port, bool _access_backing_store, PortID id, bool _no_retry_on_stall)
Definition RubyPort.cc:164
void recvFunctional(PacketPtr pkt)
Receive a functional request packet from the peer.
Definition RubyPort.cc:391
bool recvTimingReq(PacketPtr pkt)
Receive a timing request from the peer.
Definition RubyPort.cc:252
AddrRangeList getAddrRanges() const
Get a list of the non-overlapping address ranges the owner is responsible for.
Definition RubyPort.hh:105
bool isPhysMemAddress(PacketPtr pkt) const
Definition RubyPort.cc:687
void recvRangeChange()
Called to receive an address range change from the peer response port.
Definition RubyPort.cc:719
SnoopRespPacketQueue snoopRespQueue
Definition RubyPort.hh:120
bool recvTimingResp(PacketPtr pkt)
Receive a timing response from the peer.
Definition RubyPort.cc:178
PioRequestPort(const std::string &_name, RubyPort &_port)
Definition RubyPort.cc:136
Tick recvAtomic(PacketPtr pkt)
Receive an atomic request packet from the peer.
Definition RubyPort.cc:233
void recvFunctional(PacketPtr pkt)
Receive a functional request packet from the peer.
Definition RubyPort.hh:144
bool recvTimingReq(PacketPtr pkt)
Receive a timing request from the peer.
Definition RubyPort.cc:213
AddrRangeList getAddrRanges() const
Get a list of the non-overlapping address ranges the owner is responsible for.
Definition RubyPort.cc:658
PioResponsePort(const std::string &_name, RubyPort &_port)
Definition RubyPort.cc:146
void ruby_hit_callback(PacketPtr pkt)
Definition RubyPort.cc:452
std::vector< MemResponsePort * > response_ports
Definition RubyPort.hh:209
virtual RequestStatus makeRequest(PacketPtr pkt)=0
void ruby_unaddressed_callback(PacketPtr pkt)
Definition RubyPort.cc:475
virtual int outstandingCount() const =0
void ruby_stale_translation_callback(Addr txnId)
Definition RubyPort.cc:494
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:237
RubySystem * m_ruby_system
Definition RubyPort.hh:202
MemResponsePort memResponsePort
Definition RubyPort.hh:226
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:224
bool onRetryList(MemResponsePort *port)
Definition RubyPort.hh:212
PioRequestPort pioRequestPort
Definition RubyPort.hh:223
RubyPort(const Params &p)
Definition RubyPort.cc:61
virtual bool isDeadlockEventScheduled() const =0
virtual int functionalWrite(Packet *func_pkt)
Definition RubyPort.cc:729
unsigned int gotAddrRanges
Definition RubyPort.hh:227
void addToRetryList(MemResponsePort *port)
Definition RubyPort.hh:217
MemRequestPort memRequestPort
Definition RubyPort.hh:225
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:158
void setController(AbstractController *_cntrl)
Definition RubyPort.hh:176
AbstractController * m_controller
Definition RubyPort.hh:204
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
void ruby_eviction_callback(Addr address)
Definition RubyPort.cc:695
MessageBuffer * m_mandatory_q_ptr
Definition RubyPort.hh:205
std::vector< PioRequestPort * > request_ports
Definition RubyPort.hh:231
std::vector< MemResponsePort * >::iterator CpuPortIter
Vector of M5 Ports attached to this Ruby port.
Definition RubyPort.hh:230
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:188
Bitfield< 0 > p
Bitfield< 3 > addr
Definition types.hh:84
Copyright (c) 2024 - Pranith Kumar Copyright (c) 2020 Inria All rights reserved.
Definition binary32.hh:36
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:469
SenderState(MemResponsePort *_port)
Definition RubyPort.hh:154
Declaration of SimpleTimingPort.

Generated on Tue Jun 18 2024 16:24:05 for gem5 by doxygen 1.11.0