From 1b9c2802ec2e1f14c009d378ed5ec48349ccd4d6 Mon Sep 17 00:00:00 2001 From: scorrea Date: Mon, 18 May 2020 12:45:25 +0200 Subject: [PATCH] simconfig and thermalconfig to json --- .../resources/configs/thermalsim/config.json | 15 ++++++++++++ .../resources/simulations/ddr3-example.json | 14 +++++++++++ .../resources/simulations/ddr3-example.xml | 6 ++--- .../src/configuration/ConfigurationLoader.cpp | 23 ++++++------------- .../src/configuration/ConfigurationLoader.h | 2 -- 5 files changed, 39 insertions(+), 21 deletions(-) create mode 100644 DRAMSys/library/resources/configs/thermalsim/config.json create mode 100644 DRAMSys/library/resources/simulations/ddr3-example.json diff --git a/DRAMSys/library/resources/configs/thermalsim/config.json b/DRAMSys/library/resources/configs/thermalsim/config.json new file mode 100644 index 00000000..023184a6 --- /dev/null +++ b/DRAMSys/library/resources/configs/thermalsim/config.json @@ -0,0 +1,15 @@ +{ + "thermalsimconfig": { + "TemperatureScale": "Celsius", + "StaticTemperatureDefaultValue": "89", + "ThermalSimPeriod":"100", + "ThermalSimUnit":"us", + "PowerInfoFile": "powerInfo.xml", + "IceServerIp": "127.0.0.1", + "IceServerPort": "11880", + "SimPeriodAdjustFactor" : "10", + "NPowStableCyclesToIncreasePeriod": "5", + "GenerateTemperatureMap": "1", + "GeneratePowerMap": "1" + } +} diff --git a/DRAMSys/library/resources/simulations/ddr3-example.json b/DRAMSys/library/resources/simulations/ddr3-example.json new file mode 100644 index 00000000..74450f11 --- /dev/null +++ b/DRAMSys/library/resources/simulations/ddr3-example.json @@ -0,0 +1,14 @@ +{ + "simulation": { + "simulationid": "ddr3-example-all-json", + "simconfig": "ddr3.json", + "thermalconfig": "config.json", + "memspec": "MICRON_1Gb_DDR3-1600_8bit_G.json", + "addressmapping": "congen_extended_solution.json", + "mcconfig":"fifoStrict.json", + "tracesetup": [{ + "_clkMhz": "800", + "__text": "ddr3_example.stl"} + ] + } +} diff --git a/DRAMSys/library/resources/simulations/ddr3-example.xml b/DRAMSys/library/resources/simulations/ddr3-example.xml index ffa43e11..3fa04ea2 100644 --- a/DRAMSys/library/resources/simulations/ddr3-example.xml +++ b/DRAMSys/library/resources/simulations/ddr3-example.xml @@ -1,10 +1,10 @@ - + - + - + diff --git a/DRAMSys/library/src/configuration/ConfigurationLoader.cpp b/DRAMSys/library/src/configuration/ConfigurationLoader.cpp index 61c49452..c68e6c02 100644 --- a/DRAMSys/library/src/configuration/ConfigurationLoader.cpp +++ b/DRAMSys/library/src/configuration/ConfigurationLoader.cpp @@ -54,29 +54,20 @@ using json = nlohmann::json; void ConfigurationLoader::loadSimConfig(Configuration &config, std::string simconfigUri) { - tinyxml2::XMLDocument doc; - loadXML(simconfigUri, doc); - XMLElement *simconfig = doc.FirstChildElement("simconfig"); - loadConfig(config, simconfig); + json doc = json::parse(std::ifstream(simconfigUri)); + auto simconfig = doc["simconfig"].get_ptr(); + loadConfigJson(config, simconfig); } -void ConfigurationLoader::loadSimConfig(Configuration &config, - XMLElement *simconfig) -{ - if (simconfig->Attribute("src")) { - XMLDocument doc; - std::string src(simconfig->Attribute("src")); - loadXML(src, doc); - loadSimConfig(config, doc.FirstChildElement("simconfig")); - } - loadConfig(config, simconfig); -} void ConfigurationLoader::loadTemperatureSimConfig(Configuration &config, std::string thermalsimconfigUri) { - loadConfigFromUri(config, thermalsimconfigUri, "thermalsimconfig"); + json doc = json::parse(std::ifstream(thermalsimconfigUri)); + auto thermalconfig = doc["thermalsimconfig"].get_ptr(); + loadConfigJson(config, thermalconfig); + } void ConfigurationLoader::loadTemperatureSimConfig(Configuration &config, diff --git a/DRAMSys/library/src/configuration/ConfigurationLoader.h b/DRAMSys/library/src/configuration/ConfigurationLoader.h index 63d35d86..cebe8384 100644 --- a/DRAMSys/library/src/configuration/ConfigurationLoader.h +++ b/DRAMSys/library/src/configuration/ConfigurationLoader.h @@ -53,8 +53,6 @@ public: 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, nlohmann::json::object_t *memspec);