gem5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Public Attributes | Private Member Functions | Private Attributes | List of all members
DRAMCtrl::Rank Class Reference

Rank class includes a vector of banks. More...

Inheritance diagram for DRAMCtrl::Rank:
EventManager

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)
 
EventQueueeventQueue () 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< CommandcmdList
 List of comamnds issued, to be sent to DRAMPpower at refresh and stats dump. More...
 
std::vector< Bankbanks
 Vector of Banks. More...
 
unsigned int numBanksActive
 To track number of banks which are currently active for this rank. More...
 
std::deque< TickactTicks
 List to keep track of activate ticks. More...
 
EventWrapper< Rank,&Rank::processWriteDoneEventwriteDoneEvent
 
EventWrapper< Rank,&Rank::processActivateEventactivateEvent
 
EventWrapper< Rank,&Rank::processPrechargeEventprechargeEvent
 
EventWrapper< Rank,&Rank::processRefreshEventrefreshEvent
 
EventWrapper< Rank,&Rank::processPowerEventpowerEvent
 
EventWrapper< Rank,&Rank::processWakeUpEventwakeUpEvent
 

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

DRAMCtrlmemory
 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
EventQueueeventq
 A pointer to this object's event queue. More...
 

Detailed Description

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.

Constructor & Destructor Documentation

DRAMCtrl::Rank::Rank ( DRAMCtrl _memory,
const DRAMCtrlParams *  _p 
)

Definition at line 1629 of file dram_ctrl.cc.

Member Function Documentation

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.

bool DRAMCtrl::Rank::forceSelfRefreshExit ( ) const
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.

Returns
boolean indicating self-refresh exit should be scheduled

Definition at line 504 of file dram_ctrl.hh.

References DRAMCtrl::busStateNext, memory, readEntries, DRAMCtrl::WRITE, and writeEntries.

bool DRAMCtrl::Rank::inPwrIdleState ( ) const
inline

Check if the current rank has all banks closed and is not in a low power state.

Parameters
Returntrue 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.

bool DRAMCtrl::Rank::isAvailable ( ) const
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.

Parameters
Returntrue 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.

Parameters
Returntrue 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().

const std::string DRAMCtrl::Rank::name ( ) const
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)

Parameters
pwr_statePower state to transition to
tickAbsolute 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 ( )
void DRAMCtrl::Rank::processPrechargeEvent ( )
void DRAMCtrl::Rank::processRefreshEvent ( )
void DRAMCtrl::Rank::processWakeUpEvent ( )
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().

void DRAMCtrl::Rank::schedulePowerEvent ( PowerState  pwr_state,
Tick  tick 
)
private

Schedule a power state transition in the future, and potentially override an already scheduled transition.

Parameters
pwr_statePower state to transition to
tickTick 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

Parameters
exit_delayRelative 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.

Parameters
ref_tickTick 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().

void DRAMCtrl::Rank::updatePowerStats ( )
private

Function to update Power Stats.

Definition at line 2230 of file dram_ctrl.cc.

References power().

Member Data Documentation

Stats::Scalar DRAMCtrl::Rank::actBackEnergy
private

Definition at line 332 of file dram_ctrl.hh.

Stats::Scalar DRAMCtrl::Rank::actEnergy
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().

Stats::Scalar DRAMCtrl::Rank::actPowerDownEnergy
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().

Stats::Scalar DRAMCtrl::Rank::averagePower
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().

DRAMCtrl& DRAMCtrl::Rank::memory
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.

Stats::Scalar DRAMCtrl::Rank::preBackEnergy
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().

Stats::Scalar DRAMCtrl::Rank::preEnergy
private

Definition at line 324 of file dram_ctrl.hh.

Stats::Scalar DRAMCtrl::Rank::prePowerDownEnergy
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().

PowerState DRAMCtrl::Rank::pwrStatePostRefresh
private

Previous low-power state, which will be re-entered after refresh.

Definition at line 308 of file dram_ctrl.hh.

Tick DRAMCtrl::Rank::pwrStateTick
private

Track when we transitioned to the current power state.

Definition at line 313 of file dram_ctrl.hh.

Stats::Vector DRAMCtrl::Rank::pwrStateTime
private

Track time spent in each power state.

Definition at line 366 of file dram_ctrl.hh.

PowerState DRAMCtrl::Rank::pwrStateTrans
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().

Stats::Scalar DRAMCtrl::Rank::readEnergy
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().

Tick DRAMCtrl::Rank::refreshDueAt
private

Keep track of when a refresh is due.

Definition at line 318 of file dram_ctrl.hh.

Stats::Scalar DRAMCtrl::Rank::refreshEnergy
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().

Stats::Scalar DRAMCtrl::Rank::selfRefreshEnergy
private

Definition at line 352 of file dram_ctrl.hh.

Stats::Scalar DRAMCtrl::Rank::totalEnergy
private

Definition at line 354 of file dram_ctrl.hh.

Stats::Scalar DRAMCtrl::Rank::totalIdleTime
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().

Stats::Scalar DRAMCtrl::Rank::writeEnergy
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().


The documentation for this class was generated from the following files:

Generated on Fri Jun 9 2017 13:04:08 for gem5 by doxygen 1.8.6