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