Merge branch 'master' of https://git.rhrk.uni-kl.de/ehses/dram.vp.system
Conflicts: dram/dramSys/dramSys.pro dram/resources/configs/amconfigs/am_wideio.xml dram/resources/configs/memconfigs/fr_fcfs.xml dram/src/common/xmlAddressdecoder.cpp dram/src/controller/core/configuration/ConfigurationLoader.cpp dram/src/simulation/Simulation.cpp dram/src/simulation/Simulation.h dram/src/simulation/TracePlayer.h
This commit is contained in:
@@ -6,7 +6,8 @@
|
||||
*/
|
||||
|
||||
#include "Configuration.h"
|
||||
#include "MemSpecLoader.h"
|
||||
#include "ConfigurationLoader.h"
|
||||
#include "boost/lexical_cast.hpp"
|
||||
|
||||
using namespace std;
|
||||
|
||||
@@ -17,10 +18,108 @@ string Configuration::memconfigUri = "";
|
||||
|
||||
Configuration::Configuration()
|
||||
{
|
||||
MemSpecLoader loader;
|
||||
loader.loadConfiguration(*this, Configuration::memspecUri, Configuration::memconfigUri);
|
||||
}
|
||||
|
||||
int string2bool(string s)
|
||||
{
|
||||
try {
|
||||
bool x = boost::lexical_cast<bool>( 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<int>( s );
|
||||
return x;
|
||||
} catch( boost::bad_lexical_cast const& ) {
|
||||
SC_REPORT_FATAL("Configuration", ("Could not convert to int: " + s).c_str());
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
EPowerDownMode string2PDNMode(string s)
|
||||
{
|
||||
if(s == "NoPowerDown")
|
||||
return EPowerDownMode::NoPowerDown;
|
||||
else if(s == "Staggered")
|
||||
return EPowerDownMode::Staggered;
|
||||
else if (s == "TimeoutPDN")
|
||||
return EPowerDownMode::TimeoutPDN;
|
||||
else if (s == "TimeoutSREF")
|
||||
return EPowerDownMode::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 == "Buswidth")
|
||||
Buswidth = string2int(value);
|
||||
else if(name == "ReadWriteGrouping")
|
||||
ReadWriteGrouping = string2bool(value);
|
||||
//removed because of Peters error model TODO clean up!
|
||||
//else if(name == "ModelStorage")
|
||||
// ModelStorage = string2bool(value);
|
||||
//else if(name == "ModelErrorInjection")
|
||||
// ModelErrorInjection = string2bool(value);
|
||||
else if(name == "ReorderBuffer")
|
||||
ReorderBuffer = string2bool(value);
|
||||
|
||||
//SimConfig------------------------------------------------
|
||||
else if(name == "DatabaseRecording")
|
||||
DatabaseRecording = string2bool(value);
|
||||
else if(name == "PowerAnalysys")
|
||||
PowerAnalysys = string2bool(value);
|
||||
else if(name == "Debug")
|
||||
Debug = string2bool(value);
|
||||
//Specification for Chipseed, csvfile path and StorageMode
|
||||
else if(name == "Chipseed")
|
||||
Chipseed = string2int(value);
|
||||
else if(name == "csvfile")
|
||||
csvfile = value;
|
||||
else if(name == "StorMo")
|
||||
StorMode = string2int(value);
|
||||
else
|
||||
{
|
||||
SC_REPORT_FATAL("Configuration", ("Parameter " + name + " not defined in Configuration").c_str());
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
void Configuration::setParameters(std::map<std::string, std::string> parameterMap)
|
||||
{
|
||||
for(auto item : parameterMap)
|
||||
{
|
||||
setParameter(item.first, item.second);
|
||||
}
|
||||
}
|
||||
|
||||
} /* namespace core */
|
||||
|
||||
|
||||
Reference in New Issue
Block a user