Configuration refactoring
This commit is contained in:
@@ -6,8 +6,7 @@
|
||||
*/
|
||||
|
||||
#include "Configuration.h"
|
||||
#include "MemSpecLoader.h"
|
||||
#include "systemc.h"
|
||||
#include "ConfigurationLoader.h"
|
||||
#include "boost/lexical_cast.hpp"
|
||||
|
||||
using namespace std;
|
||||
@@ -15,12 +14,9 @@ using namespace std;
|
||||
namespace core{
|
||||
|
||||
string Configuration::memspecUri = "";
|
||||
string Configuration::memconfigUri = "";
|
||||
|
||||
Configuration::Configuration()
|
||||
{
|
||||
MemSpecLoader loader;
|
||||
loader.loadConfiguration(*this, Configuration::memspecUri, Configuration::memconfigUri);
|
||||
}
|
||||
|
||||
int string2bool(string s)
|
||||
@@ -47,13 +43,14 @@ int string2int(string s)
|
||||
|
||||
PowerDownMode string2PDNMode(string s)
|
||||
{
|
||||
if(s == "Staggered")
|
||||
if(s == "NoPowerDown")
|
||||
return PowerDownMode::NoPowerDown;
|
||||
else 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());
|
||||
@@ -82,10 +79,13 @@ void Configuration::setParameter(std::string name, std::string value)
|
||||
powerDownTimeoutInClk = string2int(value);
|
||||
else if(name == "PowerDownMode")
|
||||
powerDownMode = string2PDNMode(value);
|
||||
else if(name == "databaseRecordingEnabled")
|
||||
else if(name == "DatabaseRecordingEnabled")
|
||||
databaseRecordingEnabled = string2bool(value);
|
||||
else
|
||||
throw "Parameter " + name + " not defined in Configuration";
|
||||
{
|
||||
SC_REPORT_FATAL("Configuration", ("Parameter " + name + " not defined in Configuration").c_str());
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
void Configuration::setParameters(std::map<std::string, std::string> parameterMap)
|
||||
@@ -96,6 +96,5 @@ void Configuration::setParameters(std::map<std::string, std::string> parameterMa
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
} /* namespace core */
|
||||
|
||||
|
||||
Reference in New Issue
Block a user