Go to the documentation of this file.
46 #ifndef __MEM_INTERFACE_HH__
47 #define __MEM_INTERFACE_HH__
51 #include <unordered_set>
57 #include "enums/AddrMap.hh"
58 #include "enums/PageManage.hh"
62 #include "params/DRAMInterface.hh"
63 #include "params/MemInterface.hh"
64 #include "params/NVMInterface.hh"
208 virtual void setupRank(
const uint8_t rank,
const bool is_read) = 0;
287 unsigned int size,
bool is_read,
bool is_dram);
321 constexpr
Command(Data::MemCommand::cmds _type, uint8_t _bank,
593 Rank(
const DRAMInterfaceParams &_p,
int _rank,
806 Tick pre_tick,
bool auto_or_preall =
false,
895 void init()
override;
908 void setupRank(
const uint8_t rank,
const bool is_read)
override;
980 return ranks[pkt->
rank]->inRefIdleState();
1049 Rank(
const NVMInterfaceParams &_p,
int _rank,
1160 void init()
override;
1168 void setupRank(
const uint8_t rank,
const bool is_read)
override;
1204 bool isBusy(
bool read_queue_empty,
bool all_writes_nvm);
1272 #endif //__MEM_INTERFACE_HH__
void suspend()
Stop the refresh events.
This is a simple scalar statistic, like a counter.
statistics::Formula avgWrBW
bool enableDRAMPowerdown
Enable or disable DRAM powerdown states.
std::pair< MemPacketQueue::iterator, Tick > chooseNextFRFCFS(MemPacketQueue &queue, Tick min_col_at) const override
For FR-FCFS policy, find first NVM command that can issue default to first command to prepped region.
Interface to NVM devices with media specific parameters, statistics, and functions.
statistics::Vector perBankRdBursts
DRAM per bank stats.
bool burstReady(MemPacket *pkt) const override
Check if a burst operation can be issued to the DRAM.
void computeStats()
Computes stats just prior to dump event.
const uint32_t maxPendingReads
void processPrechargeEvent()
void respondEvent(uint8_t rank)
Complete response process for DRAM when read burst is complete This will update the counters and chec...
statistics::Formula busUtilWrite
uint32_t writeEntries
Track number of packets in write queue going to this rank.
PowerState
The power state captures the different operational states of the DRAM and interacts with the bus read...
Tick readToWriteDelay() const
statistics::Formula busUtilRead
Tick accessLatency() const override
RefreshState
The refresh state is used to control the progress of the refresh scheduling.
statistics::Scalar writeRowHits
statistics::Scalar writeBursts
statistics::Formula avgQLat
PowerState pwrStateTrans
Since we are taking decisions out of order, we need to keep track of what power transition is happeni...
statistics::Scalar totQLat
EventFunctionWrapper writeDoneEvent
bool isBusy(bool read_queue_empty, bool all_writes_nvm)
This function checks if ranks are busy.
statistics::Scalar readEnergy
NVMInterface(const NVMInterfaceParams &_p)
statistics::Scalar preBackEnergy
statistics::Scalar readBursts
total number of DRAM bursts serviced
EventFunctionWrapper readReadyEvent
void addRankToRankDelay(Tick cmd_at) override
Add rank to rank delay to bus timing to all DRAM banks in alli ranks when access to an alternate inte...
void processWakeUpEvent()
statistics::Scalar totBusLat
statistics::Scalar refreshEnergy
EventFunctionWrapper prechargeEvent
void setCtrl(MemCtrl *_ctrl, unsigned int command_window)
Set a pointer to the controller and initialize interface based on controller parameters.
bool inLowPowerState
rank is in or transitioning to power-down or self-refresh
void scheduleWakeUpEvent(Tick exit_delay)
schedule and event to wake-up from power-down or self-refresh and update bank timing parameters
std::vector< Bank > banks
Vector of NVM banks.
Simple structure to hold the values needed to keep track of commands for DRAMPower.
std::pair< MemPacketQueue::iterator, Tick > chooseNextFRFCFS(MemPacketQueue &queue, Tick min_col_at) const override
For FR-FCFS policy, find first DRAM command that can issue.
std::vector< Rank * > ranks
Vector of dram ranks.
Rank(const NVMInterfaceParams &_p, int _rank, NVMInterface &_nvm)
virtual bool allRanksDrained() const =0
Check drain state of interface.
const uint32_t deviceSize
A basic class to track the bank state, i.e.
statistics::Vector pwrStateTime
Track time spent in each power state.
void activateBank(Rank &rank_ref, Bank &bank_ref, Tick act_tick, uint32_t row)
Keep track of when row activations happen, in order to enforce the maximum number of activations in t...
The memory controller is a single-channel memory controller capturing the most important timing const...
void addRankToRankDelay(Tick cmd_at) override
Add rank to rank delay to bus timing to all NVM banks in alli ranks when access to an alternate inter...
const uint32_t burstsPerStripe
bool readsWaitingToIssue() const
virtual void addRankToRankDelay(Tick cmd_at)=0
Add rank to rank delay to bus timing to all banks in all ranks when access to an alternate interface ...
bool allRanksDrained() const override
Check drain state of NVM interface.
bool allRanksDrained() const override
Return true once refresh is complete for all ranks and there are no additional commands enqueued.
void processWriteDoneEvent()
DRAMPower is a standalone tool which calculates the power consumed by a DRAM in the system.
void resetStats()
Reset stats on a stats event.
const uint32_t maxAccessesPerRow
Max column accesses (read and write) per row, before forefully closing it.
void processWriteRespondEvent()
void setupRank(const uint8_t rank, const bool is_read) override
Setup the rank based on packet received.
statistics::Formula avgBusLat
A vector of scalar stats.
statistics::Histogram pendingReads
NVM stats.
EventFunctionWrapper refreshEvent
statistics::Histogram bytesPerActivate
uint8_t outstandingEvents
Number of ACT, RD, and WR events currently scheduled Incremented when a refresh event is started as w...
EventFunctionWrapper activateEvent
const Tick tREAD
NVM specific timing requirements.
NVM rank class simply includes a vector of banks.
std::string csprintf(const char *format, const Args &...args)
Rank(const DRAMInterfaceParams &_p, int _rank, DRAMInterface &_dram)
statistics::Scalar prePowerDownEnergy
void checkDrainDone()
Let the rank check if it was waiting for requests to drain to allow it to transition states.
statistics::Formula avgQLat
const Tick rdToWrDlySameBG
bool writeRespQueueFull() const
Check if the write response queue has reached defined threshold.
void powerDownSleep(PowerState pwr_state, Tick tick)
Schedule a transition to power-down (sleep)
Tick pwrStateTick
Track when we transitioned to the current power state.
constexpr Command(Data::MemCommand::cmds _type, uint8_t _bank, Tick time_stamp)
statistics::Scalar totalEnergy
void drainRanks()
Iterate through dram ranks to exit self-refresh in order to drain.
Tick accessLatency() const override
uint32_t readEntries
Track number of packets in read queue going to this rank.
void regStats() override
Callback to set stat parameters.
#define GEM5_CLASS_VAR_USED
const uint32_t burstsPerRowBuffer
const uint32_t readBufferSize
Buffer sizes for read and write queues in the controller These are passed to the controller on instan...
void processRefreshEvent()
const uint32_t bankGroupsPerRank
DRAM specific device characteristics.
statistics::Scalar actEnergy
statistics::Formula avgBusLat
void setupRank(const uint8_t rank, const bool is_read) override
Setup the rank based on packet received.
void suspend()
Iterate through DRAM ranks and suspend them.
std::deque< Tick > readReadyQueue
void processActivateEvent()
statistics::Formula peakBW
MemInterface(const Params &_p)
statistics::Scalar totBusLat
Interface to DRAM devices with media specific parameters, statistics, and functions.
Data::MemCommand::cmds type
Tick lastStatsResetTick
The time when stats were last reset used to calculate average power.
Tick minWriteToReadDataGap() const
statistics::Scalar averagePower
enums::AddrMap addrMapping
Memory controller configuration initialized based on parameter values.
uint8_t rank
Current Rank index.
const uint32_t maxPendingWrites
NVM specific device and channel characteristics.
statistics::Scalar totMemAccLat
statistics::Formula peakBW
const std::string name() const
const uint32_t deviceRowBufferSize
DRAMInterface(const DRAMInterfaceParams &_p)
bool isBusy()
This function checks if ranks are actively refreshing and therefore busy.
statistics::Formula avgMemAccLat
void regStats() override
Callback to set stat parameters.
DRAMStats(DRAMInterface &dram)
General interface to memory device Includes functions and parameters shared across media types.
virtual void setupRank(const uint8_t rank, const bool is_read)=0
Setup the rank based on packet received.
statistics::Scalar bytesRead
statistics::Formula busUtil
DRAMInterface & dram
A reference to the parent DRAMInterface instance.
const uint32_t banksPerRank
statistics::Formula busUtilWrite
statistics::Formula avgRdBW
std::vector< Bank > banks
Vector of Banks.
const Tick tCL
DRAM specific timing requirements.
bool inPwrIdleState() const
Check if the current rank has all banks closed and is not in a low power state.
A Packet is used to encapsulate a transfer between two objects in the memory system (e....
EventFunctionWrapper writeRespondEvent
RefreshState refreshState
current refresh state
std::pair< std::vector< uint32_t >, bool > minBankPrep(const MemPacketQueue &queue, Tick min_col_at) const
Find which are the earliest banks ready to issue an activate for the enqueued requests.
statistics::Formula pageHitRate
const uint32_t activationLimit
An abstract memory represents a contiguous block of physical memory, with an associated address range...
uint64_t Tick
Tick count type.
Tick commandOffset() const override
statistics::Scalar actBackEnergy
void flushCmdList()
Push command out of cmdList queue that are scheduled at or before curTick() to DRAMPower library All ...
A memory packet stores packets along with the timestamp of when the packet entered the queue,...
virtual Tick commandOffset() const =0
DRAMPower power
One DRAMPower instance per rank.
virtual bool burstReady(MemPacket *pkt) const =0
Check if a burst operation can be issued to the interface.
std::deque< Tick > actTicks
List to keep track of activate ticks.
statistics::Scalar totQLat
bool isQueueEmpty() const
Check if the command queue of current rank is idle.
statistics::Scalar readRowHits
Tick rankDelay() const
Determine the required delay for an access to a different rank.
void checkRefreshState(uint8_t rank)
Check the refresh state to determine if refresh needs to be kicked back into action after a read resp...
NVMStats(NVMInterface &nvm)
void processReadReadyEvent()
const uint32_t writeBufferSize
const uint32_t devicesPerRank
statistics::Scalar writeEnergy
Tick writeToReadDelay() const override
Tick minReadToWriteDataGap() const
statistics::Formula avgWrBW
MemCtrl * ctrl
A pointer to the parent MemCtrl instance.
EventFunctionWrapper wakeUpEvent
statistics::Scalar selfRefreshEnergy
statistics::Formula avgMemAccLat
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
void updatePowerStats()
Function to update Power Stats.
MemInterfaceParams Params
Tick rankToRankDelay() const
virtual Tick writeToReadDelay() const
const Tick wrToRdDlySameBG
void init() override
Initialize the NVM interface and verify parameters.
statistics::Scalar writeBursts
bool burstReady(MemPacket *pkt) const override
Check if a burst operation can be issued to the NVM.
statistics::Scalar totMemAccLat
void chooseRead(MemPacketQueue &queue)
Select read command to issue asynchronously.
Tick lastBurstTick
Track when we issued the last read/write burst.
statistics::Formula avgRdBW
uint64_t size() const
Get the memory size.
const uint8_t twoCycleActivate
statistics::Histogram bytesPerBank
const uint32_t ranksPerChannel
Tick commandOffset() const override
bool inRefIdleState() const
Check if there is no refresh and no preparation of refresh ongoing i.e.
std::pair< Tick, Tick > doBurstAccess(MemPacket *pkt, Tick next_burst_at)
Actually do the burst and update stats.
std::pair< Tick, Tick > doBurstAccess(MemPacket *mem_pkt, Tick next_burst_at, const std::vector< MemPacketQueue > &queue)
Actually do the burst - figure out the latency it will take to service the req based on bank state,...
std::vector< Rank * > ranks
Vector of nvm ranks.
unsigned int numBanksActive
To track number of banks which are currently active for this rank.
void init() override
Initialize the DRAM interface and verify parameters.
Addr getOffset(const Addr &a) const
Determine the offset of an address within the range.
statistics::Vector perBankWrBursts
void regStats() override
Callback to set stat parameters.
const uint8_t rank
Will be populated by address decoder.
uint8_t rank
Current Rank index.
statistics::Scalar readBursts
NVM stats.
statistics::Vector perBankWrBursts
virtual std::pair< MemPacketQueue::iterator, Tick > chooseNextFRFCFS(MemPacketQueue &queue, Tick min_col_at) const =0
For FR-FCFS policy, find first command that can issue Function will be overriden by interface to sele...
Tick refreshDueAt
Keep track of when a refresh is due.
const bool burstInterleave
statistics::Scalar bytesRead
statistics::Formula busUtil
const Tick clkResyncDelay
statistics::Vector perBankRdBursts
void prechargeBank(Rank &rank_ref, Bank &bank_ref, Tick pre_tick, bool auto_or_preall=false, bool trace=true)
Precharge a given bank and also update when the precharge is done.
statistics::Scalar actPowerDownEnergy
statistics::Scalar bytesWritten
statistics::Histogram pendingWrites
const uint32_t rowBufferSize
Addr getCtrlAddr(Addr addr)
Get an address in a dense range which starts from 0.
Tick nextReadAt
Till when must we wait before issuing next read command?
statistics::Scalar preEnergy
statistics::Formula writeRowHitRate
EventFunctionWrapper powerEvent
static const uint32_t NO_ROW
std::vector< Command > cmdList
List of commands issued, to be sent to DRAMPpower at refresh and stats dump.
MemPacket * decodePacket(const PacketPtr pkt, Addr pkt_addr, unsigned int size, bool is_read, bool is_dram)
Address decoder to figure out physical mapping onto ranks, banks, and rows.
uint32_t bytesPerBurst() const
Tick wakeUpAllowedAt
delay low-power exit until this requirement is met
std::list< Tick > writeRespQueue
Holding queue for non-deterministic write commands, which maintains writes that have been issued but ...
Rank class includes a vector of banks.
Reference material can be found at the JEDEC website: UFS standard http://www.jedec....
unsigned int maxCommandsPerWindow
Number of commands that can issue in the defined controller command window, used to verify command ba...
virtual Tick accessLatency() const =0
statistics::Formula readRowHitRate
statistics::Scalar totalIdleTime
Stat to track total DRAM idle time.
enums::PageManage pageMgmt
void schedulePowerEvent(PowerState pwr_state, Tick tick)
Schedule a power state transition in the future, and potentially override an already scheduled transi...
void resetStats() override
Callback to reset stats.
uint16_t numReadDataReady
void startup(Tick ref_tick)
Kick off accounting for power and refresh states and schedule initial refresh.
statistics::Scalar bytesWritten
const uint32_t burstSize
General device and channel characteristics The rowsPerBank is determined based on the capacity,...
bool writeRespQueueEmpty() const
Check if the write response queue is empty.
void preDumpStats() override
Callback before stats are dumped.
PowerState pwrStatePostRefresh
Previous low-power state, which will be re-entered after refresh.
const GEM5_CLASS_VAR_USED Tick tCK
General timing requirements.
static bool sortTime(const Command &cmd, const Command &cmd_next)
Function for sorting Command structures based on timeStamp.
PowerState pwrState
Current power state.
void startup() override
Iterate through dram ranks and instantiate per rank startup routine.
statistics::Formula busUtilRead
RankStats(DRAMInterface &dram, Rank &rank)
void resetStats() override
Callback to reset stats.
bool forceSelfRefreshExit() const
Trigger a self-refresh exit if there are entries enqueued Exit if there are any read entries regardle...
Generated on Tue Feb 8 2022 11:47:11 for gem5 by doxygen 1.8.17