diff --git a/dram/resources/simulations/sim-batch.xml b/dram/resources/simulations/sim-batch.xml
index 3e19862c..cd725640 100644
--- a/dram/resources/simulations/sim-batch.xml
+++ b/dram/resources/simulations/sim-batch.xml
@@ -11,7 +11,7 @@
- mediabench-fractal_32.stl
+ chstone-sha_32.stl
diff --git a/dram/src/controller/core/configuration/Configuration.cpp b/dram/src/controller/core/configuration/Configuration.cpp
index 286f3b49..c3ba3e73 100644
--- a/dram/src/controller/core/configuration/Configuration.cpp
+++ b/dram/src/controller/core/configuration/Configuration.cpp
@@ -7,6 +7,8 @@
#include "Configuration.h"
#include "MemSpecLoader.h"
+#include "systemc.h"
+#include "boost/lexical_cast.hpp"
using namespace std;
@@ -21,6 +23,79 @@ Configuration::Configuration()
loader.loadConfiguration(*this, Configuration::memspecUri, Configuration::memconfigUri);
}
+int string2bool(string s)
+{
+ try {
+ bool x = boost::lexical_cast( s );
+ return x;
+ } catch( boost::bad_lexical_cast const& ) {
+ SC_REPORT_FATAL("Configuration", ("Could not convert to bool: " + s).c_str());
+ throw;
+ }
+}
+
+int string2int(string s)
+{
+ try {
+ int x = boost::lexical_cast( s );
+ return x;
+ } catch( boost::bad_lexical_cast const& ) {
+ SC_REPORT_FATAL("Configuration", ("Could not convert to int: " + s).c_str());
+ throw;
+ }
+}
+
+PowerDownMode string2PDNMode(string s)
+{
+ if(s == "Staggered")
+ return PowerDownMode::Staggered;
+ else if (s == "TimeoutPDN")
+ return PowerDownMode::TimeoutPDN;
+ else if (s == "TimeoutSREF")
+ return PowerDownMode::TimeoutSREF;
+
+ else
+ {
+ SC_REPORT_FATAL("Configuration", ("Unknown PowerDownMode: " + s).c_str());
+ throw;
+ }
+}
+
+
+void Configuration::setParameter(std::string name, std::string value)
+{
+ if(name == "BankwiseLogic")
+ BankwiseLogic = string2bool(value);
+ else if(name == "OpenPagePolicy")
+ OpenPagePolicy = string2bool(value);
+ else if(name == "AdaptiveOpenPagePolicy")
+ AdaptiveOpenPagePolicy = string2bool(value);
+ else if(name == "RefreshAwareScheduling")
+ RefreshAwareScheduling = string2bool(value);
+ else if(name == "MaxNrOfTransactions")
+ MaxNrOfTransactions = string2int(value);
+ else if(name == "Scheduler")
+ Scheduler = value;
+ else if(name == "Capsize")
+ Capsize = string2int(value);
+ else if(name == "PowerDownTimeout")
+ powerDownTimeoutInClk = string2int(value);
+ else if(name == "PowerDownMode")
+ powerDownMode = string2PDNMode(value);
+ else if(name == "databaseRecordingEnabled")
+ databaseRecordingEnabled = string2bool(value);
+ else
+ throw "Parameter " + name + " not defined in Configuration";
+}
+
+void Configuration::setParameters(std::map parameterMap)
+{
+ for(auto item : parameterMap)
+ {
+ setParameter(item.first, item.second);
+ }
+}
+
} /* namespace core */
diff --git a/dram/src/controller/core/configuration/Configuration.h b/dram/src/controller/core/configuration/Configuration.h
index feefaf3b..86214d36 100644
--- a/dram/src/controller/core/configuration/Configuration.h
+++ b/dram/src/controller/core/configuration/Configuration.h
@@ -37,17 +37,21 @@ struct Configuration
unsigned int MaxNrOfTransactions = 50;
std::string Scheduler;
unsigned int Capsize = 5;
- sc_time powerDownTimeout = 3*memSpec.clk;
- PowerDownMode powerDownMode;
-
- //Memory Specification (from DRAM Power XML)
- MemSpec memSpec;
+ sc_time getPowerDownTimeout(){return powerDownTimeoutInClk*memSpec.clk;}
+ PowerDownMode powerDownMode = PowerDownMode::Staggered;
//Simulation Configuration
bool databaseRecordingEnabled = true;
+ //Memory Specification (from DRAM Power XML)
+ MemSpec memSpec;
+
+ void setParameter(std::string name, std::string value);
+ void setParameters(std::map parameterMap);
+
private:
Configuration();
+ unsigned int powerDownTimeoutInClk = 3;
};
} /* namespace core */
diff --git a/dram/src/controller/core/configuration/MemSpecLoader.cpp b/dram/src/controller/core/configuration/MemSpecLoader.cpp
index de3fd88a..cb2b9eb9 100644
--- a/dram/src/controller/core/configuration/MemSpecLoader.cpp
+++ b/dram/src/controller/core/configuration/MemSpecLoader.cpp
@@ -53,7 +53,7 @@ void MemSpecLoader::loadMemConfig(Configuration& config, XMLElement* memconfig)
{
config.powerDownMode = PowerDownMode::TimeoutSREF;
}
- config.powerDownTimeout = queryUIntParameter(configuration, "powerDownTimeout") * config.memSpec.clk;
+ config.setParameter("PowerDownTimeout", queryStringParameter(configuration, "powerDownTimeout"));
config.databaseRecordingEnabled = queryBoolParameter(configuration, "databaseRecordingEnabled");
}
diff --git a/dram/src/controller/core/powerdown/PowerDownManagerTimeout.cpp b/dram/src/controller/core/powerdown/PowerDownManagerTimeout.cpp
index 2910ebd3..b4a3268a 100644
--- a/dram/src/controller/core/powerdown/PowerDownManagerTimeout.cpp
+++ b/dram/src/controller/core/powerdown/PowerDownManagerTimeout.cpp
@@ -29,7 +29,7 @@ PowerDownManagerTimeout::~PowerDownManagerTimeout()
void PowerDownManagerTimeout::sleep(Bank bank, sc_time time)
{
- if(canSleep() && !isInPowerDown() && (time - controller.state.getLastScheduledCommand().getEnd()) >= Configuration::getInstance().powerDownTimeout)
+ if(canSleep() && !isInPowerDown() && (time - controller.state.getLastScheduledCommand().getEnd()) >= Configuration::getInstance().getPowerDownTimeout())
{
PowerDownState newState;
if(Configuration::getInstance().powerDownMode == PowerDownMode::TimeoutPDN)
@@ -106,7 +106,7 @@ void PowerDownManagerTimeout::triggerSleep(Bank /*bank*/, sc_time time)
{
if(canSleep() && !isInPowerDown())
{
- controller.wrapper.send(PDNTrigger, time + controller.config.powerDownTimeout, powerDownPayloads[Bank(0)]);
+ controller.wrapper.send(PDNTrigger, time + controller.config.getPowerDownTimeout(), powerDownPayloads[Bank(0)]);
}
}
diff --git a/dram/src/simulation/main.cpp b/dram/src/simulation/main.cpp
index 00797a88..c064bc67 100644
--- a/dram/src/simulation/main.cpp
+++ b/dram/src/simulation/main.cpp
@@ -32,7 +32,6 @@ int main(int argc, char **argv)
int sc_main(int argc, char **argv)
{
- cout<<"hello"<