gem5
|
Rank class includes a vector of banks. More...
Public Member Functions | |
Rank (DRAMCtrl &_memory, const DRAMCtrlParams *_p) | |
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 | isAvailable () const |
Check if the current rank is available for scheduling. 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 | lowPowerEntryReady () const |
Check if the current rank is idle and should enter a low-pwer state. 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 | 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 () |
Public Member Functions inherited from EventManager | |
EventManager (EventManager &em) | |
EventManager (EventManager *em) | |
EventManager (EventQueue *eq) | |
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) |
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 comamnds 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... | |
EventWrapper< Rank,&Rank::processWriteDoneEvent > | writeDoneEvent |
EventWrapper< Rank,&Rank::processActivateEvent > | activateEvent |
EventWrapper< Rank,&Rank::processPrechargeEvent > | prechargeEvent |
EventWrapper< Rank,&Rank::processRefreshEvent > | refreshEvent |
EventWrapper< Rank,&Rank::processPowerEvent > | powerEvent |
EventWrapper< Rank,&Rank::processWakeUpEvent > | wakeUpEvent |
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... | |
Stats::Scalar | actEnergy |
Stats::Scalar | preEnergy |
Stats::Scalar | readEnergy |
Stats::Scalar | writeEnergy |
Stats::Scalar | refreshEnergy |
Stats::Scalar | actBackEnergy |
Stats::Scalar | preBackEnergy |
Stats::Scalar | actPowerDownEnergy |
Stats::Scalar | prePowerDownEnergy |
Stats::Scalar | selfRefreshEnergy |
Stats::Scalar | totalEnergy |
Stats::Scalar | averagePower |
Stats::Scalar | totalIdleTime |
Stat to track total DRAM idle time. More... | |
Stats::Vector | pwrStateTime |
Track time spent in each power state. More... | |
Additional Inherited Members | |
Protected Attributes inherited from EventManager | |
EventQueue * | eventq |
A pointer to this object's event queue. 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 289 of file dram_ctrl.hh.
DRAMCtrl::Rank::Rank | ( | DRAMCtrl & | _memory, |
const DRAMCtrlParams * | _p | ||
) |
Definition at line 1629 of file dram_ctrl.cc.
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 1683 of file dram_ctrl.cc.
References curTick(), DPRINTF, DRAMCtrl::REF_DRAIN, DRAMCtrl::REF_PD_EXIT, and EventManager::schedule().
void DRAMCtrl::Rank::computeStats | ( | ) |
Computes stats just prior to dump event.
Definition at line 2270 of file dram_ctrl.cc.
References curTick(), DPRINTF, ClockedObject::pwrState(), and DRAMCtrl::updatePowerStats().
Referenced by DRAMCtrl::RankDumpCallback::process().
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 1698 of file dram_ctrl.cc.
References DRAMCtrl::Command::bank, curTick(), divCeil(), power(), DRAMCtrl::sortTime(), DRAMCtrl::Command::timeStamp, and DRAMCtrl::Command::type.
|
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 504 of file dram_ctrl.hh.
References DRAMCtrl::busStateNext, memory, readEntries, DRAMCtrl::WRITE, and writeEntries.
|
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 492 of file dram_ctrl.hh.
References DRAMCtrl::PWR_IDLE, and pwrState.
|
inline |
Check if the current rank is available for scheduling.
Rank will be unavailable if refresh is ongoing. This includes refresh events explicitly scheduled from the the controller or memory initiated events which will occur during self-refresh mode.
Return | true if the rank is idle from a refresh point of view |
Definition at line 483 of file dram_ctrl.hh.
References DRAMCtrl::REF_IDLE, and refreshState.
Referenced by DRAMCtrl::processNextReqEvent(), and DRAMCtrl::reorderQueue().
bool DRAMCtrl::Rank::lowPowerEntryReady | ( | ) | const |
Check if the current rank is idle and should enter a low-pwer state.
Return | true if the there are no read commands in Q and there are no outstanding events |
Definition at line 1665 of file dram_ctrl.cc.
References DRAMCtrl::READ, DRAMCtrl::REF_RUN, and DRAMCtrl::WRITE.
Referenced by DRAMCtrl::processRespondEvent().
|
inline |
Definition at line 456 of file dram_ctrl.hh.
References csprintf(), memory, SimObject::name(), and 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 1998 of file dram_ctrl.cc.
References divCeil(), DPRINTF, DRAMCtrl::PWR_ACT_PDN, DRAMCtrl::PWR_PRE_PDN, DRAMCtrl::PWR_REF, and DRAMCtrl::PWR_SREF.
Referenced by DRAMCtrl::processRespondEvent().
void DRAMCtrl::Rank::processActivateEvent | ( | ) |
Definition at line 1726 of file dram_ctrl.cc.
References curTick(), DRAMCtrl::PWR_ACT, and ClockedObject::pwrState().
void DRAMCtrl::Rank::processPowerEvent | ( | ) |
Definition at line 2121 of file dram_ctrl.cc.
References curTick(), DPRINTF, DRAMCtrl::PWR_ACT, DRAMCtrl::PWR_ACT_PDN, DRAMCtrl::PWR_IDLE, DRAMCtrl::PWR_PRE_PDN, DRAMCtrl::PWR_REF, DRAMCtrl::PWR_SREF, ClockedObject::pwrState(), DRAMCtrl::REF_IDLE, DRAMCtrl::REF_PD_EXIT, DRAMCtrl::REF_PRE, DRAMCtrl::REF_SREF_EXIT, DRAMCtrl::REF_START, and EventManager::schedule().
void DRAMCtrl::Rank::processPrechargeEvent | ( | ) |
Definition at line 1736 of file dram_ctrl.cc.
References curTick(), DPRINTF, DRAMCtrl::PWR_ACT, DRAMCtrl::PWR_IDLE, DRAMCtrl::PWR_PRE_PDN, and ClockedObject::pwrState().
void DRAMCtrl::Rank::processRefreshEvent | ( | ) |
Definition at line 1777 of file dram_ctrl.cc.
References ArmISA::b, curTick(), divCeil(), DPRINTF, Drained, Draining, fatal, DRAMCtrl::Bank::NO_ROW, DRAMCtrl::PWR_IDLE, DRAMCtrl::PWR_PRE_PDN, DRAMCtrl::PWR_REF, DRAMCtrl::PWR_SREF, ClockedObject::pwrState(), DRAMCtrl::REF_DRAIN, DRAMCtrl::REF_IDLE, DRAMCtrl::REF_PD_EXIT, DRAMCtrl::REF_PRE, DRAMCtrl::REF_RUN, DRAMCtrl::REF_SREF_EXIT, DRAMCtrl::REF_START, EventManager::schedule(), and DRAMCtrl::updatePowerStats().
void DRAMCtrl::Rank::processWakeUpEvent | ( | ) |
Definition at line 2103 of file dram_ctrl.cc.
References curTick(), DRAMCtrl::PWR_ACT, DRAMCtrl::PWR_ACT_PDN, DRAMCtrl::PWR_IDLE, DRAMCtrl::PWR_PRE_PDN, DRAMCtrl::PWR_SREF, and ClockedObject::pwrState().
void DRAMCtrl::Rank::processWriteDoneEvent | ( | ) |
Definition at line 1766 of file dram_ctrl.cc.
void DRAMCtrl::Rank::regStats | ( | ) |
Definition at line 2288 of file dram_ctrl.cc.
References SimObject::name(), and Stats::registerDumpCallback().
|
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 1977 of file dram_ctrl.cc.
References curTick(), DPRINTF, panic, and EventManager::schedule().
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 2052 of file dram_ctrl.cc.
References ArmISA::b, curTick(), divCeil(), DPRINTF, DRAMCtrl::PWR_ACT_PDN, DRAMCtrl::PWR_IDLE, DRAMCtrl::PWR_PRE_PDN, DRAMCtrl::PWR_SREF, ClockedObject::pwrState(), DRAMCtrl::REF_PD_EXIT, and EventManager::schedule().
Referenced by DRAMCtrl::doDRAMAccess().
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 1641 of file dram_ctrl.cc.
References curTick(), and EventManager::schedule().
void DRAMCtrl::Rank::suspend | ( | ) |
Stop the refresh events.
Definition at line 1653 of file dram_ctrl.cc.
References EventManager::deschedule(), DRAMCtrl::PWR_IDLE, and DRAMCtrl::updatePowerStats().
|
private |
|
private |
Definition at line 332 of file dram_ctrl.hh.
|
private |
Definition at line 323 of file dram_ctrl.hh.
EventWrapper<Rank, &Rank::processActivateEvent> DRAMCtrl::Rank::activateEvent |
Definition at line 564 of file dram_ctrl.hh.
Referenced by DRAMCtrl::activateBank(), and DRAMCtrl::processRespondEvent().
|
private |
Definition at line 342 of file dram_ctrl.hh.
std::deque<Tick> DRAMCtrl::Rank::actTicks |
List to keep track of activate ticks.
Definition at line 452 of file dram_ctrl.hh.
Referenced by DRAMCtrl::activateBank(), and DRAMCtrl::DRAMCtrl().
|
private |
Definition at line 355 of file dram_ctrl.hh.
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 443 of file dram_ctrl.hh.
Referenced by DRAMCtrl::activateBank(), and DRAMCtrl::DRAMCtrl().
std::vector<Command> DRAMCtrl::Rank::cmdList |
List of comamnds 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 437 of file dram_ctrl.hh.
Referenced by DRAMCtrl::activateBank(), DRAMCtrl::doDRAMAccess(), and DRAMCtrl::prechargeBank().
bool DRAMCtrl::Rank::inLowPowerState |
rank is in or transitioning to power-down or self-refresh
Definition at line 397 of file dram_ctrl.hh.
Referenced by DRAMCtrl::doDRAMAccess().
|
private |
A reference to the parent DRAMCtrl instance.
Definition at line 297 of file dram_ctrl.hh.
Referenced by forceSelfRefreshExit(), and name().
unsigned int DRAMCtrl::Rank::numBanksActive |
To track number of banks which are currently active for this rank.
Definition at line 449 of file dram_ctrl.hh.
Referenced by DRAMCtrl::activateBank(), and DRAMCtrl::prechargeBank().
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 419 of file dram_ctrl.hh.
Referenced by DRAMCtrl::prechargeBank(), DRAMCtrl::processNextReqEvent(), and DRAMCtrl::processRespondEvent().
DRAMPower DRAMCtrl::Rank::power |
One DRAMPower instance per rank.
Definition at line 429 of file dram_ctrl.hh.
EventWrapper<Rank, &Rank::processPowerEvent> DRAMCtrl::Rank::powerEvent |
Definition at line 576 of file dram_ctrl.hh.
|
private |
Definition at line 337 of file dram_ctrl.hh.
EventWrapper<Rank, &Rank::processPrechargeEvent> DRAMCtrl::Rank::prechargeEvent |
Definition at line 568 of file dram_ctrl.hh.
Referenced by DRAMCtrl::prechargeBank(), and DRAMCtrl::processRespondEvent().
|
private |
Definition at line 324 of file dram_ctrl.hh.
|
private |
Definition at line 347 of file dram_ctrl.hh.
PowerState DRAMCtrl::Rank::pwrState |
Current power state.
Definition at line 387 of file dram_ctrl.hh.
Referenced by DRAMCtrl::doDRAMAccess(), inPwrIdleState(), and DRAMCtrl::processRespondEvent().
|
private |
Previous low-power state, which will be re-entered after refresh.
Definition at line 308 of file dram_ctrl.hh.
|
private |
Track when we transitioned to the current power state.
Definition at line 313 of file dram_ctrl.hh.
|
private |
Track time spent in each power state.
Definition at line 366 of file dram_ctrl.hh.
|
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 303 of file dram_ctrl.hh.
uint8_t DRAMCtrl::Rank::rank |
Current Rank index.
Definition at line 402 of file dram_ctrl.hh.
Referenced by DRAMCtrl::activateBank(), DRAMCtrl::DRAMCtrl(), name(), and DRAMCtrl::prechargeBank().
|
private |
Definition at line 325 of file dram_ctrl.hh.
uint32_t DRAMCtrl::Rank::readEntries |
Track number of packets in read queue going to this rank.
Definition at line 407 of file dram_ctrl.hh.
Referenced by DRAMCtrl::addToReadQueue(), forceSelfRefreshExit(), and DRAMCtrl::processRespondEvent().
|
private |
Keep track of when a refresh is due.
Definition at line 318 of file dram_ctrl.hh.
|
private |
Definition at line 327 of file dram_ctrl.hh.
EventWrapper<Rank, &Rank::processRefreshEvent> DRAMCtrl::Rank::refreshEvent |
Definition at line 572 of file dram_ctrl.hh.
RefreshState DRAMCtrl::Rank::refreshState |
current refresh state
Definition at line 392 of file dram_ctrl.hh.
Referenced by isAvailable(), and DRAMCtrl::processRespondEvent().
|
private |
Definition at line 352 of file dram_ctrl.hh.
|
private |
Definition at line 354 of file dram_ctrl.hh.
|
private |
Stat to track total DRAM idle time.
Definition at line 361 of file dram_ctrl.hh.
Tick DRAMCtrl::Rank::wakeUpAllowedAt |
delay power-down and self-refresh exit until this requirement is met
Definition at line 424 of file dram_ctrl.hh.
EventWrapper<Rank, &Rank::processWakeUpEvent> DRAMCtrl::Rank::wakeUpEvent |
Definition at line 580 of file dram_ctrl.hh.
EventWrapper<Rank, &Rank::processWriteDoneEvent> DRAMCtrl::Rank::writeDoneEvent |
Definition at line 560 of file dram_ctrl.hh.
Referenced by DRAMCtrl::processNextReqEvent().
|
private |
Definition at line 326 of file dram_ctrl.hh.
uint32_t DRAMCtrl::Rank::writeEntries |
Track number of packets in write queue going to this rank.
Definition at line 412 of file dram_ctrl.hh.
Referenced by DRAMCtrl::addToWriteQueue(), forceSelfRefreshExit(), and DRAMCtrl::processNextReqEvent().