gem5 v24.0.0.0
Loading...
Searching...
No Matches
dramsim3.hh
Go to the documentation of this file.
1/*
2 * Copyright (c) 2013 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
43#ifndef __MEM_DRAMSIM3_HH__
44#define __MEM_DRAMSIM3_HH__
45
46#include <functional>
47#include <queue>
48#include <unordered_map>
49
50#include "mem/abstract_mem.hh"
52#include "mem/qport.hh"
53#include "params/DRAMsim3.hh"
54
55namespace gem5
56{
57
58namespace memory
59{
60
62{
63 private:
64
70 class MemoryPort : public ResponsePort
71 {
72
73 private:
74
76
77 public:
78
79 MemoryPort(const std::string& _name, DRAMsim3& _memory);
80
81 protected:
82
84
85 void recvFunctional(PacketPtr pkt);
86
87 bool recvTimingReq(PacketPtr pkt);
88
89 void recvRespRetry();
90
92
93 };
94
96
100 std::function<void(uint64_t)> read_cb;
101 std::function<void(uint64_t)> write_cb;
102
107
112
117
122
129 std::unordered_map<Addr, std::queue<PacketPtr> > outstandingReads;
130 std::unordered_map<Addr, std::queue<PacketPtr> > outstandingWrites;
131
139
146
147
148 unsigned int nbrOutstanding() const;
149
157 void accessAndRespond(PacketPtr pkt);
158
159 void sendResponse();
160
165
169 void tick();
170
175
180 std::unique_ptr<Packet> pendingDelete;
181
182 public:
183
184 typedef DRAMsim3Params Params;
185 DRAMsim3(const Params &p);
186
194 void readComplete(unsigned id, uint64_t addr);
195
203 void writeComplete(unsigned id, uint64_t addr);
204
205 DrainState drain() override;
206
207 virtual Port& getPort(const std::string& if_name,
208 PortID idx = InvalidPortID) override;
209
210 void init() override;
211 void startup() override;
212
213 void resetStats() override;
214
215 protected:
216
218 void recvFunctional(PacketPtr pkt);
219 bool recvTimingReq(PacketPtr pkt);
220 void recvRespRetry();
221
222};
223
224} // namespace memory
225} // namespace gem5
226
227#endif // __MEM_DRAMSIM3_HH__
AbstractMemory declaration.
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
A ResponsePort is a specialization of a port.
Definition port.hh:349
An abstract memory represents a contiguous block of physical memory, with an associated address range...
Wrapper class to avoid having DRAMsim3 names like ClockDomain etc clashing with the normal gem5 world...
The memory port has to deal with its own flow control to avoid having unbounded storage that is impli...
Definition dramsim3.hh:71
void recvRespRetry()
Called by the peer if sendTimingResp was called on this protocol (causing recvTimingResp to be called...
Definition dramsim3.cc:391
MemoryPort(const std::string &_name, DRAMsim3 &_memory)
Definition dramsim3.cc:358
void recvFunctional(PacketPtr pkt)
Receive a functional request packet from the peer.
Definition dramsim3.cc:378
Tick recvAtomic(PacketPtr pkt)
Receive an atomic request packet from the peer.
Definition dramsim3.cc:372
AddrRangeList getAddrRanges() const
Get a list of the non-overlapping address ranges the owner is responsible for.
Definition dramsim3.cc:364
bool recvTimingReq(PacketPtr pkt)
Receive a timing request from the peer.
Definition dramsim3.cc:384
Tick startTick
Keep track of when the wrapper is started.
Definition dramsim3.hh:121
EventFunctionWrapper tickEvent
Event to schedule clock ticks.
Definition dramsim3.hh:174
DRAMsim3Params Params
Definition dramsim3.hh:184
bool recvTimingReq(PacketPtr pkt)
Definition dramsim3.cc:183
void recvFunctional(PacketPtr pkt)
Definition dramsim3.cc:169
void accessAndRespond(PacketPtr pkt)
When a packet is ready, use the "access()" method in AbstractMemory to actually create the response p...
Definition dramsim3.cc:256
void init() override
init() is called after all C++ SimObjects have been created and all ports are connected.
Definition dramsim3.cc:75
void tick()
Progress the controller one clock cycle.
Definition dramsim3.cc:141
std::deque< PacketPtr > responseQueue
Queue to hold response packets until we can send them back.
Definition dramsim3.hh:145
void startup() override
startup() is the final initialization call before simulation.
Definition dramsim3.cc:91
void resetStats() override
Callback to reset stats.
Definition dramsim3.cc:100
Tick recvAtomic(PacketPtr pkt)
Definition dramsim3.cc:160
std::unordered_map< Addr, std::queue< PacketPtr > > outstandingWrites
Definition dramsim3.hh:130
DrainState drain() override
Draining is the process of clearing out the states of SimObjects.These are the SimObjects that are pa...
Definition dramsim3.cc:351
bool retryReq
Is the connected port waiting for a retry from us.
Definition dramsim3.hh:111
DRAMsim3Wrapper wrapper
The actual DRAMsim3 wrapper.
Definition dramsim3.hh:106
virtual Port & getPort(const std::string &if_name, PortID idx=InvalidPortID) override
Get a port with a given name and index.
Definition dramsim3.cc:341
void readComplete(unsigned id, uint64_t addr)
Read completion callback.
Definition dramsim3.cc:292
EventFunctionWrapper sendResponseEvent
Event to schedule sending of responses.
Definition dramsim3.hh:164
bool retryResp
Are we waiting for a retry for sending a response.
Definition dramsim3.hh:116
std::function< void(uint64_t)> write_cb
Definition dramsim3.hh:101
std::unique_ptr< Packet > pendingDelete
Upstream caches need this packet until true is returned, so hold it for deletion until a subsequent c...
Definition dramsim3.hh:180
unsigned int nbrOutstandingWrites
Definition dramsim3.hh:138
unsigned int nbrOutstanding() const
Definition dramsim3.cc:135
DRAMsim3(const Params &p)
Definition dramsim3.cc:52
unsigned int nbrOutstandingReads
Count the number of outstanding transactions so that we can block any further requests until there is...
Definition dramsim3.hh:137
std::unordered_map< Addr, std::queue< PacketPtr > > outstandingReads
Keep track of what packets are outstanding per address, and do so separately for reads and writes.
Definition dramsim3.hh:129
std::function< void(uint64_t)> read_cb
Callback functions.
Definition dramsim3.hh:100
void writeComplete(unsigned id, uint64_t addr)
Write completion callback.
Definition dramsim3.cc:318
STL deque class.
Definition stl.hh:44
DRAMsim3Wrapper declaration.
DrainState
Object drain/handover states.
Definition drain.hh:75
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
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
Declaration of the queued port.
Definition mem.h:38

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