gem5
v20.0.0.0
|
Rank class includes a vector of banks. More...
Public Member Functions | |
Rank (DRAMCtrl &_memory, const DRAMCtrlParams *_p, int rank) | |
const std::string | name () const |
void | startup (Tick ref_tick) |
Kick off accounting for power and refresh states and schedule initial refresh. More... | |
void | suspend () |
Stop the refresh events. More... | |
bool | inRefIdleState () const |
Check if there is no refresh and no preparation of refresh ongoing i.e. More... | |
bool | inPwrIdleState () const |
Check if the current rank has all banks closed and is not in a low power state. More... | |
bool | forceSelfRefreshExit () const |
Trigger a self-refresh exit if there are entries enqueued Exit if there are any read entries regardless of the bus state. More... | |
bool | isQueueEmpty () const |
Check if the command queue of current rank is idle. More... | |
void | checkDrainDone () |
Let the rank check if it was waiting for requests to drain to allow it to transition states. More... | |
void | flushCmdList () |
Push command out of cmdList queue that are scheduled at or before curTick() to DRAMPower library All commands before curTick are guaranteed to be complete and can safely be flushed. More... | |
void | regStats () |
void | computeStats () |
Computes stats just prior to dump event. More... | |
void | resetStats () |
Reset stats on a stats event. More... | |
void | powerDownSleep (PowerState pwr_state, Tick tick) |
Schedule a transition to power-down (sleep) More... | |
void | scheduleWakeUpEvent (Tick exit_delay) |
schedule and event to wake-up from power-down or self-refresh and update bank timing parameters More... | |
void | processWriteDoneEvent () |
void | processActivateEvent () |
void | processPrechargeEvent () |
void | processRefreshEvent () |
void | processPowerEvent () |
void | processWakeUpEvent () |
![]() | |
EventQueue * | eventQueue () const |
void | schedule (Event &event, Tick when) |
void | deschedule (Event &event) |
void | reschedule (Event &event, Tick when, bool always=false) |
void | schedule (Event *event, Tick when) |
void | deschedule (Event *event) |
void | reschedule (Event *event, Tick when, bool always=false) |
void | wakeupEventQueue (Tick when=(Tick) -1) |
void | setCurTick (Tick newVal) |
EventManager (EventManager &em) | |
EventManager (EventManager *em) | |
EventManager (EventQueue *eq) | |
Public Attributes | |
PowerState | pwrState |
Current power state. More... | |
RefreshState | refreshState |
current refresh state More... | |
bool | inLowPowerState |
rank is in or transitioning to power-down or self-refresh More... | |
uint8_t | rank |
Current Rank index. More... | |
uint32_t | readEntries |
Track number of packets in read queue going to this rank. More... | |
uint32_t | writeEntries |
Track number of packets in write queue going to this rank. More... | |
uint8_t | outstandingEvents |
Number of ACT, RD, and WR events currently scheduled Incremented when a refresh event is started as well Used to determine when a low-power state can be entered. More... | |
Tick | wakeUpAllowedAt |
delay power-down and self-refresh exit until this requirement is met More... | |
DRAMPower | power |
One DRAMPower instance per rank. More... | |
std::vector< Command > | cmdList |
List of commands issued, to be sent to DRAMPpower at refresh and stats dump. More... | |
std::vector< Bank > | banks |
Vector of Banks. More... | |
unsigned int | numBanksActive |
To track number of banks which are currently active for this rank. More... | |
std::deque< Tick > | actTicks |
List to keep track of activate ticks. More... | |
Tick | lastBurstTick |
Track when we issued the last read/write burst. More... | |
EventFunctionWrapper | writeDoneEvent |
EventFunctionWrapper | activateEvent |
EventFunctionWrapper | prechargeEvent |
EventFunctionWrapper | refreshEvent |
EventFunctionWrapper | powerEvent |
EventFunctionWrapper | wakeUpEvent |
Protected Attributes | |
RankStats | stats |
![]() | |
EventQueue * | eventq |
A pointer to this object's event queue. More... | |
Private Member Functions | |
void | updatePowerStats () |
Function to update Power Stats. More... | |
void | schedulePowerEvent (PowerState pwr_state, Tick tick) |
Schedule a power state transition in the future, and potentially override an already scheduled transition. More... | |
Private Attributes | |
DRAMCtrl & | memory |
A reference to the parent DRAMCtrl instance. More... | |
PowerState | pwrStateTrans |
Since we are taking decisions out of order, we need to keep track of what power transition is happening at what time. More... | |
PowerState | pwrStatePostRefresh |
Previous low-power state, which will be re-entered after refresh. More... | |
Tick | pwrStateTick |
Track when we transitioned to the current power state. More... | |
Tick | refreshDueAt |
Keep track of when a refresh is due. More... | |
Rank class includes a vector of banks.
Refresh and Power state machines are defined per rank. Events required to change the state of the refresh and power state machine are scheduled per rank. This class allows the implementation of rank-wise refresh and rank-wise power-down.
Definition at line 332 of file dram_ctrl.hh.
DRAMCtrl::Rank::Rank | ( | DRAMCtrl & | _memory, |
const DRAMCtrlParams * | _p, | ||
int | rank | ||
) |
Definition at line 1863 of file dram_ctrl.cc.
References activateEvent, ArmISA::b, banks, name(), powerEvent, prechargeEvent, processActivateEvent(), processPowerEvent(), processPrechargeEvent(), processRefreshEvent(), processWakeUpEvent(), processWriteDoneEvent(), refreshEvent, stats, and wakeUpEvent.
void DRAMCtrl::Rank::checkDrainDone | ( | ) |
Let the rank check if it was waiting for requests to drain to allow it to transition states.
Definition at line 1935 of file dram_ctrl.cc.
References curTick(), DPRINTF, DRAMCtrl::REF_DRAIN, DRAMCtrl::REF_PD_EXIT, refreshEvent, refreshState, and EventManager::schedule().
void DRAMCtrl::Rank::computeStats | ( | ) |
Computes stats just prior to dump event.
Definition at line 2554 of file dram_ctrl.cc.
References curTick(), DPRINTF, DRAMCtrl::RankStats::memoryStateTime, pwrState, pwrStateTick, stats, and updatePowerStats().
Referenced by DRAMCtrl::RankStats::preDumpStats().
void DRAMCtrl::Rank::flushCmdList | ( | ) |
Push command out of cmdList queue that are scheduled at or before curTick() to DRAMPower library All commands before curTick are guaranteed to be complete and can safely be flushed.
Definition at line 1950 of file dram_ctrl.cc.
References DRAMCtrl::Command::bank, cmdList, curTick(), divCeil(), power, DRAMPower::powerlib, DRAMCtrl::sortTime(), DRAMCtrl::Command::timeStamp, and DRAMCtrl::Command::type.
Referenced by updatePowerStats().
|
inline |
Trigger a self-refresh exit if there are entries enqueued Exit if there are any read entries regardless of the bus state.
If we are currently issuing write commands, exit if we have any write commands enqueued as well. Could expand this in the future to analyze state of entire queue if needed.
Definition at line 501 of file dram_ctrl.hh.
References QoS::MemCtrl::busStateNext, Stats::Group::regStats(), Stats::Group::resetStats(), Clocked::tick, and QoS::MemCtrl::WRITE.
|
inline |
Check if the current rank has all banks closed and is not in a low power state.
Return | true if the rank is idle from a bank and power point of view |
Definition at line 489 of file dram_ctrl.hh.
References DRAMCtrl::PWR_IDLE.
|
inline |
Check if there is no refresh and no preparation of refresh ongoing i.e.
the refresh state machine is in idle
Return | true if the rank is idle from a refresh point of view |
Definition at line 480 of file dram_ctrl.hh.
References DRAMCtrl::REF_IDLE.
Referenced by DRAMCtrl::chooseNextFRFCFS(), and DRAMCtrl::processRespondEvent().
bool DRAMCtrl::Rank::isQueueEmpty | ( | ) | const |
Check if the command queue of current rank is idle.
Return | true if the there are no commands in Q. Bus direction determines queue checked. |
Definition at line 1925 of file dram_ctrl.cc.
References QoS::MemCtrl::READ, readEntries, QoS::MemCtrl::WRITE, and writeEntries.
Referenced by processPowerEvent(), processPrechargeEvent(), processRefreshEvent(), and DRAMCtrl::processRespondEvent().
|
inline |
Definition at line 456 of file dram_ctrl.hh.
References csprintf(), SimObject::name(), and DRAMCtrl::startup().
Referenced by Rank().
void DRAMCtrl::Rank::powerDownSleep | ( | PowerState | pwr_state, |
Tick | tick | ||
) |
Schedule a transition to power-down (sleep)
pwr_state | Power state to transition to |
tick | Absolute tick when transition should take place |
Definition at line 2257 of file dram_ctrl.cc.
References cmdList, divCeil(), DPRINTF, inLowPowerState, DRAMCtrl::PWR_ACT_PDN, DRAMCtrl::PWR_PRE_PDN, DRAMCtrl::PWR_REF, DRAMCtrl::PWR_SREF, pwrStatePostRefresh, rank, schedulePowerEvent(), and wakeUpAllowedAt.
Referenced by processPowerEvent(), processPrechargeEvent(), processRefreshEvent(), and DRAMCtrl::processRespondEvent().
void DRAMCtrl::Rank::processActivateEvent | ( | ) |
Definition at line 1978 of file dram_ctrl.cc.
References curTick(), DRAMCtrl::PWR_ACT, pwrState, and schedulePowerEvent().
Referenced by Rank().
void DRAMCtrl::Rank::processPowerEvent | ( | ) |
Definition at line 2378 of file dram_ctrl.cc.
References activateEvent, curTick(), DPRINTF, Drained, Draining, isQueueEmpty(), DRAMCtrl::RankStats::memoryStateTime, outstandingEvents, powerDownSleep(), powerEvent, prechargeEvent, DRAMCtrl::PWR_ACT, DRAMCtrl::PWR_ACT_PDN, DRAMCtrl::PWR_IDLE, DRAMCtrl::PWR_PRE_PDN, DRAMCtrl::PWR_REF, DRAMCtrl::PWR_SREF, pwrState, pwrStatePostRefresh, pwrStateTick, pwrStateTrans, rank, DRAMCtrl::REF_IDLE, DRAMCtrl::REF_PD_EXIT, DRAMCtrl::REF_PRE, DRAMCtrl::REF_SREF_EXIT, DRAMCtrl::REF_START, refreshEvent, refreshState, EventManager::schedule(), Event::scheduled(), schedulePowerEvent(), stats, and DRAMCtrl::RankStats::totalIdleTime.
Referenced by Rank().
void DRAMCtrl::Rank::processPrechargeEvent | ( | ) |
Definition at line 1988 of file dram_ctrl.cc.
References curTick(), DPRINTF, isQueueEmpty(), numBanksActive, outstandingEvents, powerDownSleep(), DRAMCtrl::PWR_ACT, DRAMCtrl::PWR_IDLE, DRAMCtrl::PWR_PRE_PDN, pwrState, rank, and schedulePowerEvent().
Referenced by Rank().
void DRAMCtrl::Rank::processRefreshEvent | ( | ) |
Definition at line 2030 of file dram_ctrl.cc.
References ArmISA::b, banks, cmdList, curTick(), divCeil(), DPRINTF, Drained, Draining, fatal, inLowPowerState, isQueueEmpty(), DRAMCtrl::Bank::NO_ROW, numBanksActive, outstandingEvents, powerDownSleep(), powerEvent, prechargeEvent, DRAMCtrl::PWR_IDLE, DRAMCtrl::PWR_PRE_PDN, DRAMCtrl::PWR_REF, pwrState, pwrStatePostRefresh, rank, DRAMCtrl::REF_DRAIN, DRAMCtrl::REF_IDLE, DRAMCtrl::REF_PD_EXIT, DRAMCtrl::REF_PRE, DRAMCtrl::REF_RUN, DRAMCtrl::REF_SREF_EXIT, DRAMCtrl::REF_START, refreshDueAt, refreshEvent, refreshState, EventManager::schedule(), Event::scheduled(), schedulePowerEvent(), scheduleWakeUpEvent(), and updatePowerStats().
Referenced by Rank().
void DRAMCtrl::Rank::processWakeUpEvent | ( | ) |
Definition at line 2360 of file dram_ctrl.cc.
References curTick(), DRAMCtrl::PWR_ACT, DRAMCtrl::PWR_ACT_PDN, DRAMCtrl::PWR_IDLE, DRAMCtrl::PWR_PRE_PDN, DRAMCtrl::PWR_SREF, pwrState, and schedulePowerEvent().
Referenced by Rank().
void DRAMCtrl::Rank::processWriteDoneEvent | ( | ) |
void DRAMCtrl::Rank::regStats | ( | ) |
void DRAMCtrl::Rank::resetStats | ( | ) |
Reset stats on a stats event.
Definition at line 2567 of file dram_ctrl.cc.
References curTick(), divCeil(), power, and DRAMPower::powerlib.
Referenced by DRAMCtrl::RankStats::resetStats().
|
private |
Schedule a power state transition in the future, and potentially override an already scheduled transition.
pwr_state | Power state to transition to |
tick | Tick when transition should take place |
Definition at line 2236 of file dram_ctrl.cc.
References curTick(), DPRINTF, panic, powerEvent, pwrStateTrans, EventManager::schedule(), Event::scheduled(), and Event::when().
Referenced by powerDownSleep(), processActivateEvent(), processPowerEvent(), processPrechargeEvent(), processRefreshEvent(), and processWakeUpEvent().
void DRAMCtrl::Rank::scheduleWakeUpEvent | ( | Tick | exit_delay | ) |
schedule and event to wake-up from power-down or self-refresh and update bank timing parameters
exit_delay | Relative tick defining the delay required between low-power exit and the next command |
Definition at line 2308 of file dram_ctrl.cc.
References ArmISA::b, banks, cmdList, curTick(), divCeil(), DPRINTF, inLowPowerState, DRAMCtrl::PWR_ACT_PDN, DRAMCtrl::PWR_IDLE, DRAMCtrl::PWR_PRE_PDN, DRAMCtrl::PWR_SREF, pwrState, pwrStatePostRefresh, pwrStateTrans, rank, DRAMCtrl::REF_PD_EXIT, refreshState, EventManager::schedule(), wakeUpAllowedAt, and wakeUpEvent.
Referenced by DRAMCtrl::doDRAMAccess(), and processRefreshEvent().
void DRAMCtrl::Rank::startup | ( | Tick | ref_tick | ) |
Kick off accounting for power and refresh states and schedule initial refresh.
ref_tick | Tick for first refresh |
Definition at line 1901 of file dram_ctrl.cc.
References curTick(), pwrStateTick, refreshEvent, and EventManager::schedule().
void DRAMCtrl::Rank::suspend | ( | ) |
Stop the refresh events.
Definition at line 1913 of file dram_ctrl.cc.
References EventManager::deschedule(), DRAMCtrl::PWR_IDLE, pwrStatePostRefresh, refreshEvent, and updatePowerStats().
|
private |
Function to update Power Stats.
Definition at line 2511 of file dram_ctrl.cc.
References DRAMCtrl::RankStats::actBackEnergy, DRAMCtrl::RankStats::actEnergy, DRAMCtrl::RankStats::actPowerDownEnergy, DRAMCtrl::RankStats::averagePower, curTick(), divCeil(), flushCmdList(), SimClock::Frequency, power, DRAMPower::powerlib, DRAMCtrl::RankStats::preBackEnergy, DRAMCtrl::RankStats::preEnergy, DRAMCtrl::RankStats::prePowerDownEnergy, DRAMCtrl::RankStats::readEnergy, DRAMCtrl::RankStats::refreshEnergy, DRAMCtrl::RankStats::selfRefreshEnergy, stats, DRAMCtrl::RankStats::totalEnergy, Stats::ScalarBase< Derived, Stor >::value(), and DRAMCtrl::RankStats::writeEnergy.
Referenced by computeStats(), processRefreshEvent(), and suspend().
EventFunctionWrapper DRAMCtrl::Rank::activateEvent |
Definition at line 564 of file dram_ctrl.hh.
Referenced by DRAMCtrl::activateBank(), processPowerEvent(), DRAMCtrl::processRespondEvent(), and Rank().
std::deque<Tick> DRAMCtrl::Rank::actTicks |
List to keep track of activate ticks.
Definition at line 447 of file dram_ctrl.hh.
Referenced by DRAMCtrl::activateBank().
std::vector<Bank> DRAMCtrl::Rank::banks |
Vector of Banks.
Each rank is made of several devices which in term are made from several banks.
Definition at line 438 of file dram_ctrl.hh.
Referenced by DRAMCtrl::activateBank(), DRAMCtrl::prechargeBank(), processRefreshEvent(), Rank(), and scheduleWakeUpEvent().
std::vector<Command> DRAMCtrl::Rank::cmdList |
List of commands issued, to be sent to DRAMPpower at refresh and stats dump.
Keep commands here since commands to different banks are added out of order. Will only pass commands up to curTick() to DRAMPower after sorting.
Definition at line 432 of file dram_ctrl.hh.
Referenced by DRAMCtrl::activateBank(), DRAMCtrl::doDRAMAccess(), flushCmdList(), powerDownSleep(), DRAMCtrl::prechargeBank(), processRefreshEvent(), and scheduleWakeUpEvent().
bool DRAMCtrl::Rank::inLowPowerState |
rank is in or transitioning to power-down or self-refresh
Definition at line 392 of file dram_ctrl.hh.
Referenced by DRAMCtrl::doDRAMAccess(), powerDownSleep(), processRefreshEvent(), and scheduleWakeUpEvent().
Tick DRAMCtrl::Rank::lastBurstTick |
Track when we issued the last read/write burst.
Definition at line 452 of file dram_ctrl.hh.
Referenced by DRAMCtrl::doDRAMAccess().
|
private |
A reference to the parent DRAMCtrl instance.
Definition at line 340 of file dram_ctrl.hh.
unsigned int DRAMCtrl::Rank::numBanksActive |
To track number of banks which are currently active for this rank.
Definition at line 444 of file dram_ctrl.hh.
Referenced by DRAMCtrl::activateBank(), DRAMCtrl::prechargeBank(), processPrechargeEvent(), and processRefreshEvent().
uint8_t DRAMCtrl::Rank::outstandingEvents |
Number of ACT, RD, and WR events currently scheduled Incremented when a refresh event is started as well Used to determine when a low-power state can be entered.
Definition at line 414 of file dram_ctrl.hh.
Referenced by DRAMCtrl::prechargeBank(), processPowerEvent(), processPrechargeEvent(), processRefreshEvent(), DRAMCtrl::processRespondEvent(), and processWriteDoneEvent().
DRAMPower DRAMCtrl::Rank::power |
One DRAMPower instance per rank.
Definition at line 424 of file dram_ctrl.hh.
Referenced by flushCmdList(), resetStats(), and updatePowerStats().
EventFunctionWrapper DRAMCtrl::Rank::powerEvent |
Definition at line 573 of file dram_ctrl.hh.
Referenced by processPowerEvent(), processRefreshEvent(), Rank(), and schedulePowerEvent().
EventFunctionWrapper DRAMCtrl::Rank::prechargeEvent |
Definition at line 567 of file dram_ctrl.hh.
Referenced by DRAMCtrl::prechargeBank(), processPowerEvent(), processRefreshEvent(), DRAMCtrl::processRespondEvent(), and Rank().
PowerState DRAMCtrl::Rank::pwrState |
Current power state.
Definition at line 382 of file dram_ctrl.hh.
Referenced by computeStats(), DRAMCtrl::doDRAMAccess(), processActivateEvent(), processPowerEvent(), processPrechargeEvent(), processRefreshEvent(), DRAMCtrl::processRespondEvent(), processWakeUpEvent(), and scheduleWakeUpEvent().
|
private |
Previous low-power state, which will be re-entered after refresh.
Definition at line 351 of file dram_ctrl.hh.
Referenced by powerDownSleep(), processPowerEvent(), processRefreshEvent(), scheduleWakeUpEvent(), and suspend().
|
private |
Track when we transitioned to the current power state.
Definition at line 356 of file dram_ctrl.hh.
Referenced by computeStats(), processPowerEvent(), and startup().
|
private |
Since we are taking decisions out of order, we need to keep track of what power transition is happening at what time.
Definition at line 346 of file dram_ctrl.hh.
Referenced by processPowerEvent(), schedulePowerEvent(), and scheduleWakeUpEvent().
uint8_t DRAMCtrl::Rank::rank |
Current Rank index.
Definition at line 397 of file dram_ctrl.hh.
Referenced by DRAMCtrl::activateBank(), DRAMCtrl::chooseNextFRFCFS(), powerDownSleep(), DRAMCtrl::prechargeBank(), processPowerEvent(), processPrechargeEvent(), processRefreshEvent(), and scheduleWakeUpEvent().
uint32_t DRAMCtrl::Rank::readEntries |
Track number of packets in read queue going to this rank.
Definition at line 402 of file dram_ctrl.hh.
Referenced by DRAMCtrl::addToReadQueue(), isQueueEmpty(), and DRAMCtrl::processRespondEvent().
|
private |
Keep track of when a refresh is due.
Definition at line 361 of file dram_ctrl.hh.
Referenced by processRefreshEvent().
EventFunctionWrapper DRAMCtrl::Rank::refreshEvent |
Definition at line 570 of file dram_ctrl.hh.
Referenced by checkDrainDone(), processPowerEvent(), processRefreshEvent(), DRAMCtrl::processRespondEvent(), Rank(), startup(), and suspend().
RefreshState DRAMCtrl::Rank::refreshState |
current refresh state
Definition at line 387 of file dram_ctrl.hh.
Referenced by checkDrainDone(), processPowerEvent(), processRefreshEvent(), DRAMCtrl::processRespondEvent(), and scheduleWakeUpEvent().
|
protected |
Definition at line 579 of file dram_ctrl.hh.
Referenced by computeStats(), processPowerEvent(), Rank(), and updatePowerStats().
Tick DRAMCtrl::Rank::wakeUpAllowedAt |
delay power-down and self-refresh exit until this requirement is met
Definition at line 419 of file dram_ctrl.hh.
Referenced by powerDownSleep(), and scheduleWakeUpEvent().
EventFunctionWrapper DRAMCtrl::Rank::wakeUpEvent |
Definition at line 576 of file dram_ctrl.hh.
Referenced by Rank(), and scheduleWakeUpEvent().
EventFunctionWrapper DRAMCtrl::Rank::writeDoneEvent |
Definition at line 561 of file dram_ctrl.hh.
uint32_t DRAMCtrl::Rank::writeEntries |
Track number of packets in write queue going to this rank.
Definition at line 407 of file dram_ctrl.hh.
Referenced by DRAMCtrl::addToWriteQueue(), and isQueueEmpty().