gem5  v21.1.0.2
mem_sink.hh
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2018-2020 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  * Redistribution and use in source and binary forms, with or without
15  * modification, are permitted provided that the following conditions are
16  * met: redistributions of source code must retain the above copyright
17  * notice, this list of conditions and the following disclaimer;
18  * redistributions in binary form must reproduce the above copyright
19  * notice, this list of conditions and the following disclaimer in the
20  * documentation and/or other materials provided with the distribution;
21  * neither the name of the copyright holders nor the names of its
22  * contributors may be used to endorse or promote products derived from
23  * this software without specific prior written permission.
24  *
25  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
26  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
27  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
28  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
29  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
30  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
31  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
32  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
33  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
34  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
35  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36  */
37 
38 
39 #ifndef __MEM_QOS_MEM_SINK_HH__
40 #define __MEM_QOS_MEM_SINK_HH__
41 
42 #include <cstdint>
43 #include <deque>
44 #include <vector>
45 
46 #include "base/compiler.hh"
47 #include "base/types.hh"
48 #include "mem/abstract_mem.hh"
49 #include "mem/qos/mem_ctrl.hh"
50 #include "mem/qport.hh"
51 #include "params/QoSMemSinkCtrl.hh"
52 #include "sim/eventq.hh"
53 
54 namespace gem5
55 {
56 
57 struct QoSMemSinkInterfaceParams;
58 
59 namespace memory
60 {
61 
63 namespace qos
64 {
65 
66 class MemSinkInterface;
67 
75 class MemSinkCtrl : public MemCtrl
76 {
77  protected:
83 
84  private:
86  {
87  private:
90 
93 
94  public:
101  MemoryPort(const std::string&, MemSinkCtrl&);
102 
103  protected:
111 
117  void recvFunctional(PacketPtr pkt);
118 
125  bool recvTimingReq(PacketPtr pkt);
126 
132 
133  };
134 
135  public:
141  MemSinkCtrl(const QoSMemSinkCtrlParams &);
142 
143  virtual ~MemSinkCtrl();
144 
149  DrainState drain() override;
150 
158  Port &getPort(const std::string &if_name, PortID=InvalidPortID) override;
159 
163  void init() override;
164 
165  protected:
168 
171 
173  const uint64_t memoryPacketSize;
174 
176  const uint64_t readBufferSize;
177 
179  const uint64_t writeBufferSize;
180 
183 
188 
191 
194 
197 
199  {
201 
204 
207  };
208 
213 
218 
223  void processNextReqEvent();
224 
226  EventWrapper<
227  MemSinkCtrl,
229 
236  inline bool readQueueFull(const uint64_t packets) const;
237 
244  inline bool writeQueueFull(const uint64_t packets) const;
245 
253 
259  void recvFunctional(PacketPtr pkt);
260 
267  bool recvTimingReq(PacketPtr pkt);
268 
270 };
271 
273 {
274  public:
276  void setMemCtrl(MemSinkCtrl* _ctrl) { ctrl = _ctrl; };
277 
279  MemSinkCtrl* ctrl;
280 
281  MemSinkInterface(const QoSMemSinkInterfaceParams &_p);
282 };
283 
284 } // namespace qos
285 } // namespace memory
286 } // namespace gem5
287 
288 #endif // __MEM_QOS_MEM_SINK_HH__
gem5::statistics::Scalar
This is a simple scalar statistic, like a counter.
Definition: statistics.hh:1927
gem5::PortID
int16_t PortID
Port index/ID type, and a symbolic name for an invalid port id.
Definition: types.hh:252
gem5::memory::qos::MemSinkCtrl::MemSinkCtrl
MemSinkCtrl(const QoSMemSinkCtrlParams &)
QoS Memory Sink Constructor.
Definition: mem_sink.cc:57
gem5::memory::qos::MemSinkCtrl::MemSinkCtrlStats::numReadRetries
statistics::Scalar numReadRetries
Count the number of read retries.
Definition: mem_sink.hh:203
gem5::memory::qos::MemSinkInterface::setMemCtrl
void setMemCtrl(MemSinkCtrl *_ctrl)
Setting a pointer to the interface.
Definition: mem_sink.hh:276
gem5::EventWrapper
Definition: eventq.hh:1084
gem5::RespPacketQueue
Definition: packet_queue.hh:300
gem5::memory::qos::MemSinkCtrl::getPort
Port & getPort(const std::string &if_name, PortID=InvalidPortID) override
Getter method to access this memory's response port.
Definition: mem_sink.cc:124
memory
Definition: mem.h:38
gem5::memory::qos::MemSinkCtrl::MemoryPort
Definition: mem_sink.hh:85
abstract_mem.hh
gem5::memory::qos::MemSinkCtrl::stats
MemSinkCtrlStats stats
Definition: mem_sink.hh:269
gem5::memory::qos::MemSinkCtrl::port
MemoryPort port
Memory response port.
Definition: mem_sink.hh:182
gem5::memory::qos::MemSinkCtrl::interface
MemSinkInterface *const interface
Create pointer to interface of actual media.
Definition: mem_sink.hh:187
gem5::memory::qos::MemSinkInterface
Definition: mem_sink.hh:272
gem5::memory::qos::MemSinkCtrl::writeQueue
std::vector< PacketQueue > writeQueue
QoS-aware (per priority) incoming read requests packets queue.
Definition: mem_sink.hh:217
gem5::memory::qos::MemSinkCtrl::MemSinkCtrlStats::numWriteRetries
statistics::Scalar numWriteRetries
Count the number of write retries.
Definition: mem_sink.hh:206
gem5::memory::qos::MemSinkCtrl::MemoryPort::recvAtomic
Tick recvAtomic(PacketPtr pkt)
Receive a Packet in Atomic mode.
Definition: mem_sink.cc:369
gem5::memory::qos::MemSinkCtrl::readQueue
std::vector< PacketQueue > readQueue
QoS-aware (per priority) incoming read requests packets queue.
Definition: mem_sink.hh:212
gem5::memory::qos::MemSinkCtrl::MemoryPort::queue
RespPacketQueue queue
Outgoing packet responses queue.
Definition: mem_sink.hh:92
gem5::memory::GEM5_DEPRECATED_NAMESPACE
GEM5_DEPRECATED_NAMESPACE(QoS, qos)
std::vector
STL vector class.
Definition: stl.hh:37
gem5::InvalidPortID
const PortID InvalidPortID
Definition: types.hh:253
gem5::memory::qos::MemSinkCtrl::nextReqEvent
EventWrapper< MemSinkCtrl, &MemSinkCtrl::processNextReqEvent > nextReqEvent
Event wrapper to schedule next request handler function.
Definition: mem_sink.hh:228
gem5::memory::qos::MemSinkCtrl::readBufferSize
const uint64_t readBufferSize
Read request packets queue buffer size in #packets.
Definition: mem_sink.hh:176
gem5::memory::qos::MemSinkCtrl::retryWrReq
bool retryWrReq
Write request pending.
Definition: mem_sink.hh:193
gem5::memory::qos::MemSinkCtrl::init
void init() override
Initializes this object.
Definition: mem_sink.cc:79
gem5::memory::qos::MemSinkCtrl::requestLatency
const Tick requestLatency
Memory between requests latency (ticks)
Definition: mem_sink.hh:167
gem5::memory::qos::MemSinkCtrl::responseLatency
const Tick responseLatency
Memory response latency (ticks)
Definition: mem_sink.hh:170
gem5::memory::qos::MemSinkCtrl::MemoryPort::recvFunctional
void recvFunctional(PacketPtr pkt)
Receive a Packet in Functional mode.
Definition: mem_sink.cc:375
gem5::DrainState
DrainState
Object drain/handover states.
Definition: drain.hh:74
gem5::memory::qos::MemSinkCtrl::writeBufferSize
const uint64_t writeBufferSize
Write request packets queue buffer size in #packets.
Definition: mem_sink.hh:179
gem5::memory::qos::MemSinkCtrl::MemSinkCtrlStats
Definition: mem_sink.hh:198
gem5::memory::qos::MemSinkCtrl::memoryPacketSize
const uint64_t memoryPacketSize
Memory packet size in bytes.
Definition: mem_sink.hh:173
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::memory::AbstractMemory
An abstract memory represents a contiguous block of physical memory, with an associated address range...
Definition: abstract_mem.hh:110
gem5::Tick
uint64_t Tick
Tick count type.
Definition: types.hh:58
gem5::memory::qos::MemSinkCtrl::~MemSinkCtrl
virtual ~MemSinkCtrl()
Definition: mem_sink.cc:75
compiler.hh
gem5::memory::qos::MemSinkCtrl
QoS Memory Sink.
Definition: mem_sink.hh:75
gem5::memory::qos::MemSinkCtrl::drain
DrainState drain() override
Checks and return the Drain state of this SimObject.
Definition: mem_sink.cc:333
gem5::memory::qos::MemSinkInterface::MemSinkInterface
MemSinkInterface(const QoSMemSinkInterfaceParams &_p)
Definition: mem_sink.cc:395
gem5::memory::qos::MemSinkCtrl::nextRequest
Tick nextRequest
Next request service time.
Definition: mem_sink.hh:196
gem5::memory::qos::MemSinkCtrl::MemoryPort::mem
MemSinkCtrl & mem
reference to parent memory object
Definition: mem_sink.hh:89
mem_ctrl.hh
gem5::Port
Ports are used to interface objects to each other.
Definition: port.hh:61
types.hh
qport.hh
gem5::memory::qos::MemSinkCtrl::recvTimingReq
bool recvTimingReq(PacketPtr pkt)
Receive a Packet in Timing mode.
Definition: mem_sink.cc:134
std::deque
STL deque class.
Definition: stl.hh:44
gem5::memory::qos::MemSinkCtrl::recvAtomic
Tick recvAtomic(PacketPtr pkt)
Receive a Packet in Atomic mode.
Definition: mem_sink.cc:103
gem5::memory::qos::MemSinkCtrl::writeQueueFull
bool writeQueueFull(const uint64_t packets) const
Check if the write queue has room for more entries.
Definition: mem_sink.cc:97
gem5::memory::qos::MemSinkCtrl::MemoryPort::recvTimingReq
bool recvTimingReq(PacketPtr pkt)
Receive a Packet in Timing mode.
Definition: mem_sink.cc:390
gem5::statistics::Group
Statistics container.
Definition: group.hh:93
gem5::memory::qos::MemSinkCtrl::MemSinkCtrlStats::MemSinkCtrlStats
MemSinkCtrlStats(statistics::Group *parent)
Definition: mem_sink.cc:345
gem5::memory::qos::MemSinkCtrl::recvFunctional
void recvFunctional(PacketPtr pkt)
Receive a Packet in Functional mode.
Definition: mem_sink.cc:114
gem5::memory::qos::MemCtrl
The qos::MemCtrl is a base class for Memory objects which support QoS - it provides access to a set o...
Definition: mem_ctrl.hh:80
gem5::memory::qos::MemSinkCtrl::MemoryPort::getAddrRanges
AddrRangeList getAddrRanges() const
Gets the configured address ranges for this port.
Definition: mem_sink.cc:361
std::list< AddrRange >
gem5::memory::qos::MemSinkCtrl::readQueueFull
bool readQueueFull(const uint64_t packets) const
Check if the read queue has room for more entries.
Definition: mem_sink.cc:91
gem5
Reference material can be found at the JEDEC website: UFS standard http://www.jedec....
Definition: decoder.cc:40
gem5::memory::qos::MemSinkCtrl::retryRdReq
bool retryRdReq
Read request pending.
Definition: mem_sink.hh:190
gem5::memory::qos::MemSinkCtrl::processNextReqEvent
void processNextReqEvent()
Processes the next Request event according to configured request latency.
Definition: mem_sink.cc:213
gem5::memory::qos::MemSinkInterface::ctrl
MemSinkCtrl * ctrl
Pointer to the controller.
Definition: mem_sink.hh:276
gem5::memory::qos::MemSinkCtrl::MemoryPort::MemoryPort
MemoryPort(const std::string &, MemSinkCtrl &)
Constructor.
Definition: mem_sink.cc:354
eventq.hh

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