mem: Add bank and rank indices as fields to the DRAM bank
This patch adds the index of the bank and rank as a field so that we can determine the identity of a given bank (reference or pointer) for the power tracing. We also grab the opportunity of cleaning up the arguments used for identifying the bank when activating.
This commit is contained in:
parent
d59bc8ee1f
commit
b4ce51eb9e
2 changed files with 25 additions and 17 deletions
|
@ -96,6 +96,14 @@ DRAMCtrl::DRAMCtrl(const DRAMCtrlParams* p) :
|
||||||
actTicks[c].resize(activationLimit, 0);
|
actTicks[c].resize(activationLimit, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// set the bank indices
|
||||||
|
for (int r = 0; r < ranksPerChannel; r++) {
|
||||||
|
for (int b = 0; b < banksPerRank; b++) {
|
||||||
|
banks[r][b].rank = r;
|
||||||
|
banks[r][b].bank = b;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// perform a basic check of the write thresholds
|
// perform a basic check of the write thresholds
|
||||||
if (p->write_low_thresh_perc >= p->write_high_thresh_perc)
|
if (p->write_low_thresh_perc >= p->write_high_thresh_perc)
|
||||||
fatal("Write buffer low threshold %d must be smaller than the "
|
fatal("Write buffer low threshold %d must be smaller than the "
|
||||||
|
@ -752,23 +760,24 @@ DRAMCtrl::accessAndRespond(PacketPtr pkt, Tick static_latency)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
DRAMCtrl::activateBank(Tick act_tick, uint8_t rank, uint8_t bank,
|
DRAMCtrl::activateBank(Bank& bank, Tick act_tick, uint32_t row)
|
||||||
uint32_t row, Bank& bank_ref)
|
|
||||||
{
|
{
|
||||||
assert(0 <= rank && rank < ranksPerChannel);
|
// get the rank index from the bank
|
||||||
|
uint8_t rank = bank.rank;
|
||||||
|
|
||||||
assert(actTicks[rank].size() == activationLimit);
|
assert(actTicks[rank].size() == activationLimit);
|
||||||
|
|
||||||
DPRINTF(DRAM, "Activate at tick %d\n", act_tick);
|
DPRINTF(DRAM, "Activate at tick %d\n", act_tick);
|
||||||
|
|
||||||
// update the open row
|
// update the open row
|
||||||
assert(bank_ref.openRow == Bank::NO_ROW);
|
assert(bank.openRow == Bank::NO_ROW);
|
||||||
bank_ref.openRow = row;
|
bank.openRow = row;
|
||||||
|
|
||||||
// start counting anew, this covers both the case when we
|
// start counting anew, this covers both the case when we
|
||||||
// auto-precharged, and when this access is forced to
|
// auto-precharged, and when this access is forced to
|
||||||
// precharge
|
// precharge
|
||||||
bank_ref.bytesAccessed = 0;
|
bank.bytesAccessed = 0;
|
||||||
bank_ref.rowAccesses = 0;
|
bank.rowAccesses = 0;
|
||||||
|
|
||||||
++numBanksActive;
|
++numBanksActive;
|
||||||
assert(numBanksActive <= banksPerRank * ranksPerChannel);
|
assert(numBanksActive <= banksPerRank * ranksPerChannel);
|
||||||
|
@ -777,10 +786,10 @@ DRAMCtrl::activateBank(Tick act_tick, uint8_t rank, uint8_t bank,
|
||||||
act_tick, numBanksActive);
|
act_tick, numBanksActive);
|
||||||
|
|
||||||
// The next access has to respect tRAS for this bank
|
// The next access has to respect tRAS for this bank
|
||||||
bank_ref.preAllowedAt = act_tick + tRAS;
|
bank.preAllowedAt = act_tick + tRAS;
|
||||||
|
|
||||||
// Respect the row-to-column command delay
|
// Respect the row-to-column command delay
|
||||||
bank_ref.colAllowedAt = act_tick + tRCD;
|
bank.colAllowedAt = act_tick + tRCD;
|
||||||
|
|
||||||
// start by enforcing tRRD
|
// start by enforcing tRRD
|
||||||
for(int i = 0; i < banksPerRank; i++) {
|
for(int i = 0; i < banksPerRank; i++) {
|
||||||
|
@ -922,8 +931,7 @@ DRAMCtrl::doDRAMAccess(DRAMPacket* dram_pkt)
|
||||||
|
|
||||||
// Record the activation and deal with all the global timing
|
// Record the activation and deal with all the global timing
|
||||||
// constraints caused be a new activation (tRRD and tXAW)
|
// constraints caused be a new activation (tRRD and tXAW)
|
||||||
activateBank(act_tick, dram_pkt->rank, dram_pkt->bank,
|
activateBank(bank, act_tick, dram_pkt->row);
|
||||||
dram_pkt->row, bank);
|
|
||||||
|
|
||||||
// issue the command as early as possible
|
// issue the command as early as possible
|
||||||
cmd_at = bank.colAllowedAt;
|
cmd_at = bank.colAllowedAt;
|
||||||
|
|
|
@ -154,6 +154,8 @@ class DRAMCtrl : public AbstractMemory
|
||||||
static const uint32_t NO_ROW = -1;
|
static const uint32_t NO_ROW = -1;
|
||||||
|
|
||||||
uint32_t openRow;
|
uint32_t openRow;
|
||||||
|
uint8_t rank;
|
||||||
|
uint8_t bank;
|
||||||
|
|
||||||
Tick colAllowedAt;
|
Tick colAllowedAt;
|
||||||
Tick preAllowedAt;
|
Tick preAllowedAt;
|
||||||
|
@ -163,7 +165,8 @@ class DRAMCtrl : public AbstractMemory
|
||||||
uint32_t bytesAccessed;
|
uint32_t bytesAccessed;
|
||||||
|
|
||||||
Bank() :
|
Bank() :
|
||||||
openRow(NO_ROW), colAllowedAt(0), preAllowedAt(0), actAllowedAt(0),
|
openRow(NO_ROW), rank(0), bank(0),
|
||||||
|
colAllowedAt(0), preAllowedAt(0), actAllowedAt(0),
|
||||||
rowAccesses(0), bytesAccessed(0)
|
rowAccesses(0), bytesAccessed(0)
|
||||||
{ }
|
{ }
|
||||||
};
|
};
|
||||||
|
@ -387,14 +390,11 @@ class DRAMCtrl : public AbstractMemory
|
||||||
* method updates the time that the banks become available based
|
* method updates the time that the banks become available based
|
||||||
* on the current limits.
|
* on the current limits.
|
||||||
*
|
*
|
||||||
|
* @param bank Reference to the bank
|
||||||
* @param act_tick Time when the activation takes place
|
* @param act_tick Time when the activation takes place
|
||||||
* @param rank Index of the rank
|
|
||||||
* @param bank Index of the bank
|
|
||||||
* @param row Index of the row
|
* @param row Index of the row
|
||||||
* @param bank_ref Reference to the bank
|
|
||||||
*/
|
*/
|
||||||
void activateBank(Tick act_tick, uint8_t rank, uint8_t bank,
|
void activateBank(Bank& bank, Tick act_tick, uint32_t row);
|
||||||
uint32_t row, Bank& bank_ref);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Precharge a given bank and also update when the precharge is
|
* Precharge a given bank and also update when the precharge is
|
||||||
|
|
Loading…
Reference in a new issue