gem5 v24.0.0.0
Loading...
Searching...
No Matches
dramsim2.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
42#ifndef __MEM_DRAMSIM2_HH__
43#define __MEM_DRAMSIM2_HH__
44
45#include <queue>
46#include <unordered_map>
47
48#include "mem/abstract_mem.hh"
50#include "mem/qport.hh"
51#include "params/DRAMSim2.hh"
52
53namespace gem5
54{
55
56namespace memory
57{
58
60{
61 private:
62
68 class MemoryPort : public ResponsePort
69 {
70
71 private:
72
74
75 public:
76
77 MemoryPort(const std::string& _name, DRAMSim2& _memory);
78
79 protected:
80
82
83 void recvFunctional(PacketPtr pkt);
84
85 bool recvTimingReq(PacketPtr pkt);
86
87 void recvRespRetry();
88
90
91 };
92
94
99
104
109
114
121 std::unordered_map<Addr, std::queue<PacketPtr> > outstandingReads;
122 std::unordered_map<Addr, std::queue<PacketPtr> > outstandingWrites;
123
131
138
139 unsigned int nbrOutstanding() const;
140
148 void accessAndRespond(PacketPtr pkt);
149
150 void sendResponse();
151
156
160 void tick();
161
166
171 std::unique_ptr<Packet> pendingDelete;
172
173 public:
174
175 typedef DRAMSim2Params Params;
176 DRAMSim2(const Params &p);
177
185 void readComplete(unsigned id, uint64_t addr, uint64_t cycle);
186
194 void writeComplete(unsigned id, uint64_t addr, uint64_t cycle);
195
196 DrainState drain() override;
197
198 Port &getPort(const std::string &if_name,
199 PortID idx=InvalidPortID) override;
200
201 void init() override;
202 void startup() override;
203
204 protected:
205
207 void recvFunctional(PacketPtr pkt);
208 bool recvTimingReq(PacketPtr pkt);
209 void recvRespRetry();
210
211};
212
213} // namespace memory
214} // namespace gem5
215
216#endif // __MEM_DRAMSIM2_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 DRAMSim2 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 dramsim2.hh:69
Tick recvAtomic(PacketPtr pkt)
Receive an atomic request packet from the peer.
Definition dramsim2.cc:374
MemoryPort(const std::string &_name, DRAMSim2 &_memory)
Definition dramsim2.cc:360
void recvFunctional(PacketPtr pkt)
Receive a functional request packet from the peer.
Definition dramsim2.cc:380
void recvRespRetry()
Called by the peer if sendTimingResp was called on this protocol (causing recvTimingResp to be called...
Definition dramsim2.cc:393
bool recvTimingReq(PacketPtr pkt)
Receive a timing request from the peer.
Definition dramsim2.cc:386
AddrRangeList getAddrRanges() const
Get a list of the non-overlapping address ranges the owner is responsible for.
Definition dramsim2.cc:366
DRAMSim2Wrapper wrapper
The actual DRAMSim2 wrapper.
Definition dramsim2.hh:98
Port & getPort(const std::string &if_name, PortID idx=InvalidPortID) override
Get a port with a given name and index.
Definition dramsim2.cc:343
bool retryResp
Are we waiting for a retry for sending a response.
Definition dramsim2.hh:108
void init() override
init() is called after all C++ SimObjects have been created and all ports are connected.
Definition dramsim2.cc:81
DRAMSim2Params Params
Definition dramsim2.hh:175
void accessAndRespond(PacketPtr pkt)
When a packet is ready, use the "access()" method in AbstractMemory to actually create the response p...
Definition dramsim2.cc:254
EventFunctionWrapper tickEvent
Event to schedule clock ticks.
Definition dramsim2.hh:165
unsigned int nbrOutstanding() const
Definition dramsim2.cc:136
std::unique_ptr< Packet > pendingDelete
Upstream caches need this packet until true is returned, so hold it for deletion until a subsequent c...
Definition dramsim2.hh:171
void writeComplete(unsigned id, uint64_t addr, uint64_t cycle)
Write completion callback.
Definition dramsim2.cc:318
bool retryReq
Is the connected port waiting for a retry from us.
Definition dramsim2.hh:103
std::unordered_map< Addr, std::queue< PacketPtr > > outstandingWrites
Definition dramsim2.hh:122
bool recvTimingReq(PacketPtr pkt)
Definition dramsim2.cc:181
Tick startTick
Keep track of when the wrapper is started.
Definition dramsim2.hh:113
unsigned int nbrOutstandingReads
Count the number of outstanding transactions so that we can block any further requests until there is...
Definition dramsim2.hh:129
Tick recvAtomic(PacketPtr pkt)
Definition dramsim2.cc:158
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 dramsim2.hh:121
void startup() override
startup() is the final initialization call before simulation.
Definition dramsim2.cc:97
void recvFunctional(PacketPtr pkt)
Definition dramsim2.cc:167
DRAMSim2(const Params &p)
Definition dramsim2.cc:53
EventFunctionWrapper sendResponseEvent
Event to schedule sending of responses.
Definition dramsim2.hh:155
void readComplete(unsigned id, uint64_t addr, uint64_t cycle)
Read completion callback.
Definition dramsim2.cc:290
unsigned int nbrOutstandingWrites
Definition dramsim2.hh:130
std::deque< PacketPtr > responseQueue
Queue to hold response packets until we can send them back.
Definition dramsim2.hh:137
DrainState drain() override
Draining is the process of clearing out the states of SimObjects.These are the SimObjects that are pa...
Definition dramsim2.cc:353
void tick()
Progress the controller one clock cycle.
Definition dramsim2.cc:142
STL deque class.
Definition stl.hh:44
DRAMSim2Wrapper 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