Get parameters related to temperature simulation from configuration
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
<simulation>
|
||||
<!-- General Simulator Configuration (used for all simulation setups) -->
|
||||
<simconfig>
|
||||
<Debug value="1" />
|
||||
<DatabaseRecording value="1" />
|
||||
@@ -9,6 +10,16 @@
|
||||
<DynamicTemperatureSimulation value="0"/>
|
||||
</simconfig>
|
||||
|
||||
<!-- Temperature Simulator Configuration (used for all simulation setups) -->
|
||||
<temperature_simconfig>
|
||||
<StaticTemperatureDefaultValue value="89" />
|
||||
<DynTemperatureSimPeriod value="100" />
|
||||
<DynTemperatureSimUnit value="ms" />
|
||||
<!--
|
||||
<PowerThresholdsFile src="../../DRAMSys/simulator/resources/configs/temperature_sim/power_thresholds.xml"/>
|
||||
-->
|
||||
</temperature_simconfig>
|
||||
|
||||
<memspecs>
|
||||
<memspec src="../../DRAMSys/simulator/resources/configs/memspecs/WideIO.xml"></memspec>
|
||||
</memspecs>
|
||||
@@ -27,12 +38,5 @@
|
||||
</tracesetup>
|
||||
</tracesetups>
|
||||
|
||||
<!--
|
||||
<temperature>
|
||||
<StaticTempDefaultValue value="89" />
|
||||
<DynamicTemperatureSimulation value="0" />
|
||||
</temperature>
|
||||
-->
|
||||
|
||||
</simulation>
|
||||
|
||||
|
||||
@@ -87,6 +87,26 @@ EPowerDownMode string2PDNMode(string s)
|
||||
}
|
||||
}
|
||||
|
||||
enum sc_time_unit string2TimeUnit(string s)
|
||||
{
|
||||
if (s == "s")
|
||||
return SC_SEC;
|
||||
else if (s == "ms")
|
||||
return SC_MS;
|
||||
else if (s == "us")
|
||||
return SC_US;
|
||||
else if (s == "ns")
|
||||
return SC_NS;
|
||||
else if (s == "ps")
|
||||
return SC_PS;
|
||||
else if (s == "fs")
|
||||
return SC_FS;
|
||||
else {
|
||||
SC_REPORT_FATAL("Configuration", ("Could not convert to enum sc_time_unit: " + s).c_str());
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
void Configuration::setParameter(std::string name, std::string value)
|
||||
{
|
||||
if(name == "BankwiseLogic")
|
||||
@@ -132,6 +152,13 @@ void Configuration::setParameter(std::string name, std::string value)
|
||||
ErrorCSVFile = value;
|
||||
else if(name == "ErrorStoreMode")
|
||||
ErrorStoreMode = StringToEnum(value);
|
||||
// Temperature Simulation related
|
||||
else if (name == "StaticTemperatureDefaultValue")
|
||||
StaticTemperatureDefaultValue = string2int(value);
|
||||
else if (name == "DynTemperatureSimPeriod")
|
||||
DynTemperatureSimPeriod = string2int(value);
|
||||
else if (name == "DynTemperatureSimUnit")
|
||||
DynTemperatureSimUnit = string2TimeUnit(value);
|
||||
else
|
||||
{
|
||||
SC_REPORT_FATAL("Configuration", ("Parameter " + name + " not defined in Configuration").c_str());
|
||||
|
||||
@@ -91,6 +91,11 @@ struct Configuration
|
||||
std::string ErrorCSVFile ="not defined.";
|
||||
ErrorStorageMode ErrorStoreMode;
|
||||
|
||||
// Temperature Simulation related
|
||||
int StaticTemperatureDefaultValue;
|
||||
unsigned int DynTemperatureSimPeriod;
|
||||
enum sc_time_unit DynTemperatureSimUnit;
|
||||
|
||||
private:
|
||||
Configuration();
|
||||
unsigned int powerDownTimeoutInClk = 3;
|
||||
|
||||
@@ -62,6 +62,22 @@ void ConfigurationLoader::loadSimConfig(Configuration& config, XMLElement* simco
|
||||
loadConfig(config, simconfig);
|
||||
}
|
||||
|
||||
void ConfigurationLoader::loadTemperatureSimConfig(Configuration &config, std::string temperature_simconfigUri)
|
||||
{
|
||||
loadConfigFromUri(config, temperature_simconfigUri, "temperature_simconfig");
|
||||
}
|
||||
|
||||
void ConfigurationLoader::loadTemperatureSimConfig(Configuration &config, XMLElement *temperature_simconfig)
|
||||
{
|
||||
if (temperature_simconfig->Attribute("src")) {
|
||||
// Configuration is inside another a file
|
||||
std::string uri(temperature_simconfig->Attribute("src"));
|
||||
loadConfigFromUri(config, uri, "temperature_simconfig");
|
||||
} else {
|
||||
loadConfig(config, temperature_simconfig);
|
||||
}
|
||||
}
|
||||
|
||||
void ConfigurationLoader::loadConfig(Configuration& config, XMLElement* configNode)
|
||||
{
|
||||
XMLElement* element;
|
||||
@@ -73,6 +89,14 @@ void ConfigurationLoader::loadConfig(Configuration& config, XMLElement* configNo
|
||||
}
|
||||
}
|
||||
|
||||
void ConfigurationLoader::loadConfigFromUri(Configuration &config, std::string uri, std::string first_element)
|
||||
{
|
||||
tinyxml2::XMLDocument doc;
|
||||
loadXML(uri, doc);
|
||||
XMLElement *e = doc.FirstChildElement(first_element.c_str());
|
||||
loadConfig(config, e);
|
||||
}
|
||||
|
||||
void ConfigurationLoader::loadMemSpec(Configuration& config, string memspecUri)
|
||||
{
|
||||
tinyxml2::XMLDocument doc;
|
||||
|
||||
@@ -46,16 +46,20 @@ class ConfigurationLoader
|
||||
{
|
||||
public:
|
||||
static void loadMemConfig(Configuration& config, std::string memconfigUri);
|
||||
static void loadSimConfig(Configuration& config, std::string simconfigUri);
|
||||
static void loadMemConfig(Configuration& config, tinyxml2::XMLElement* memconfig);
|
||||
|
||||
static void loadSimConfig(Configuration& config, std::string simconfigUri);
|
||||
static void loadSimConfig(Configuration& config,tinyxml2::XMLElement* simconfig);
|
||||
|
||||
static void loadMemSpec(Configuration& config, std::string memspecUri);
|
||||
static void loadMemSpec(Configuration& config, tinyxml2::XMLElement* memspec);
|
||||
|
||||
static void loadTemperatureSimConfig(Configuration &config, std::string simconfigUri);
|
||||
static void loadTemperatureSimConfig(Configuration& config, tinyxml2::XMLElement *simconfig);
|
||||
private:
|
||||
ConfigurationLoader(){}
|
||||
static void loadConfig(Configuration& config, tinyxml2::XMLElement* configNode);
|
||||
static void loadConfigFromUri(Configuration &config, std::string uri, std::string first_element);
|
||||
|
||||
//specific loader
|
||||
static void loadDDR3(Configuration& config, tinyxml2::XMLElement* memspec);
|
||||
|
||||
@@ -103,9 +103,15 @@ errorModel::errorModel()
|
||||
//weakCells[0].row = 0;
|
||||
//weakCells[0].dependent = true;
|
||||
|
||||
std::stringstream msg;
|
||||
if (dynamicTemepratureSimulation == false) {
|
||||
setTemperature(89);
|
||||
int temperature = Configuration::getInstance().StaticTemperatureDefaultValue;
|
||||
setTemperature(temperature);
|
||||
msg << "Static temperature simulation. Temperature set to " << temperature << std::endl;
|
||||
} else {
|
||||
msg << "Dynamic temperature simulation." << std::endl;
|
||||
}
|
||||
DebugManager::getInstance().printDebugMessage(name, msg.str());
|
||||
|
||||
markBitFlips();
|
||||
}
|
||||
|
||||
@@ -62,6 +62,7 @@ Simulation::Simulation(sc_module_name __attribute__((unused)) name, string pathT
|
||||
ConfigurationLoader::loadMemConfig(Configuration::getInstance(), setup.memconfig);//pathToResources + string("configs/memconfigs/") + setup.memconfig);
|
||||
ConfigurationLoader::loadMemSpec(Configuration::getInstance(), setup.memspec);//pathToResources + string("configs/memspecs/") + setup.memspec);
|
||||
ConfigurationLoader::loadSimConfig(Configuration::getInstance(), setup.simconfig);
|
||||
ConfigurationLoader::loadTemperatureSimConfig(Configuration::getInstance(), setup.temperature_simconfig);
|
||||
|
||||
instantiateModules(traceName, pathToResources, devices);
|
||||
bindSockets();
|
||||
|
||||
@@ -53,13 +53,14 @@
|
||||
|
||||
struct DramSetup
|
||||
{
|
||||
DramSetup():memspec(NULL),memconfig(NULL),simconfig(NULL),addressmapping(NULL){}
|
||||
DramSetup(tinyxml2::XMLElement* memspec, tinyxml2::XMLElement* memconfig, tinyxml2::XMLElement* simconfig, tinyxml2::XMLElement* addressmapping)
|
||||
: memspec(memspec), memconfig(memconfig), simconfig(simconfig), addressmapping(addressmapping) {}
|
||||
DramSetup():memspec(NULL),memconfig(NULL),simconfig(NULL),addressmapping(NULL), temperature_simconfig(NULL) {}
|
||||
DramSetup(tinyxml2::XMLElement* memspec, tinyxml2::XMLElement* memconfig, tinyxml2::XMLElement* simconfig, tinyxml2::XMLElement* addressmapping, tinyxml2::XMLElement *tsc)
|
||||
: memspec(memspec), memconfig(memconfig), simconfig(simconfig), addressmapping(addressmapping), temperature_simconfig(tsc) {}
|
||||
tinyxml2::XMLElement* memspec;
|
||||
tinyxml2::XMLElement* memconfig;
|
||||
tinyxml2::XMLElement* simconfig;
|
||||
tinyxml2::XMLElement* addressmapping;
|
||||
tinyxml2::XMLElement* temperature_simconfig;
|
||||
};
|
||||
|
||||
struct Device
|
||||
|
||||
@@ -100,6 +100,8 @@ void SimulationManager::parseSimulationBatch(XMLElement* simulation)
|
||||
|
||||
XMLElement* simconfig = simulation->FirstChildElement("simconfig");
|
||||
|
||||
XMLElement *temperature_simconfig = simulation->FirstChildElement("temperature_simconfig");
|
||||
|
||||
XMLElement* memspecs = simulation->FirstChildElement("memspecs");
|
||||
if(memspecs == NULL) memspecs = simulation;
|
||||
|
||||
@@ -120,7 +122,7 @@ void SimulationManager::parseSimulationBatch(XMLElement* simulation)
|
||||
for (XMLElement* memconfig = memconfigs->FirstChildElement("memconfig");
|
||||
memconfig != NULL; memconfig = memconfig->NextSiblingElement("memconfig"))
|
||||
{
|
||||
batch.dramSetups.push_back(DramSetup(memspec, memconfig, simconfig, addressmapping));
|
||||
batch.dramSetups.push_back(DramSetup(memspec, memconfig, simconfig, addressmapping, temperature_simconfig));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
28
README.md
28
README.md
@@ -124,7 +124,7 @@ The XML code below shows a typic configuration:
|
||||
``` xml
|
||||
<simulation>
|
||||
|
||||
<!-- Simulator Configuration -->
|
||||
<!-- General Simulator Configuration (used for all simulation setups) -->
|
||||
<simconfig>
|
||||
<Debug value="1"/>
|
||||
<DatabaseRecording value="1"/>
|
||||
@@ -135,6 +135,13 @@ The XML code below shows a typic configuration:
|
||||
<DynamicTemperatureSimulation value="0"/>
|
||||
</simconfig>
|
||||
|
||||
<!-- Temperature Simulator Configuration (used for all simulation setups) -->
|
||||
<temperature_simconfig>
|
||||
<StaticTemperatureDefaultValue value="89" />
|
||||
<DynTemperatureSimPeriod value="100" />
|
||||
<DynTemperatureSimUnit value="ms" />
|
||||
</temperature_simconfig>
|
||||
|
||||
<!-- Memory Specifications -->
|
||||
<memspecs>
|
||||
<memspec src="../../DRAMSys/simulator/resources/configs/memspecs/WideIO.xml"></memspec>
|
||||
@@ -215,7 +222,7 @@ simulation.
|
||||
|
||||
Below are listed the configuration sections and configuration fields.
|
||||
|
||||
- **Simulator configuration**
|
||||
- **Simulator Configuration**
|
||||
- *Debug* (boolean)
|
||||
- "1": enables debug output on console
|
||||
- "0": disables debug output
|
||||
@@ -236,7 +243,20 @@ Below are listed the configuration sections and configuration fields.
|
||||
- "1": enables the dynamic temperature simulation feature
|
||||
- "0": static temperature during simulation
|
||||
|
||||
- **Memory specification**
|
||||
- **Temperature Simulator Configuration**
|
||||
- *StaticTemperatureDefaultValue* (int)
|
||||
- Temperature value for simulations with static temperature
|
||||
- *DynTemperatureSimPeriod* (unsigned int)
|
||||
- Period of the dynamic temperature simulation
|
||||
- *DynTemperatureSimUnit* (string)
|
||||
- "s": seconds
|
||||
- "ms": millisecond
|
||||
- "us": microseconds
|
||||
- "ns": nanoseconds
|
||||
- "ps": picoseconds
|
||||
- "fs": femtoseconds
|
||||
|
||||
- **Memory Specification**
|
||||
|
||||
A file with memory specifications. This information comes from datasheet and
|
||||
usually does not change.
|
||||
@@ -329,7 +349,7 @@ Below are listed the configuration sections and configuration fields.
|
||||
- "Store": store data without error model
|
||||
- "ErrorModel": store data with error model [6]
|
||||
|
||||
- **Trace setups**
|
||||
- **Trace Setups**
|
||||
- *id* (string)
|
||||
- Trace setup id. Two kinds of output files are generated by DRAMSys:
|
||||
SQLite databases containing transactions related to each memory channel
|
||||
|
||||
Reference in New Issue
Block a user