summaryrefslogtreecommitdiff
path: root/ext/drampower/src/MemoryPowerModel.cc
diff options
context:
space:
mode:
Diffstat (limited to 'ext/drampower/src/MemoryPowerModel.cc')
-rw-r--r--ext/drampower/src/MemoryPowerModel.cc331
1 files changed, 151 insertions, 180 deletions
diff --git a/ext/drampower/src/MemoryPowerModel.cc b/ext/drampower/src/MemoryPowerModel.cc
index 4817d1bb5..e020830e6 100644
--- a/ext/drampower/src/MemoryPowerModel.cc
+++ b/ext/drampower/src/MemoryPowerModel.cc
@@ -37,23 +37,24 @@
#include "MemoryPowerModel.h"
-#include <cmath> // For pow
-
#include <stdint.h>
+#include <cmath> // For pow
+#include <iostream> // fmtflags
+
using namespace std;
using namespace Data;
// Calculate energy and average power consumption for the given command trace
-void MemoryPowerModel::power_calc(MemorySpecification memSpec,
- const CommandAnalysis& counters,
+void MemoryPowerModel::power_calc(const MemorySpecification& memSpec,
+ const CommandAnalysis& c,
int term)
{
- MemTimingSpec& t = memSpec.memTimingSpec;
- MemArchitectureSpec& memArchSpec = memSpec.memArchSpec;
- MemPowerSpec& mps = memSpec.memPowerSpec;
+ const MemTimingSpec& t = memSpec.memTimingSpec;
+ const MemArchitectureSpec& memArchSpec = memSpec.memArchSpec;
+ const MemPowerSpec& mps = memSpec.memPowerSpec;
energy.act_energy = 0.0;
energy.pre_energy = 0.0;
@@ -102,16 +103,16 @@ void MemoryPowerModel::power_calc(MemorySpecification memSpec,
// 1 DQS and 1 DM pin is associated with every data byte
int64_t dqPlusDqsPlusMaskBits = memArchSpec.width + memArchSpec.width / 8 + memArchSpec.width / 8;
// Size of one clock period for the data bus.
- double ddrPeriod = t.clkPeriod / memArchSpec.dataRate;
+ double ddrPeriod = t.clkPeriod / static_cast<double>(memArchSpec.dataRate);
// Read IO power is consumed by each DQ (data) and DQS (data strobe) pin
- energy.read_io_energy = calcIoTermEnergy(counters.numberofreads * memArchSpec.burstLength,
+ energy.read_io_energy = calcIoTermEnergy(c.numberofreads * memArchSpec.burstLength,
ddrPeriod,
power.IO_power,
dqPlusDqsBits);
// Write ODT power is consumed by each DQ (data), DQS (data strobe) and DM
- energy.write_term_energy = calcIoTermEnergy(counters.numberofwrites * memArchSpec.burstLength,
+ energy.write_term_energy = calcIoTermEnergy(c.numberofwrites * memArchSpec.burstLength,
ddrPeriod,
power.WR_ODT_power,
dqPlusDqsPlusMaskBits);
@@ -119,14 +120,14 @@ void MemoryPowerModel::power_calc(MemorySpecification memSpec,
if (memArchSpec.nbrOfRanks > 1) {
// Termination power consumed in the idle rank during reads on the active
// rank by each DQ (data) and DQS (data strobe) pin.
- energy.read_oterm_energy = calcIoTermEnergy(counters.numberofreads * memArchSpec.burstLength,
+ energy.read_oterm_energy = calcIoTermEnergy(c.numberofreads * memArchSpec.burstLength,
ddrPeriod,
power.TermRD_power,
dqPlusDqsBits);
// Termination power consumed in the idle rank during writes on the active
// rank by each DQ (data), DQS (data strobe) and DM (data mask) pin.
- energy.write_oterm_energy = calcIoTermEnergy(counters.numberofwrites * memArchSpec.burstLength,
+ energy.write_oterm_energy = calcIoTermEnergy(c.numberofwrites * memArchSpec.burstLength,
ddrPeriod,
power.TermWR_power,
dqPlusDqsPlusMaskBits);
@@ -137,101 +138,101 @@ void MemoryPowerModel::power_calc(MemorySpecification memSpec,
+ energy.read_oterm_energy + energy.write_oterm_energy;
}
- total_cycles = counters.actcycles + counters.precycles +
- counters.f_act_pdcycles + counters.f_pre_pdcycles +
- counters.s_act_pdcycles + counters.s_pre_pdcycles + counters.sref_cycles
- + counters.sref_ref_act_cycles + counters.sref_ref_pre_cycles +
- counters.spup_ref_act_cycles + counters.spup_ref_pre_cycles;
+ total_cycles = c.actcycles + c.precycles +
+ c.f_act_pdcycles + c.f_pre_pdcycles +
+ c.s_act_pdcycles + c.s_pre_pdcycles + c.sref_cycles
+ + c.sref_ref_act_cycles + c.sref_ref_pre_cycles +
+ c.spup_ref_act_cycles + c.spup_ref_pre_cycles;
EnergyDomain vdd0Domain(mps.vdd, t.clkPeriod);
- energy.act_energy = vdd0Domain.calcTivEnergy(counters.numberofacts * t.RAS , mps.idd0 - mps.idd3n);
- energy.pre_energy = vdd0Domain.calcTivEnergy(counters.numberofpres * (t.RC - t.RAS) , mps.idd0 - mps.idd2n);
- energy.read_energy = vdd0Domain.calcTivEnergy(counters.numberofreads * burstCc , mps.idd4r - mps.idd3n);
- energy.write_energy = vdd0Domain.calcTivEnergy(counters.numberofwrites * burstCc , mps.idd4w - mps.idd3n);
- energy.ref_energy = vdd0Domain.calcTivEnergy(counters.numberofrefs * t.RFC , mps.idd5 - mps.idd3n);
- energy.pre_stdby_energy = vdd0Domain.calcTivEnergy(counters.precycles, mps.idd2n);
- energy.act_stdby_energy = vdd0Domain.calcTivEnergy(counters.actcycles, mps.idd3n);
+ energy.act_energy = vdd0Domain.calcTivEnergy(c.numberofacts * t.RAS , mps.idd0 - mps.idd3n);
+ energy.pre_energy = vdd0Domain.calcTivEnergy(c.numberofpres * (t.RC - t.RAS) , mps.idd0 - mps.idd2n);
+ energy.read_energy = vdd0Domain.calcTivEnergy(c.numberofreads * burstCc , mps.idd4r - mps.idd3n);
+ energy.write_energy = vdd0Domain.calcTivEnergy(c.numberofwrites * burstCc , mps.idd4w - mps.idd3n);
+ energy.ref_energy = vdd0Domain.calcTivEnergy(c.numberofrefs * t.RFC , mps.idd5 - mps.idd3n);
+ energy.pre_stdby_energy = vdd0Domain.calcTivEnergy(c.precycles, mps.idd2n);
+ energy.act_stdby_energy = vdd0Domain.calcTivEnergy(c.actcycles, mps.idd3n);
// Idle energy in the active standby clock cycles
- energy.idle_energy_act = vdd0Domain.calcTivEnergy(counters.idlecycles_act, mps.idd3n);
+ energy.idle_energy_act = vdd0Domain.calcTivEnergy(c.idlecycles_act, mps.idd3n);
// Idle energy in the precharge standby clock cycles
- energy.idle_energy_pre = vdd0Domain.calcTivEnergy(counters.idlecycles_pre, mps.idd2n);
+ energy.idle_energy_pre = vdd0Domain.calcTivEnergy(c.idlecycles_pre, mps.idd2n);
// fast-exit active power-down cycles energy
- energy.f_act_pd_energy = vdd0Domain.calcTivEnergy(counters.f_act_pdcycles, mps.idd3p1);
+ energy.f_act_pd_energy = vdd0Domain.calcTivEnergy(c.f_act_pdcycles, mps.idd3p1);
// fast-exit precharged power-down cycles energy
- energy.f_pre_pd_energy = vdd0Domain.calcTivEnergy(counters.f_pre_pdcycles, mps.idd2p1);
+ energy.f_pre_pd_energy = vdd0Domain.calcTivEnergy(c.f_pre_pdcycles, mps.idd2p1);
// slow-exit active power-down cycles energy
- energy.s_act_pd_energy = vdd0Domain.calcTivEnergy(counters.s_act_pdcycles, mps.idd3p0);
+ energy.s_act_pd_energy = vdd0Domain.calcTivEnergy(c.s_act_pdcycles, mps.idd3p0);
// slow-exit precharged power-down cycles energy
- energy.s_pre_pd_energy = vdd0Domain.calcTivEnergy(counters.s_pre_pdcycles, mps.idd2p0);
+ energy.s_pre_pd_energy = vdd0Domain.calcTivEnergy(c.s_pre_pdcycles, mps.idd2p0);
// self-refresh cycles energy including a refresh per self-refresh entry
energy.sref_energy = engy_sref(mps.idd6, mps.idd3n,
mps.idd5, mps.vdd,
- static_cast<double>(counters.sref_cycles), static_cast<double>(counters.sref_ref_act_cycles),
- static_cast<double>(counters.sref_ref_pre_cycles), static_cast<double>(counters.spup_ref_act_cycles),
- static_cast<double>(counters.spup_ref_pre_cycles), t.clkPeriod);
+ static_cast<double>(c.sref_cycles), static_cast<double>(c.sref_ref_act_cycles),
+ static_cast<double>(c.sref_ref_pre_cycles), static_cast<double>(c.spup_ref_act_cycles),
+ static_cast<double>(c.spup_ref_pre_cycles), t.clkPeriod);
// background energy during active auto-refresh cycles in self-refresh
- energy.sref_ref_act_energy = vdd0Domain.calcTivEnergy(counters.sref_ref_act_cycles, mps.idd3p0);
+ energy.sref_ref_act_energy = vdd0Domain.calcTivEnergy(c.sref_ref_act_cycles, mps.idd3p0);
// background energy during precharged auto-refresh cycles in self-refresh
- energy.sref_ref_pre_energy = vdd0Domain.calcTivEnergy(counters.sref_ref_pre_cycles, mps.idd2p0);
+ energy.sref_ref_pre_energy = vdd0Domain.calcTivEnergy(c.sref_ref_pre_cycles, mps.idd2p0);
// background energy during active auto-refresh cycles in self-refresh exit
- energy.spup_ref_act_energy = vdd0Domain.calcTivEnergy(counters.spup_ref_act_cycles, mps.idd3n);
+ energy.spup_ref_act_energy = vdd0Domain.calcTivEnergy(c.spup_ref_act_cycles, mps.idd3n);
// background energy during precharged auto-refresh cycles in self-refresh exit
- energy.spup_ref_pre_energy = vdd0Domain.calcTivEnergy(counters.spup_ref_pre_cycles, mps.idd2n);
+ energy.spup_ref_pre_energy = vdd0Domain.calcTivEnergy(c.spup_ref_pre_cycles, mps.idd2n);
// self-refresh power-up cycles energy -- included
- energy.spup_energy = vdd0Domain.calcTivEnergy(counters.spup_cycles, mps.idd2n);
+ energy.spup_energy = vdd0Domain.calcTivEnergy(c.spup_cycles, mps.idd2n);
// active power-up cycles energy - same as active standby -- included
- energy.pup_act_energy = vdd0Domain.calcTivEnergy(counters.pup_act_cycles, mps.idd3n);
+ energy.pup_act_energy = vdd0Domain.calcTivEnergy(c.pup_act_cycles, mps.idd3n);
// precharged power-up cycles energy - same as precharged standby -- included
- energy.pup_pre_energy = vdd0Domain.calcTivEnergy(counters.pup_pre_cycles, mps.idd2n);
+ energy.pup_pre_energy = vdd0Domain.calcTivEnergy(c.pup_pre_cycles, mps.idd2n);
// similar equations as before to support multiple voltage domains in LPDDR2
// and WIDEIO memories
if (memArchSpec.twoVoltageDomains) {
EnergyDomain vdd2Domain(mps.vdd2, t.clkPeriod);
- energy.act_energy += vdd2Domain.calcTivEnergy(counters.numberofacts * t.RAS , mps.idd02 - mps.idd3n2);
- energy.pre_energy += vdd2Domain.calcTivEnergy(counters.numberofpres * (t.RC - t.RAS) , mps.idd02 - mps.idd2n2);
- energy.read_energy += vdd2Domain.calcTivEnergy(counters.numberofreads * burstCc , mps.idd4r2 - mps.idd3n2);
- energy.write_energy += vdd2Domain.calcTivEnergy(counters.numberofwrites * burstCc , mps.idd4w2 - mps.idd3n2);
- energy.ref_energy += vdd2Domain.calcTivEnergy(counters.numberofrefs * t.RFC , mps.idd52 - mps.idd3n2);
- energy.pre_stdby_energy += vdd2Domain.calcTivEnergy(counters.precycles, mps.idd2n2);
- energy.act_stdby_energy += vdd2Domain.calcTivEnergy(counters.actcycles, mps.idd3n2);
+ energy.act_energy += vdd2Domain.calcTivEnergy(c.numberofacts * t.RAS , mps.idd02 - mps.idd3n2);
+ energy.pre_energy += vdd2Domain.calcTivEnergy(c.numberofpres * (t.RC - t.RAS) , mps.idd02 - mps.idd2n2);
+ energy.read_energy += vdd2Domain.calcTivEnergy(c.numberofreads * burstCc , mps.idd4r2 - mps.idd3n2);
+ energy.write_energy += vdd2Domain.calcTivEnergy(c.numberofwrites * burstCc , mps.idd4w2 - mps.idd3n2);
+ energy.ref_energy += vdd2Domain.calcTivEnergy(c.numberofrefs * t.RFC , mps.idd52 - mps.idd3n2);
+ energy.pre_stdby_energy += vdd2Domain.calcTivEnergy(c.precycles, mps.idd2n2);
+ energy.act_stdby_energy += vdd2Domain.calcTivEnergy(c.actcycles, mps.idd3n2);
// Idle energy in the active standby clock cycles
- energy.idle_energy_act += vdd2Domain.calcTivEnergy(counters.idlecycles_act, mps.idd3n2);
+ energy.idle_energy_act += vdd2Domain.calcTivEnergy(c.idlecycles_act, mps.idd3n2);
// Idle energy in the precharge standby clock cycles
- energy.idle_energy_pre += vdd2Domain.calcTivEnergy(counters.idlecycles_pre, mps.idd2n2);
+ energy.idle_energy_pre += vdd2Domain.calcTivEnergy(c.idlecycles_pre, mps.idd2n2);
// fast-exit active power-down cycles energy
- energy.f_act_pd_energy += vdd2Domain.calcTivEnergy(counters.f_act_pdcycles, mps.idd3p12);
+ energy.f_act_pd_energy += vdd2Domain.calcTivEnergy(c.f_act_pdcycles, mps.idd3p12);
// fast-exit precharged power-down cycles energy
- energy.f_pre_pd_energy += vdd2Domain.calcTivEnergy(counters.f_pre_pdcycles, mps.idd2p12);
+ energy.f_pre_pd_energy += vdd2Domain.calcTivEnergy(c.f_pre_pdcycles, mps.idd2p12);
// slow-exit active power-down cycles energy
- energy.s_act_pd_energy += vdd2Domain.calcTivEnergy(counters.s_act_pdcycles, mps.idd3p02);
+ energy.s_act_pd_energy += vdd2Domain.calcTivEnergy(c.s_act_pdcycles, mps.idd3p02);
// slow-exit precharged power-down cycles energy
- energy.s_pre_pd_energy += vdd2Domain.calcTivEnergy(counters.s_pre_pdcycles, mps.idd2p02);
+ energy.s_pre_pd_energy += vdd2Domain.calcTivEnergy(c.s_pre_pdcycles, mps.idd2p02);
energy.sref_energy += engy_sref(mps.idd62, mps.idd3n2,
mps.idd52, mps.vdd2,
- static_cast<double>(counters.sref_cycles), static_cast<double>(counters.sref_ref_act_cycles),
- static_cast<double>(counters.sref_ref_pre_cycles), static_cast<double>(counters.spup_ref_act_cycles),
- static_cast<double>(counters.spup_ref_pre_cycles), t.clkPeriod);
+ static_cast<double>(c.sref_cycles), static_cast<double>(c.sref_ref_act_cycles),
+ static_cast<double>(c.sref_ref_pre_cycles), static_cast<double>(c.spup_ref_act_cycles),
+ static_cast<double>(c.spup_ref_pre_cycles), t.clkPeriod);
// background energy during active auto-refresh cycles in self-refresh
- energy.sref_ref_act_energy += vdd2Domain.calcTivEnergy(counters.sref_ref_act_cycles, mps.idd3p02);
+ energy.sref_ref_act_energy += vdd2Domain.calcTivEnergy(c.sref_ref_act_cycles, mps.idd3p02);
// background energy during precharged auto-refresh cycles in self-refresh
- energy.sref_ref_pre_energy += vdd2Domain.calcTivEnergy(counters.sref_ref_pre_cycles, mps.idd2p02);
+ energy.sref_ref_pre_energy += vdd2Domain.calcTivEnergy(c.sref_ref_pre_cycles, mps.idd2p02);
// background energy during active auto-refresh cycles in self-refresh exit
- energy.spup_ref_act_energy += vdd2Domain.calcTivEnergy(counters.spup_ref_act_cycles, mps.idd3n2);
+ energy.spup_ref_act_energy += vdd2Domain.calcTivEnergy(c.spup_ref_act_cycles, mps.idd3n2);
// background energy during precharged auto-refresh cycles in self-refresh exit
- energy.spup_ref_pre_energy += vdd2Domain.calcTivEnergy(counters.spup_ref_pre_cycles, mps.idd2n2);
+ energy.spup_ref_pre_energy += vdd2Domain.calcTivEnergy(c.spup_ref_pre_cycles, mps.idd2n2);
// self-refresh power-up cycles energy -- included
- energy.spup_energy += vdd2Domain.calcTivEnergy(counters.spup_cycles, mps.idd2n2);
+ energy.spup_energy += vdd2Domain.calcTivEnergy(c.spup_cycles, mps.idd2n2);
// active power-up cycles energy - same as active standby -- included
- energy.pup_act_energy += vdd2Domain.calcTivEnergy(counters.pup_act_cycles, mps.idd3n2);
+ energy.pup_act_energy += vdd2Domain.calcTivEnergy(c.pup_act_cycles, mps.idd3n2);
// precharged power-up cycles energy - same as precharged standby -- included
- energy.pup_pre_energy += vdd2Domain.calcTivEnergy(counters.pup_pre_cycles, mps.idd2n2);
+ energy.pup_pre_energy += vdd2Domain.calcTivEnergy(c.pup_pre_cycles, mps.idd2n2);
}
// auto-refresh energy during self-refresh cycles
@@ -244,7 +245,7 @@ void MemoryPowerModel::power_calc(MemorySpecification memSpec,
// energy components for both ranks (in a dual-rank system)
energy.total_energy = energy.act_energy + energy.pre_energy + energy.read_energy +
energy.write_energy + energy.ref_energy + energy.io_term_energy +
- memArchSpec.nbrOfRanks * (energy.act_stdby_energy +
+ static_cast<double>(memArchSpec.nbrOfRanks) * (energy.act_stdby_energy +
energy.pre_stdby_energy + energy.sref_energy +
energy.f_act_pd_energy + energy.f_pre_pd_energy + energy.s_act_pd_energy
+ energy.s_pre_pd_energy + energy.sref_ref_energy + energy.spup_ref_energy);
@@ -253,130 +254,100 @@ void MemoryPowerModel::power_calc(MemorySpecification memSpec,
power.average_power = energy.total_energy / (static_cast<double>(total_cycles) * t.clkPeriod);
} // MemoryPowerModel::power_calc
-void MemoryPowerModel::power_print(MemorySpecification memSpec, int term, const CommandAnalysis& counters) const
+void MemoryPowerModel::power_print(const MemorySpecification& memSpec, int term, const CommandAnalysis& c) const
{
- MemTimingSpec& memTimingSpec = memSpec.memTimingSpec;
- MemArchitectureSpec& memArchSpec = memSpec.memArchSpec;
+ const MemTimingSpec& memTimingSpec = memSpec.memTimingSpec;
+ const MemArchitectureSpec& memArchSpec = memSpec.memArchSpec;
+ const uint64_t nRanks = static_cast<uint64_t>(memArchSpec.nbrOfRanks);
+ const char eUnit[] = " pJ";
+ ios_base::fmtflags flags = cout.flags();
+ streamsize precision = cout.precision();
cout.precision(0);
- cout << "* Trace Details:" << endl;
- cout << "Number of Activates: " << fixed << counters.numberofacts << endl;
- cout << "Number of Reads: " << counters.numberofreads << endl;
- cout << "Number of Writes: " << counters.numberofwrites << endl;
- cout << "Number of Precharges: " << counters.numberofpres << endl;
- cout << "Number of Refreshes: " << counters.numberofrefs << endl;
- cout << "Number of Active Cycles: " << counters.actcycles << endl;
- cout << " Number of Active Idle Cycles: " << counters.idlecycles_act << endl;
- cout << " Number of Active Power-Up Cycles: " << counters.pup_act_cycles << endl;
- cout << " Number of Auto-Refresh Active cycles during Self-Refresh " <<
- "Power-Up: " << counters.spup_ref_act_cycles << endl;
- cout << "Number of Precharged Cycles: " << counters.precycles << endl;
- cout << " Number of Precharged Idle Cycles: " << counters.idlecycles_pre << endl;
- cout << " Number of Precharged Power-Up Cycles: " << counters.pup_pre_cycles
- << endl;
- cout << " Number of Auto-Refresh Precharged cycles during Self-Refresh"
- << " Power-Up: " << counters.spup_ref_pre_cycles << endl;
- cout << " Number of Self-Refresh Power-Up Cycles: " << counters.spup_cycles
- << endl;
- cout << "Total Idle Cycles (Active + Precharged): " <<
- counters.idlecycles_act + counters.idlecycles_pre << endl;
- cout << "Number of Power-Downs: " << counters.f_act_pdns +
- counters.s_act_pdns + counters.f_pre_pdns + counters.s_pre_pdns << endl;
- cout << " Number of Active Fast-exit Power-Downs: " << counters.f_act_pdns
- << endl;
- cout << " Number of Active Slow-exit Power-Downs: " << counters.s_act_pdns
- << endl;
- cout << " Number of Precharged Fast-exit Power-Downs: " <<
- counters.f_pre_pdns << endl;
- cout << " Number of Precharged Slow-exit Power-Downs: " <<
- counters.s_pre_pdns << endl;
- cout << "Number of Power-Down Cycles: " << counters.f_act_pdcycles +
- counters.s_act_pdcycles + counters.f_pre_pdcycles + counters.s_pre_pdcycles << endl;
- cout << " Number of Active Fast-exit Power-Down Cycles: " <<
- counters.f_act_pdcycles << endl;
- cout << " Number of Active Slow-exit Power-Down Cycles: " <<
- counters.s_act_pdcycles << endl;
- cout << " Number of Auto-Refresh Active cycles during Self-Refresh: " <<
- counters.sref_ref_act_cycles << endl;
- cout << " Number of Precharged Fast-exit Power-Down Cycles: " <<
- counters.f_pre_pdcycles << endl;
- cout << " Number of Precharged Slow-exit Power-Down Cycles: " <<
- counters.s_pre_pdcycles << endl;
- cout << " Number of Auto-Refresh Precharged cycles during Self-Refresh: " <<
- counters.sref_ref_pre_cycles << endl;
- cout << "Number of Auto-Refresh Cycles: " << counters.numberofrefs *
- memTimingSpec.RFC << endl;
- cout << "Number of Self-Refreshes: " << counters.numberofsrefs << endl;
- cout << "Number of Self-Refresh Cycles: " << counters.sref_cycles << endl;
- cout << "----------------------------------------" << endl;
- cout << "Total Trace Length (clock cycles): " << total_cycles << endl;
- cout << "----------------------------------------" << endl;
+ cout << "* Trace Details:" << fixed << endl
+ << endl << "#ACT commands: " << c.numberofacts
+ << endl << "#RD + #RDA commands: " << c.numberofreads
+ << endl << "#WR + #WRA commands: " << c.numberofwrites
+ /* #PRE commands (precharge all counts a number of #PRE commands equal to the number of active banks) */
+ << endl << "#PRE (+ PREA) commands: " << c.numberofpres
+ << endl << "#REF commands: " << c.numberofrefs
+ << endl << "#Active Cycles: " << c.actcycles
+ << endl << " #Active Idle Cycles: " << c.idlecycles_act
+ << endl << " #Active Power-Up Cycles: " << c.pup_act_cycles
+ << endl << " #Auto-Refresh Active cycles during Self-Refresh Power-Up: " << c.spup_ref_act_cycles
+ << endl << "#Precharged Cycles: " << c.precycles
+ << endl << " #Precharged Idle Cycles: " << c.idlecycles_pre
+ << endl << " #Precharged Power-Up Cycles: " << c.pup_pre_cycles
+ << endl << " #Auto-Refresh Precharged cycles during Self-Refresh Power-Up: " << c.spup_ref_pre_cycles
+ << endl << " #Self-Refresh Power-Up Cycles: " << c.spup_cycles
+ << endl << "Total Idle Cycles (Active + Precharged): " << c.idlecycles_act + c.idlecycles_pre
+ << endl << "#Power-Downs: " << c.f_act_pdns + c.s_act_pdns + c.f_pre_pdns + c.s_pre_pdns
+ << endl << " #Active Fast-exit Power-Downs: " << c.f_act_pdns
+ << endl << " #Active Slow-exit Power-Downs: " << c.s_act_pdns
+ << endl << " #Precharged Fast-exit Power-Downs: " << c.f_pre_pdns
+ << endl << " #Precharged Slow-exit Power-Downs: " << c.s_pre_pdns
+ << endl << "#Power-Down Cycles: " << c.f_act_pdcycles + c.s_act_pdcycles + c.f_pre_pdcycles + c.s_pre_pdcycles
+ << endl << " #Active Fast-exit Power-Down Cycles: " << c.f_act_pdcycles
+ << endl << " #Active Slow-exit Power-Down Cycles: " << c.s_act_pdcycles
+ << endl << " #Auto-Refresh Active cycles during Self-Refresh: " << c.sref_ref_act_cycles
+ << endl << " #Precharged Fast-exit Power-Down Cycles: " << c.f_pre_pdcycles
+ << endl << " #Precharged Slow-exit Power-Down Cycles: " << c.s_pre_pdcycles
+ << endl << " #Auto-Refresh Precharged cycles during Self-Refresh: " << c.sref_ref_pre_cycles
+ << endl << "#Auto-Refresh Cycles: " << c.numberofrefs * memTimingSpec.RFC
+ << endl << "#Self-Refreshes: " << c.numberofsrefs
+ << endl << "#Self-Refresh Cycles: " << c.sref_cycles
+ << endl << "----------------------------------------"
+ << endl << "Total Trace Length (clock cycles): " << total_cycles
+ << endl << "----------------------------------------" << endl;
+
cout.precision(2);
+ cout << endl << "* Trace Power and Energy Estimates:" << endl
+ << endl << "ACT Cmd Energy: " << energy.act_energy << eUnit
+ << endl << "PRE Cmd Energy: " << energy.pre_energy << eUnit
+ << endl << "RD Cmd Energy: " << energy.read_energy << eUnit
+ << endl << "WR Cmd Energy: " << energy.write_energy << eUnit;
- cout << "\n* Trace Power and Energy Estimates:" << endl;
- cout << "ACT Cmd Energy: " << energy.act_energy << " pJ" << endl;
- cout << "PRE Cmd Energy: " << energy.pre_energy << " pJ" << endl;
- cout << "RD Cmd Energy: " << energy.read_energy << " pJ" << endl;
- cout << "WR Cmd Energy: " << energy.write_energy << " pJ" << endl;
if (term) {
- cout << "RD I/O Energy: " << energy.read_io_energy << " pJ" << endl;
+ cout << "RD I/O Energy: " << energy.read_io_energy << eUnit << endl;
// No Termination for LPDDR/2/3 and DDR memories
if (memSpec.memArchSpec.termination) {
- cout << "WR Termination Energy: " << energy.write_term_energy << " pJ" << endl;
+ cout << "WR Termination Energy: " << energy.write_term_energy << eUnit << endl;
}
- if ((memArchSpec.nbrOfRanks > 1) && memSpec.memArchSpec.termination) {
- cout << "RD Termination Energy (Idle rank): " << energy.read_oterm_energy
- << " pJ" << endl;
- cout << "WR Termination Energy (Idle rank): " << energy.write_oterm_energy
- << " pJ" << endl;
+ if (nRanks > 1 && memSpec.memArchSpec.termination) {
+ cout << "RD Termination Energy (Idle rank): " << energy.read_oterm_energy << eUnit
+ << endl << "WR Termination Energy (Idle rank): " << energy.write_oterm_energy << eUnit << endl;
}
}
- cout << "ACT Stdby Energy: " << memArchSpec.nbrOfRanks * energy.act_stdby_energy <<
- " pJ" << endl;
- cout << " Active Idle Energy: " << memArchSpec.nbrOfRanks * energy.idle_energy_act <<
- " pJ" << endl;
- cout << " Active Power-Up Energy: " << memArchSpec.nbrOfRanks * energy.pup_act_energy <<
- " pJ" << endl;
- cout << " Active Stdby Energy during Auto-Refresh cycles in Self-Refresh"
- << " Power-Up: " << memArchSpec.nbrOfRanks * energy.spup_ref_act_energy <<
- " pJ" << endl;
- cout << "PRE Stdby Energy: " << memArchSpec.nbrOfRanks * energy.pre_stdby_energy <<
- " pJ" << endl;
- cout << " Precharge Idle Energy: " << memArchSpec.nbrOfRanks * energy.idle_energy_pre <<
- " pJ" << endl;
- cout << " Precharged Power-Up Energy: " << memArchSpec.nbrOfRanks * energy.pup_pre_energy <<
- " pJ" << endl;
- cout << " Precharge Stdby Energy during Auto-Refresh cycles " <<
- "in Self-Refresh Power-Up: " << memArchSpec.nbrOfRanks * energy.spup_ref_pre_energy <<
- " pJ" << endl;
- cout << " Self-Refresh Power-Up Energy: " << memArchSpec.nbrOfRanks * energy.spup_energy <<
- " pJ" << endl;
- cout << "Total Idle Energy (Active + Precharged): " << memArchSpec.nbrOfRanks *
- (energy.idle_energy_act + energy.idle_energy_pre) << " pJ" << endl;
- cout << "Total Power-Down Energy: " << memArchSpec.nbrOfRanks * (energy.f_act_pd_energy +
- energy.f_pre_pd_energy + energy.s_act_pd_energy + energy.s_pre_pd_energy) << " pJ" << endl;
- cout << " Fast-Exit Active Power-Down Energy: " << memArchSpec.nbrOfRanks *
- energy.f_act_pd_energy << " pJ" << endl;
- cout << " Slow-Exit Active Power-Down Energy: " << memArchSpec.nbrOfRanks *
- energy.s_act_pd_energy << " pJ" << endl;
- cout << " Slow-Exit Active Power-Down Energy during Auto-Refresh cycles "
- << "in Self-Refresh: " << memArchSpec.nbrOfRanks * energy.sref_ref_act_energy <<
- " pJ" << endl;
- cout << " Fast-Exit Precharged Power-Down Energy: " << memArchSpec.nbrOfRanks *
- energy.f_pre_pd_energy << " pJ" << endl;
- cout << " Slow-Exit Precharged Power-Down Energy: " << memArchSpec.nbrOfRanks *
- energy.s_pre_pd_energy << " pJ" << endl;
- cout << " Slow-Exit Precharged Power-Down Energy during Auto-Refresh " <<
- "cycles in Self-Refresh: " << memArchSpec.nbrOfRanks * energy.sref_ref_pre_energy <<
- " pJ" << endl;
- cout << "Auto-Refresh Energy: " << energy.ref_energy << " pJ" << endl;
- cout << "Self-Refresh Energy: " << memArchSpec.nbrOfRanks * energy.sref_energy <<
- " pJ" << endl;
- cout << "----------------------------------------" << endl;
- cout << "Total Trace Energy: " << energy.total_energy << " pJ" << endl;
- cout << "Average Power: " << power.average_power << " mW" << endl;
- cout << "----------------------------------------" << endl;
+
+ double nRanksDouble = static_cast<double>(nRanks);
+
+ cout << "ACT Stdby Energy: " << nRanksDouble * energy.act_stdby_energy << eUnit
+ << endl << " Active Idle Energy: " << nRanksDouble * energy.idle_energy_act << eUnit
+ << endl << " Active Power-Up Energy: " << nRanksDouble * energy.pup_act_energy << eUnit
+ << endl << " Active Stdby Energy during Auto-Refresh cycles in Self-Refresh Power-Up: " << nRanksDouble * energy.spup_ref_act_energy << eUnit
+ << endl << "PRE Stdby Energy: " << nRanksDouble * energy.pre_stdby_energy << eUnit
+ << endl << " Precharge Idle Energy: " << nRanksDouble * energy.idle_energy_pre << eUnit
+ << endl << " Precharged Power-Up Energy: " << nRanksDouble * energy.pup_pre_energy << eUnit
+ << endl << " Precharge Stdby Energy during Auto-Refresh cycles in Self-Refresh Power-Up: " << nRanksDouble * energy.spup_ref_pre_energy << eUnit
+ << endl << " Self-Refresh Power-Up Energy: " << nRanksDouble * energy.spup_energy << eUnit
+ << endl << "Total Idle Energy (Active + Precharged): " << nRanksDouble * (energy.idle_energy_act + energy.idle_energy_pre) << eUnit
+ << endl << "Total Power-Down Energy: " << nRanksDouble * (energy.f_act_pd_energy + energy.f_pre_pd_energy + energy.s_act_pd_energy + energy.s_pre_pd_energy) << eUnit
+ << endl << " Fast-Exit Active Power-Down Energy: " << nRanksDouble * energy.f_act_pd_energy << eUnit
+ << endl << " Slow-Exit Active Power-Down Energy: " << nRanksDouble * energy.s_act_pd_energy << eUnit
+ << endl << " Slow-Exit Active Power-Down Energy during Auto-Refresh cycles in Self-Refresh: " << nRanksDouble * energy.sref_ref_act_energy << eUnit
+ << endl << " Fast-Exit Precharged Power-Down Energy: " << nRanksDouble * energy.f_pre_pd_energy << eUnit
+ << endl << " Slow-Exit Precharged Power-Down Energy: " << nRanksDouble * energy.s_pre_pd_energy << eUnit
+ << endl << " Slow-Exit Precharged Power-Down Energy during Auto-Refresh cycles in Self-Refresh: " << nRanksDouble * energy.sref_ref_pre_energy << eUnit
+ << endl << "Auto-Refresh Energy: " << energy.ref_energy << eUnit
+ << endl << "Self-Refresh Energy: " << nRanksDouble * energy.sref_energy << eUnit
+ << endl << "----------------------------------------"
+ << endl << "Total Trace Energy: " << energy.total_energy << eUnit
+ << endl << "Average Power: " << power.average_power << " mW"
+ << endl << "----------------------------------------" << endl;
+
+ cout.flags(flags);
+ cout.precision(precision);
} // MemoryPowerModel::power_print
// Self-refresh active energy estimation (not including background energy)
@@ -395,11 +366,11 @@ double MemoryPowerModel::engy_sref(double idd6, double idd3n, double idd5,
// IO and Termination power calculation based on Micron Power Calculators
// Absolute power measures are obtained from Micron Power Calculator (mentioned in mW)
-void MemoryPowerModel::io_term_power(MemorySpecification memSpec)
+void MemoryPowerModel::io_term_power(const MemorySpecification& memSpec)
{
- MemTimingSpec& memTimingSpec = memSpec.memTimingSpec;
- MemArchitectureSpec& memArchSpec = memSpec.memArchSpec;
- MemPowerSpec& memPowerSpec = memSpec.memPowerSpec;
+ const MemTimingSpec& memTimingSpec = memSpec.memTimingSpec;
+ const MemArchitectureSpec& memArchSpec = memSpec.memArchSpec;
+ const MemPowerSpec& memPowerSpec = memSpec.memPowerSpec;
power.IO_power = memPowerSpec.ioPower; // in mW
power.WR_ODT_power = memPowerSpec.wrOdtPower; // in mW