From ab2af8c95358fde12d2b90db165b1bd5bb8b0525 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89der=20F=2E=20Zulian?= Date: Tue, 10 May 2016 18:18:00 +0200 Subject: [PATCH] User can choose bankwise power calculation --- DRAMSys/simulator/resources/simulations/sim-batch.xml | 2 ++ .../src/controller/core/configuration/Configuration.cpp | 4 ++++ .../src/controller/core/configuration/Configuration.h | 2 ++ DRAMSys/simulator/src/simulation/Dram.h | 8 +++++++- 4 files changed, 15 insertions(+), 1 deletion(-) diff --git a/DRAMSys/simulator/resources/simulations/sim-batch.xml b/DRAMSys/simulator/resources/simulations/sim-batch.xml index b356d01c..95662e93 100644 --- a/DRAMSys/simulator/resources/simulations/sim-batch.xml +++ b/DRAMSys/simulator/resources/simulations/sim-batch.xml @@ -6,6 +6,8 @@ + + diff --git a/DRAMSys/simulator/src/controller/core/configuration/Configuration.cpp b/DRAMSys/simulator/src/controller/core/configuration/Configuration.cpp index 4959d5a7..bb254862 100644 --- a/DRAMSys/simulator/src/controller/core/configuration/Configuration.cpp +++ b/DRAMSys/simulator/src/controller/core/configuration/Configuration.cpp @@ -140,6 +140,10 @@ void Configuration::setParameter(std::string name, std::string value) PowerWindowSize = std::stod(value.c_str()); else if (name == "PowerWindowUnit") PowerWindowUnit = string2TimeUnit(value); + else if(name == "BankwisePower") + BankwisePower = string2bool(value); + else if(name == "BankwisePowerFactor") + BankwisePowerFactor = string2int(value); else if(name == "Debug") Debug = string2bool(value); else if (name == "NumberOfTracePlayers") diff --git a/DRAMSys/simulator/src/controller/core/configuration/Configuration.h b/DRAMSys/simulator/src/controller/core/configuration/Configuration.h index e6abb2ae..85fa2dee 100644 --- a/DRAMSys/simulator/src/controller/core/configuration/Configuration.h +++ b/DRAMSys/simulator/src/controller/core/configuration/Configuration.h @@ -76,6 +76,8 @@ struct Configuration bool DatabaseRecording = true; bool PowerAnalysis = false; double PowerWindowSize; + bool BankwisePower = false; + unsigned int BankwisePowerFactor = 100; enum sc_time_unit PowerWindowUnit; bool Debug = false; unsigned int NumberOfTracePlayers = 1; diff --git a/DRAMSys/simulator/src/simulation/Dram.h b/DRAMSys/simulator/src/simulation/Dram.h index 6125e25f..a42094ff 100644 --- a/DRAMSys/simulator/src/simulation/Dram.h +++ b/DRAMSys/simulator/src/simulation/Dram.h @@ -73,6 +73,8 @@ struct Dram : sc_module sc_time powerWindowSize = sc_time(pWindowSize, pWindowUnit); libDRAMPower *DRAMPower; double sumOfEnergyWindows = 0.0; + bool bankwisePower = Configuration::getInstance().BankwisePower; + unsigned int bankwisePowerFactor = Configuration::getInstance().BankwisePowerFactor; // Bandwith realted: unsigned long long int numberOfTransactionsServed; @@ -173,7 +175,11 @@ struct Dram : sc_module memSpec.memPowerSpec = memPowerSpec; memSpec.memArchSpec = memArchSpec; - DRAMPower = new libDRAMPower( memSpec, 0 ); + if (bankwisePower) { + DRAMPower = new libDRAMPower( memSpec, 0, bankwisePower, bankwisePowerFactor ); + } else { + DRAMPower = new libDRAMPower( memSpec, 0 ); + } // Create a thread that is triggered every $powerWindowSize // to generate a Power over Time plot in the Trace analyzer: