gem5  v20.1.0.0
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  * Author: Matteo Andreozzi
38  */
39 
40 
41 #ifndef __MEM_QOS_MEM_SINK_HH__
42 #define __MEM_QOS_MEM_SINK_HH__
43 
44 #include "mem/abstract_mem.hh"
45 #include "mem/qos/mem_ctrl.hh"
46 #include "mem/qport.hh"
47 #include "params/QoSMemSinkCtrl.hh"
48 
49 class QoSMemSinkInterfaceParams;
51 
52 namespace QoS {
53 
61 class MemSinkCtrl : public MemCtrl
62 {
63  protected:
69 
70  private:
72  {
73  private:
76 
79 
80  public:
87  MemoryPort(const std::string&, MemSinkCtrl&);
88 
89  protected:
97 
103  void recvFunctional(PacketPtr pkt);
104 
111  bool recvTimingReq(PacketPtr pkt);
112 
118 
119  };
120 
121  public:
127  MemSinkCtrl(const QoSMemSinkCtrlParams*);
128 
129  virtual ~MemSinkCtrl();
130 
135  DrainState drain() override;
136 
144  Port &getPort(const std::string &if_name, PortID=InvalidPortID) override;
145 
149  void init() override;
150 
151  protected:
154 
157 
159  const uint64_t memoryPacketSize;
160 
162  const uint64_t readBufferSize;
163 
165  const uint64_t writeBufferSize;
166 
169 
174 
177 
180 
183 
186 
189 
194 
199 
204  void processNextReqEvent();
205 
207  EventWrapper<
208  MemSinkCtrl,
210 
217  inline bool readQueueFull(const uint64_t packets) const;
218 
225  inline bool writeQueueFull(const uint64_t packets) const;
226 
234 
240  void recvFunctional(PacketPtr pkt);
241 
248  bool recvTimingReq(PacketPtr pkt);
249 
251  void regStats() override;
252 };
253 
254 } // namespace QoS
255 
257 {
258  public:
260  void setMemCtrl(QoS::MemSinkCtrl* _ctrl) { ctrl = _ctrl; };
261 
264 
265  QoSMemSinkInterface(const QoSMemSinkInterfaceParams* _p);
266 };
267 
268 
269 #endif /* __MEM_QOS_MEM_SINK_HH__ */
QoS::MemSinkCtrl::MemoryPort::getAddrRanges
AddrRangeList getAddrRanges() const
Gets the configured address ranges for this port.
Definition: mem_sink.cc:356
QoS::MemSinkCtrl::MemoryPort::queue
RespPacketQueue queue
Outgoing packet responses queue.
Definition: mem_sink.hh:78
QoS
Definition: mem_ctrl.cc:42
QoSMemSinkInterface::setMemCtrl
void setMemCtrl(QoS::MemSinkCtrl *_ctrl)
Setting a pointer to the interface.
Definition: mem_sink.hh:260
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:59
QoSMemSinkInterface::QoSMemSinkInterface
QoSMemSinkInterface(const QoSMemSinkInterfaceParams *_p)
Definition: mem_sink.cc:398
QoS::MemSinkCtrl::interface
QoSMemSinkInterface *const interface
Create pointer to interface of actual media.
Definition: mem_sink.hh:173
InvalidPortID
const PortID InvalidPortID
Definition: types.hh:238
abstract_mem.hh
QoS::MemSinkCtrl::nextReqEvent
EventWrapper< MemSinkCtrl, &MemSinkCtrl::processNextReqEvent > nextReqEvent
Event wrapper to schedule next request handler function.
Definition: mem_sink.hh:209
QoS::MemSinkCtrl::processNextReqEvent
void processNextReqEvent()
Processes the next Request event according to configured request latency.
Definition: mem_sink.cc:203
QoS::MemSinkCtrl::readQueue
std::vector< PacketQueue > readQueue
QoS-aware (per priority) incoming read requests packets queue.
Definition: mem_sink.hh:193
QoS::MemSinkCtrl::MemoryPort::MemoryPort
MemoryPort(const std::string &, MemSinkCtrl &)
Constructor.
Definition: mem_sink.cc:349
QoS::MemSinkCtrl::writeQueueFull
bool writeQueueFull(const uint64_t packets) const
Check if the write queue has room for more entries.
Definition: mem_sink.cc:87
EventWrapper
Definition: eventq.hh:1070
Tick
uint64_t Tick
Tick count type.
Definition: types.hh:63
QoS::MemSinkCtrl::readBufferSize
const uint64_t readBufferSize
Read request packets queue buffer size in #packets.
Definition: mem_sink.hh:162
QoS::MemSinkCtrl::recvTimingReq
bool recvTimingReq(PacketPtr pkt)
Receive a Packet in Timing mode.
Definition: mem_sink.cc:124
PortID
int16_t PortID
Port index/ID type, and a symbolic name for an invalid port id.
Definition: types.hh:237
QoSMemSinkInterface
Definition: mem_sink.hh:256
std::vector
STL vector class.
Definition: stl.hh:37
QoS::MemSinkCtrl::recvFunctional
void recvFunctional(PacketPtr pkt)
Receive a Packet in Functional mode.
Definition: mem_sink.cc:104
QoS::MemSinkCtrl::MemoryPort::recvFunctional
void recvFunctional(PacketPtr pkt)
Receive a Packet in Functional mode.
Definition: mem_sink.cc:370
QoS::MemSinkCtrl::MemoryPort
Definition: mem_sink.hh:71
DrainState
DrainState
Object drain/handover states.
Definition: drain.hh:71
Stats::Scalar
This is a simple scalar statistic, like a counter.
Definition: statistics.hh:2533
AbstractMemory
An abstract memory represents a contiguous block of physical memory, with an associated address range...
Definition: abstract_mem.hh:104
QoS::MemSinkCtrl::MemoryPort::recvTimingReq
bool recvTimingReq(PacketPtr pkt)
Receive a Packet in Timing mode.
Definition: mem_sink.cc:385
QoS::MemSinkCtrl
QoS Memory Sink.
Definition: mem_sink.hh:61
QoS::MemSinkCtrl::recvAtomic
Tick recvAtomic(PacketPtr pkt)
Receive a Packet in Atomic mode.
Definition: mem_sink.cc:93
Port
Ports are used to interface objects to each other.
Definition: port.hh:56
QoS::MemSinkCtrl::numReadRetries
Stats::Scalar numReadRetries
Count the number of read retries.
Definition: mem_sink.hh:185
QoS::MemSinkCtrl::MemSinkCtrl
MemSinkCtrl(const QoSMemSinkCtrlParams *)
QoS Memory Sink Constructor.
Definition: mem_sink.cc:48
QoS::MemSinkCtrl::init
void init() override
Initializes this object.
Definition: mem_sink.cc:69
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:114
QueuedResponsePort
A queued port is a port that has an infinite queue for outgoing packets and thus decouples the module...
Definition: qport.hh:58
QoS::MemSinkCtrl::drain
DrainState drain() override
Checks and return the Drain state of this SimObject.
Definition: mem_sink.cc:323
QoS::MemSinkCtrl::writeBufferSize
const uint64_t writeBufferSize
Write request packets queue buffer size in #packets.
Definition: mem_sink.hh:165
QoS::MemSinkCtrl::readQueueFull
bool readQueueFull(const uint64_t packets) const
Check if the read queue has room for more entries.
Definition: mem_sink.cc:81
QoS::MemSinkCtrl::writeQueue
std::vector< PacketQueue > writeQueue
QoS-aware (per priority) incoming read requests packets queue.
Definition: mem_sink.hh:198
RespPacketQueue
Definition: packet_queue.hh:296
QoS::MemSinkCtrl::memoryPacketSize
const uint64_t memoryPacketSize
Memory packet size in bytes.
Definition: mem_sink.hh:159
mem_ctrl.hh
QoS::MemSinkCtrl::retryRdReq
bool retryRdReq
Read request pending.
Definition: mem_sink.hh:176
QoS::MemSinkCtrl::regStats
void regStats() override
Registers statistics.
Definition: mem_sink.cc:336
QoS::MemSinkCtrl::port
MemoryPort port
Memory response port.
Definition: mem_sink.hh:168
qport.hh
QoS::MemSinkCtrl::MemoryPort::recvAtomic
Tick recvAtomic(PacketPtr pkt)
Receive a Packet in Atomic mode.
Definition: mem_sink.cc:364
Packet
A Packet is used to encapsulate a transfer between two objects in the memory system (e....
Definition: packet.hh:257
std::deque
STL deque class.
Definition: stl.hh:44
QoS::MemSinkCtrl::nextRequest
Tick nextRequest
Next request service time.
Definition: mem_sink.hh:182
QoS::MemSinkCtrl::~MemSinkCtrl
virtual ~MemSinkCtrl()
Definition: mem_sink.cc:65
QoSMemSinkInterface::ctrl
QoS::MemSinkCtrl * ctrl
Pointer to the controller.
Definition: mem_sink.hh:260
QoS::MemSinkCtrl::MemoryPort::memory
MemSinkCtrl & memory
reference to parent memory object
Definition: mem_sink.hh:75
std::list< AddrRange >
QoS::MemSinkCtrl::retryWrReq
bool retryWrReq
Write request pending.
Definition: mem_sink.hh:179
QoS::MemSinkCtrl::requestLatency
const Tick requestLatency
Memory between requests latency (ticks)
Definition: mem_sink.hh:153
QoS::MemSinkCtrl::responseLatency
const Tick responseLatency
Memory response latency (ticks)
Definition: mem_sink.hh:156
QoS::MemSinkCtrl::numWriteRetries
Stats::Scalar numWriteRetries
Count the number of write retries.
Definition: mem_sink.hh:188

Generated on Wed Sep 30 2020 14:02:13 for gem5 by doxygen 1.8.17