gem5  [DEVELOP-FOR-23.0]
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
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 
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__
gem5::memory::HBMCtrl::recvTimingReq
bool recvTimingReq(PacketPtr pkt) override
Definition: hbm_ctrl.cc:207
gem5::memory::HBMCtrl::pc1Int
DRAMInterface * pc1Int
Definition: hbm_ctrl.hh:195
memory
Definition: mem.h:38
gem5::memory::HBMCtrl::recvMemBackdoorReq
void recvMemBackdoorReq(const MemBackdoorReq &req, MemBackdoorPtr &_backdoor) override
Definition: hbm_ctrl.cc:144
gem5::memory::HBMCtrl::getAddrRanges
AddrRangeList getAddrRanges() override
Definition: hbm_ctrl.cc:487
gem5::memory::HBMCtrl::HBMCtrl
HBMCtrl(const HBMCtrlParams &p)
Definition: hbm_ctrl.cc:46
gem5::memory::MemCtrl::respondEventScheduled
virtual bool respondEventScheduled(uint8_t pseudo_channel=0) const
Is there a respondEvent scheduled?
Definition: mem_ctrl.hh:727
gem5::memory::MemCtrl::restartScheduler
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
gem5::memory::MemCtrl
The memory controller is a single-channel memory controller capturing the most important timing const...
Definition: mem_ctrl.hh:246
gem5::memory::HBMCtrl::verifySingleCmd
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
gem5::memory::MemCtrl::requestEventScheduled
virtual bool requestEventScheduled(uint8_t pseudo_channel=0) const
Is there a read/write burst Event scheduled?
Definition: mem_ctrl.hh:738
gem5::memory::HBMCtrl::colBurstTicks
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
gem5::memory::HBMCtrl::recvFunctional
void recvFunctional(PacketPtr pkt) override
Definition: hbm_ctrl.cc:113
gem5::memory::HBMCtrl::nextReqEventPC1
EventFunctionWrapper nextReqEventPC1
NextReq and Respond events for second pseudo channel.
Definition: hbm_ctrl.hh:134
gem5::memory::HBMCtrl::readQueueSizePC1
uint64_t readQueueSizePC1
Definition: hbm_ctrl.hh:165
gem5::memory::DRAMInterface
Interface to DRAM devices with media specific parameters, statistics, and functions.
Definition: dram_interface.hh:65
gem5::memory::HBMCtrl::pruneColBurstTick
void pruneColBurstTick()
Definition: hbm_ctrl.cc:342
gem5::memory::qos::MemCtrl::schedule
uint8_t schedule(RequestorID id, uint64_t data)
Definition: mem_ctrl.cc:217
gem5::memory::HBMCtrl::recvAtomic
Tick recvAtomic(PacketPtr pkt) override
Definition: hbm_ctrl.cc:97
gem5::VegaISA::p
Bitfield< 54 > p
Definition: pagetable.hh:70
gem5::Packet
A Packet is used to encapsulate a transfer between two objects in the memory system (e....
Definition: packet.hh:294
gem5::Tick
uint64_t Tick
Tick count type.
Definition: types.hh:58
gem5::memory::HBMCtrl::pc0Int
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
gem5::memory::HBMCtrl::respondEventPC1
EventFunctionWrapper respondEventPC1
Definition: hbm_ctrl.hh:135
gem5::memory::HBMCtrl
HBM2 is divided into two pseudo channels which have independent data buses but share a command bus (s...
Definition: hbm_ctrl.hh:64
gem5::memory::HBMCtrl::verifyMultiCmd
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
gem5::memory::HBMCtrl::writeQueueFullPC1
bool writeQueueFullPC1(unsigned int pkt_count) const
Definition: hbm_ctrl.cc:170
mem_ctrl.hh
gem5::memory::HBMCtrl::startup
virtual void startup() override
startup() is the final initialization call before simulation.
Definition: hbm_ctrl.cc:82
gem5::memory::HBMCtrl::respondEventScheduled
bool respondEventScheduled(uint8_t pseudo_channel) const override
Is there a respondEvent scheduled?
Definition: hbm_ctrl.hh:210
gem5::memory::MemCtrl::respQueue
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
gem5::memory::HBMCtrl::respQueuePC1
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
gem5::memory::HBMCtrl::drainResume
virtual void drainResume() override
Resume execution after a successful drain.
Definition: hbm_ctrl.cc:464
gem5::MemBackdoor
Definition: backdoor.hh:41
gem5::memory::HBMCtrl::partitionedQ
bool partitionedQ
This indicates if the R/W queues will be partitioned among pseudo channels.
Definition: hbm_ctrl.hh:201
gem5::memory::HBMCtrl::pruneBurstTick
void pruneBurstTick() override
Remove commands that have already issued from rowBurstTicks and colBurstTicks.
Definition: hbm_ctrl.cc:355
gem5::EventFunctionWrapper
Definition: eventq.hh:1136
gem5::memory::HBMCtrl::readQueueFullPC0
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
gem5::memory::HBMCtrl::readQueueFullPC1
bool readQueueFullPC1(unsigned int pkt_count) const
Definition: hbm_ctrl.cc:194
std::deque
STL deque class.
Definition: stl.hh:44
gem5::Clocked::tick
Tick tick
Definition: clocked_object.hh:68
gem5::memory::HBMCtrl::respQEmpty
bool respQEmpty() override
Definition: hbm_ctrl.hh:69
gem5::memory::HBMCtrl::recvAtomicBackdoor
Tick recvAtomicBackdoor(PacketPtr pkt, MemBackdoorPtr &backdoor) override
Definition: hbm_ctrl.cc:127
std::list< AddrRange >
gem5::memory::HBMCtrl::readQueueSizePC0
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
gem5::memory::HBMCtrl::writeQueueSizePC0
uint64_t writeQueueSizePC0
Definition: hbm_ctrl.hh:166
gem5::memory::HBMCtrl::retryWrReqPC1
bool retryWrReqPC1
Definition: hbm_ctrl.hh:80
gem5
Reference material can be found at the JEDEC website: UFS standard http://www.jedec....
Definition: gpu_translation_state.hh:37
gem5::MemBackdoorReq
Definition: backdoor.hh:129
gem5::memory::HBMCtrl::rowBurstTicks
std::unordered_multiset< Tick > rowBurstTicks
Holds count of row commands issued in burst window starting at defined Tick.
Definition: hbm_ctrl.hh:180
gem5::memory::HBMCtrl::requestEventScheduled
bool requestEventScheduled(uint8_t pseudo_channel) const override
Is there a read/write burst Event scheduled?
Definition: hbm_ctrl.hh:225
gem5::memory::HBMCtrl::init
virtual void init() override
init() is called after all C++ SimObjects have been created and all ports are connected.
Definition: hbm_ctrl.cc:76
gem5::memory::HBMCtrl::restartScheduler
void restartScheduler(Tick tick, uint8_t pseudo_channel) override
restart the controller scheduler
Definition: hbm_ctrl.hh:242
gem5::memory::HBMCtrl::writeQueueSizePC1
uint64_t writeQueueSizePC1
Definition: hbm_ctrl.hh:167
gem5::memory::HBMCtrl::writeQueueFullPC0
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
gem5::Event::scheduled
bool scheduled() const
Determine if the current event is scheduled.
Definition: eventq.hh:458
gem5::memory::HBMCtrl::pruneRowBurstTick
void pruneRowBurstTick()
Definition: hbm_ctrl.cc:329
gem5::memory::HBMCtrl::retryRdReqPC1
bool retryRdReqPC1
Remember if we have to retry a request for second pseudo channel.
Definition: hbm_ctrl.hh:79

Generated on Sun Jul 30 2023 01:56:58 for gem5 by doxygen 1.8.17