mem: Use beats_per_clock as the DDR data rate for DRAMPower

The data rate is used by the drampower lib to estimate the power
consumption of the DRAM Core. Previously, we used the formula:

burst_cycles = divCeil(p->tBURST_MAX, p->tCK);
data_rate = p->burst_length / burst_cycles;

to derive the data_rate. However, under certain configurations this
formula computes the wrong result due to rounding errors. This patch
simplifies the way we derive the data_rate by passing the value of the
DRAM parameter beats_per_clock.

Change-Id: Ic8cd35bb4641d9c0a704675d2672a6fe4f4ec13e
Signed-off-by: Nikos Nikoleris <nikos.nikoleris@arm.com>
Reviewed-by: Wendy Elsasser <wendy.elsasser@arm.com>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/30056
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Daniel Carvalho <odanrc@yahoo.com.br>
This commit is contained in:
Nikos Nikoleris
2020-05-19 17:25:32 +01:00
parent 0bd936d071
commit e50ab5a2ec
2 changed files with 1 additions and 17 deletions

View File

@@ -53,7 +53,7 @@ DRAMPower::getArchParams(const DRAMCtrlParams* p)
archSpec.nbrOfBanks = p->banks_per_rank;
// One DRAMPower instance per rank, hence set this to 1
archSpec.nbrOfRanks = 1;
archSpec.dataRate = getDataRate(p);
archSpec.dataRate = p->beats_per_clock;
// For now we can ignore the number of columns and rows as they
// are not used in the power calculation.
archSpec.nbrOfColumns = 0;
@@ -146,14 +146,3 @@ DRAMPower::hasTwoVDD(const DRAMCtrlParams* p)
{
return p->VDD2 == 0 ? false : true;
}
uint8_t
DRAMPower::getDataRate(const DRAMCtrlParams* p)
{
uint32_t burst_cycles = divCeil(p->tBURST_MAX, p->tCK);
uint8_t data_rate = p->burst_length / burst_cycles;
// 4 for GDDR5
if (data_rate != 1 && data_rate != 2 && data_rate != 4 && data_rate != 8)
fatal("Got unexpected data rate %d, should be 1 or 2 or 4 or 8\n");
return data_rate;
}

View File

@@ -73,11 +73,6 @@ class DRAMPower
*/
static Data::MemPowerSpec getPowerParams(const DRAMCtrlParams* p);
/**
* Determine data rate, either one or two.
*/
static uint8_t getDataRate(const DRAMCtrlParams* p);
/**
* Determine if DRAM has two voltage domains (or one)
*/