From: Nikos Nikoleris Date: Tue, 19 May 2020 16:25:32 +0000 (+0100) Subject: mem: Use beats_per_clock as the DDR data rate for DRAMPower X-Git-Tag: v20.1.0.0~419 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=e50ab5a2ecb71e3c80bc8c85e1055f042f491967;p=gem5.git 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 Reviewed-by: Wendy Elsasser Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/30056 Tested-by: kokoro Reviewed-by: Daniel Carvalho --- diff --git a/src/mem/drampower.cc b/src/mem/drampower.cc index f5069282b..13551a0b4 100644 --- a/src/mem/drampower.cc +++ b/src/mem/drampower.cc @@ -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; -} diff --git a/src/mem/drampower.hh b/src/mem/drampower.hh index ed47476e7..da24bcadb 100644 --- a/src/mem/drampower.hh +++ b/src/mem/drampower.hh @@ -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) */