gem5  v22.1.0.0
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 
46 namespace gem5
47 {
48 
49 namespace memory
50 {
51 
52 class MemInterface;
53 class DRAMInterface;
54 
55 
64 class 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 
88  AddrRangeList getAddrRanges() override;
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  bool readQueueFull(unsigned int pkt_count) const;
148 
157  bool writeQueueFullPC0(unsigned int pkt_count) const;
158  bool writeQueueFullPC1(unsigned int pkt_count) const;
159 
165  uint64_t readQueueSizePC0 = 0;
166  uint64_t readQueueSizePC1 = 0;
167  uint64_t writeQueueSizePC0 = 0;
168  uint64_t writeQueueSizePC1 = 0;
169 
175 
181  std::unordered_multiset<Tick> rowBurstTicks;
182 
188  std::unordered_multiset<Tick> colBurstTicks;
189 
197 
203 
204  public:
205 
211  bool respondEventScheduled(uint8_t pseudo_channel) const override
212  {
213  if (pseudo_channel == 0) {
214  return MemCtrl::respondEventScheduled(pseudo_channel);
215  } else {
216  assert(pseudo_channel == 1);
217  return respondEventPC1.scheduled();
218  }
219  }
220 
226  bool requestEventScheduled(uint8_t pseudo_channel) const override
227  {
228  if (pseudo_channel == 0) {
229  return MemCtrl::requestEventScheduled(pseudo_channel);
230  } else {
231  assert(pseudo_channel == 1);
232  return nextReqEventPC1.scheduled();
233  }
234  }
235 
243  void restartScheduler(Tick tick, uint8_t pseudo_channel) override
244  {
245  if (pseudo_channel == 0) {
247  } else {
249  }
250  }
251 
252 
253  virtual void init() override;
254  virtual void startup() override;
255  virtual void drainResume() override;
256 
257 
258  protected:
259  Tick recvAtomic(PacketPtr pkt) override;
260  Tick recvAtomicBackdoor(PacketPtr pkt, MemBackdoorPtr &backdoor) override;
261  void recvFunctional(PacketPtr pkt) override;
262  bool recvTimingReq(PacketPtr pkt) override;
263 
264 };
265 
266 } // namespace memory
267 } // namespace gem5
268 
269 #endif //__HBM_CTRL_HH__
A Packet is used to encapsulate a transfer between two objects in the memory system (e....
Definition: packet.hh:294
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:189
DRAMInterface * pc1Int
Definition: hbm_ctrl.hh:196
uint64_t readQueueSizePC1
Definition: hbm_ctrl.hh:166
virtual void init() override
init() is called after all C++ SimObjects have been created and all ports are connected.
Definition: hbm_ctrl.cc:86
AddrRangeList getAddrRanges() override
Definition: hbm_ctrl.cc:492
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:165
bool respondEventScheduled(uint8_t pseudo_channel) const override
Is there a respondEvent scheduled?
Definition: hbm_ctrl.hh:211
Tick recvAtomicBackdoor(PacketPtr pkt, MemBackdoorPtr &backdoor) override
Definition: hbm_ctrl.cc:137
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:243
void recvFunctional(PacketPtr pkt) override
Definition: hbm_ctrl.cc:123
virtual void drainResume() override
Resume execution after a successful drain.
Definition: hbm_ctrl.cc:469
EventFunctionWrapper respondEventPC1
Definition: hbm_ctrl.hh:135
uint64_t writeQueueSizePC1
Definition: hbm_ctrl.hh:168
bool recvTimingReq(PacketPtr pkt) override
Definition: hbm_ctrl.cc:214
bool writeQueueFullPC1(unsigned int pkt_count) const
Definition: hbm_ctrl.cc:165
bool partitionedQ
This indicates if the R/W queues will be partitioned among pseudo channels.
Definition: hbm_ctrl.hh:202
uint64_t writeQueueSizePC0
Definition: hbm_ctrl.hh:167
void pruneBurstTick() override
Remove commands that have already issued from rowBurstTicks and colBurstTicks.
Definition: hbm_ctrl.cc:360
virtual void startup() override
startup() is the final initialization call before simulation.
Definition: hbm_ctrl.cc:92
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:188
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:176
std::unordered_multiset< Tick > rowBurstTicks
Holds count of row commands issued in burst window starting at defined Tick.
Definition: hbm_ctrl.hh:181
Tick recvAtomic(PacketPtr pkt) override
Definition: hbm_ctrl.cc:107
bool requestEventScheduled(uint8_t pseudo_channel) const override
Is there a read/write burst Event scheduled?
Definition: hbm_ctrl.hh:226
bool readQueueFull(unsigned int pkt_count) const
Definition: hbm_ctrl.cc:202
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:404
std::deque< MemPacket * > respQueuePC1
Response queue for pkts sent to second pseudo channel The first pseudo channel uses MemCtrl::respQueu...
Definition: hbm_ctrl.hh:174
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:195
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:367
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:154
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:490
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:218
STL deque class.
Definition: stl.hh:44
bool scheduled() const
Determine if the current event is scheduled.
Definition: eventq.hh:465
MemCtrl declaration.
Bitfield< 54 > p
Definition: pagetable.hh:70
Reference material can be found at the JEDEC website: UFS standard http://www.jedec....
uint64_t Tick
Tick count type.
Definition: types.hh:58
Definition: mem.h:38

Generated on Wed Dec 21 2022 10:22:37 for gem5 by doxygen 1.9.1