gem5 v24.0.0.0
Loading...
Searching...
No Matches
hbm_ctrl.hh
Go to the documentation of this file.
1/*
2 * Copyright (c) 2022 The Regents of the University of California
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are
7 * met: redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer;
9 * redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution;
12 * neither the name of the copyright holders nor the names of its
13 * contributors may be used to endorse or promote products derived from
14 * this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 */
28
34#ifndef __HBM_CTRL_HH__
35#define __HBM_CTRL_HH__
36
37#include <deque>
38#include <string>
39#include <unordered_set>
40#include <utility>
41#include <vector>
42
43#include "mem/mem_ctrl.hh"
44#include "params/HBMCtrl.hh"
45
46namespace gem5
47{
48
49namespace memory
50{
51
52class MemInterface;
53class DRAMInterface;
54
55
64class HBMCtrl : public MemCtrl
65{
66
67 protected:
68
69 bool respQEmpty() override
70 {
71 return (respQueue.empty() && respQueuePC1.empty());
72 }
73
74 private:
75
81
86 void pruneBurstTick() override;
87
89
90 public:
91 HBMCtrl(const HBMCtrlParams &p);
92
93 void pruneRowBurstTick();
94 void pruneColBurstTick();
95
109 Tick verifySingleCmd(Tick cmd_tick, Tick max_cmds_per_burst,
110 bool row_cmd) override;
111
127 Tick verifyMultiCmd(Tick cmd_tick, Tick max_cmds_per_burst,
128 Tick max_multi_cmd_split = 0) override;
129
136
145 bool readQueueFullPC0(unsigned int pkt_count) const;
146 bool readQueueFullPC1(unsigned int pkt_count) const;
147
156 bool writeQueueFullPC0(unsigned int pkt_count) const;
157 bool writeQueueFullPC1(unsigned int pkt_count) const;
158
164 uint64_t readQueueSizePC0 = 0;
165 uint64_t readQueueSizePC1 = 0;
166 uint64_t writeQueueSizePC0 = 0;
167 uint64_t writeQueueSizePC1 = 0;
168
174
180 std::unordered_multiset<Tick> rowBurstTicks;
181
187 std::unordered_multiset<Tick> colBurstTicks;
188
196
202
203 public:
204
210 bool respondEventScheduled(uint8_t pseudo_channel) const override
211 {
212 if (pseudo_channel == 0) {
213 return MemCtrl::respondEventScheduled(pseudo_channel);
214 } else {
215 assert(pseudo_channel == 1);
216 return respondEventPC1.scheduled();
217 }
218 }
219
225 bool requestEventScheduled(uint8_t pseudo_channel) const override
226 {
227 if (pseudo_channel == 0) {
228 return MemCtrl::requestEventScheduled(pseudo_channel);
229 } else {
230 assert(pseudo_channel == 1);
231 return nextReqEventPC1.scheduled();
232 }
233 }
234
242 void restartScheduler(Tick tick, uint8_t pseudo_channel) override
243 {
244 if (pseudo_channel == 0) {
246 } else {
248 }
249 }
250
251
252 virtual void init() override;
253 virtual void startup() override;
254 virtual void drainResume() override;
255
256
257 protected:
258 Tick recvAtomic(PacketPtr pkt) override;
259 Tick recvAtomicBackdoor(PacketPtr pkt, MemBackdoorPtr &backdoor) override;
260 void recvFunctional(PacketPtr pkt) override;
261 void recvMemBackdoorReq(const MemBackdoorReq &req,
262 MemBackdoorPtr &_backdoor) override;
263 bool recvTimingReq(PacketPtr pkt) override;
264
265};
266
267} // namespace memory
268} // namespace gem5
269
270#endif //__HBM_CTRL_HH__
A Packet is used to encapsulate a transfer between two objects in the memory system (e....
Definition packet.hh:295
Interface to DRAM devices with media specific parameters, statistics, and functions.
HBM2 is divided into two pseudo channels which have independent data buses but share a command bus (s...
Definition hbm_ctrl.hh:65
bool readQueueFullPC1(unsigned int pkt_count) const
Definition hbm_ctrl.cc:194
DRAMInterface * pc1Int
Definition hbm_ctrl.hh:195
void recvMemBackdoorReq(const MemBackdoorReq &req, MemBackdoorPtr &_backdoor) override
Definition hbm_ctrl.cc:144
uint64_t readQueueSizePC1
Definition hbm_ctrl.hh:165
virtual void init() override
init() is called after all C++ SimObjects have been created and all ports are connected.
Definition hbm_ctrl.cc:76
AddrRangeList getAddrRanges() override
Definition hbm_ctrl.cc:487
uint64_t readQueueSizePC0
Following counters are used to keep track of the entries in read/write queue for each pseudo channel ...
Definition hbm_ctrl.hh:164
bool respondEventScheduled(uint8_t pseudo_channel) const override
Is there a respondEvent scheduled?
Definition hbm_ctrl.hh:210
Tick recvAtomicBackdoor(PacketPtr pkt, MemBackdoorPtr &backdoor) override
Definition hbm_ctrl.cc:127
bool retryRdReqPC1
Remember if we have to retry a request for second pseudo channel.
Definition hbm_ctrl.hh:79
void restartScheduler(Tick tick, uint8_t pseudo_channel) override
restart the controller scheduler
Definition hbm_ctrl.hh:242
void recvFunctional(PacketPtr pkt) override
Definition hbm_ctrl.cc:113
virtual void drainResume() override
Resume execution after a successful drain.
Definition hbm_ctrl.cc:464
EventFunctionWrapper respondEventPC1
Definition hbm_ctrl.hh:135
uint64_t writeQueueSizePC1
Definition hbm_ctrl.hh:167
bool recvTimingReq(PacketPtr pkt) override
Definition hbm_ctrl.cc:207
bool writeQueueFullPC1(unsigned int pkt_count) const
Definition hbm_ctrl.cc:170
bool partitionedQ
This indicates if the R/W queues will be partitioned among pseudo channels.
Definition hbm_ctrl.hh:201
uint64_t writeQueueSizePC0
Definition hbm_ctrl.hh:166
void pruneBurstTick() override
Remove commands that have already issued from rowBurstTicks and colBurstTicks.
Definition hbm_ctrl.cc:355
virtual void startup() override
startup() is the final initialization call before simulation.
Definition hbm_ctrl.cc:82
std::unordered_multiset< Tick > colBurstTicks
This is used to ensure that the column command bandwidth does not exceed the allowable media constrai...
Definition hbm_ctrl.hh:187
bool readQueueFullPC0(unsigned int pkt_count) const
Check if the read queue partition of both pseudo channels has room for more entries.
Definition hbm_ctrl.cc:181
std::unordered_multiset< Tick > rowBurstTicks
Holds count of row commands issued in burst window starting at defined Tick.
Definition hbm_ctrl.hh:180
Tick recvAtomic(PacketPtr pkt) override
Definition hbm_ctrl.cc:97
bool requestEventScheduled(uint8_t pseudo_channel) const override
Is there a read/write burst Event scheduled?
Definition hbm_ctrl.hh:225
EventFunctionWrapper nextReqEventPC1
NextReq and Respond events for second pseudo channel.
Definition hbm_ctrl.hh:134
HBMCtrl(const HBMCtrlParams &p)
Definition hbm_ctrl.cc:46
Tick verifyMultiCmd(Tick cmd_tick, Tick max_cmds_per_burst, Tick max_multi_cmd_split=0) override
Check for command bus contention for multi-cycle (2 currently) command.
Definition hbm_ctrl.cc:399
std::deque< MemPacket * > respQueuePC1
Response queue for pkts sent to second pseudo channel The first pseudo channel uses MemCtrl::respQueu...
Definition hbm_ctrl.hh:173
bool respQEmpty() override
Definition hbm_ctrl.hh:69
DRAMInterface * pc0Int
Pointers to interfaces of the two pseudo channels pc0Int is same as MemCtrl::dram (it will be pointin...
Definition hbm_ctrl.hh:194
Tick verifySingleCmd(Tick cmd_tick, Tick max_cmds_per_burst, bool row_cmd) override
Check for command bus contention for single cycle command.
Definition hbm_ctrl.cc:362
bool writeQueueFullPC0(unsigned int pkt_count) const
Check if the write queue partition of both pseudo channels has room for more entries.
Definition hbm_ctrl.cc:159
The memory controller is a single-channel memory controller capturing the most important timing const...
Definition mem_ctrl.hh:247
std::deque< MemPacket * > respQueue
Response queue where read packets wait after we're done working with them, but it's not time to send ...
Definition mem_ctrl.hh:492
virtual bool requestEventScheduled(uint8_t pseudo_channel=0) const
Is there a read/write burst Event scheduled?
Definition mem_ctrl.hh:738
virtual void restartScheduler(Tick tick, uint8_t pseudo_channel=0)
restart the controller This can be used by interfaces to restart the scheduler after maintainence com...
Definition mem_ctrl.hh:753
virtual bool respondEventScheduled(uint8_t pseudo_channel=0) const
Is there a respondEvent scheduled?
Definition mem_ctrl.hh:727
uint8_t schedule(RequestorID id, uint64_t data)
Definition mem_ctrl.cc:217
STL deque class.
Definition stl.hh:44
bool scheduled() const
Determine if the current event is scheduled.
Definition eventq.hh:458
MemCtrl declaration.
Bitfield< 0 > p
Copyright (c) 2024 - Pranith Kumar Copyright (c) 2020 Inria All rights reserved.
Definition binary32.hh:36
uint64_t Tick
Tick count type.
Definition types.hh:58
Definition mem.h:38

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