diff --git a/benches/simulation.cpp b/benches/simulation.cpp index fd8e025b..cb8ec352 100644 --- a/benches/simulation.cpp +++ b/benches/simulation.cpp @@ -52,13 +52,12 @@ static void example_simulation(benchmark::State& state, Args&&... args) { sc_core::sc_get_curr_simcontext()->reset(); - std::filesystem::path configFile(std::get<0>(args_tuple)); - std::filesystem::path resourceDirectory("configs"); + std::filesystem::path configFile = std::get<0>(args_tuple); DRAMSys::Config::Configuration configuration = DRAMSys::Config::from_path(configFile.c_str()); - Simulator simulator(std::move(configuration), std::move(resourceDirectory)); + Simulator simulator(std::move(configuration), configFile); simulator.run(); } diff --git a/configs/addressmapping/am_ranktest.json b/configs/addressmapping/am_ranktest.json deleted file mode 100644 index accf2165..00000000 --- a/configs/addressmapping/am_ranktest.json +++ /dev/null @@ -1,46 +0,0 @@ -{ - "addressmapping": { - "RANK_BIT":[ - 30, - 31 - ], - "BANK_BIT": [ - 27, - 28, - 29 - ], - "BYTE_BIT": [ - 0, - 1, - 2 - ], - "COLUMN_BIT": [ - 3, - 4, - 5, - 6, - 7, - 8, - 9, - 10, - 11, - 12 - ], - "ROW_BIT": [ - 13, - 14, - 15, - 16, - 17, - 18, - 19, - 20, - 21, - 22, - 23, - 24, - 25, - 26 - ] - } -} \ No newline at end of file diff --git a/configs/ddr3-example.json b/configs/ddr3-example.json index 4a947a58..982ecf79 100644 --- a/configs/ddr3-example.json +++ b/configs/ddr3-example.json @@ -1,14 +1,14 @@ { "simulation": { - "addressmapping": "am_ddr3_8x1Gbx8_dimm_p1KB_rbc.json", - "mcconfig": "fr_fcfs.json", - "memspec": "MICRON_1Gb_DDR3-1600_8bit_G.json", - "simconfig": "example.json", + "addressmapping": "addressmapping/am_ddr3_8x1Gbx8_dimm_p1KB_rbc.json", + "mcconfig": "mcconfig/fr_fcfs.json", + "memspec": "memspec/MICRON_1Gb_DDR3-1600_8bit_G.json", + "simconfig": "simconfig/example.json", "simulationid": "ddr3-example", "tracesetup": [ { "clkMhz": 800, - "name": "example.stl" + "name": "traces/example.stl" } ] } diff --git a/configs/ddr3-gem5-se.json b/configs/ddr3-gem5-se.json deleted file mode 100644 index a340dc39..00000000 --- a/configs/ddr3-gem5-se.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "simulation": { - "addressmapping": "am_ddr3_8x1Gbx8_dimm_p1KB_brc.json", - "mcconfig": "fifoStrict.json", - "memspec": "MICRON_1Gb_DDR3-1600_8bit_G.json", - "simconfig": "gem5_se.json", - "simulationid": "ddr3-gem5-se" - } -} diff --git a/configs/ddr4-example.json b/configs/ddr4-example.json index 645ca907..2f90e9ec 100644 --- a/configs/ddr4-example.json +++ b/configs/ddr4-example.json @@ -1,14 +1,14 @@ { "simulation": { - "addressmapping": "am_ddr4_8x4Gbx8_dimm_p1KB_brc.json", - "mcconfig": "fr_fcfs.json", - "memspec": "JEDEC_4Gb_DDR4-1866_8bit_A.json", - "simconfig": "example.json", + "addressmapping": "addressmapping/am_ddr4_8x4Gbx8_dimm_p1KB_brc.json", + "mcconfig": "mcconfig/fr_fcfs.json", + "memspec": "memspec/JEDEC_4Gb_DDR4-1866_8bit_A.json", + "simconfig": "simconfig/example.json", "simulationid": "ddr4-example", "tracesetup": [ { "clkMhz": 200, - "name": "example.stl" + "name": "traces/example.stl" } ] } diff --git a/configs/ddr4-full-example.json b/configs/ddr4-full-example.json index 626384a0..8b7bbb46 100644 --- a/configs/ddr4-full-example.json +++ b/configs/ddr4-full-example.json @@ -147,7 +147,7 @@ "tracesetup": [ { "clkMhz": 200, - "name": "example.stl" + "name": "traces/example.stl" } ] } diff --git a/configs/ddr5-example.json b/configs/ddr5-example.json index d66dae74..58dc1b78 100644 --- a/configs/ddr5-example.json +++ b/configs/ddr5-example.json @@ -1,14 +1,14 @@ { "simulation": { - "addressmapping": "am_ddr5_2x8x2Gbx4_dimm_p1KB_rbc.json", - "mcconfig": "fr_fcfs.json", - "memspec": "JEDEC_2x8x2Gbx4_DDR5-3200A.json", - "simconfig": "example.json", + "addressmapping": "addressmapping/am_ddr5_2x8x2Gbx4_dimm_p1KB_rbc.json", + "mcconfig": "mcconfig/fr_fcfs.json", + "memspec": "memspec/JEDEC_2x8x2Gbx4_DDR5-3200A.json", + "simconfig": "simconfig/example.json", "simulationid": "ddr5-example", "tracesetup": [ { "clkMhz": 2000, - "name": "example.stl" + "name": "traces/example.stl" } ] } diff --git a/configs/ddr5-generator-example.json b/configs/ddr5-generator-example.json index d3a74944..c2b6064b 100644 --- a/configs/ddr5-generator-example.json +++ b/configs/ddr5-generator-example.json @@ -1,9 +1,9 @@ { "simulation": { - "addressmapping": "am_ddr5_2x8x2Gbx4_dimm_p1KB_rbc.json", - "mcconfig": "fr_fcfs.json", - "memspec": "JEDEC_2x8x2Gbx4_DDR5-3200A.json", - "simconfig": "example.json", + "addressmapping": "addressmapping/am_ddr5_2x8x2Gbx4_dimm_p1KB_rbc.json", + "mcconfig": "mcconfig/fr_fcfs.json", + "memspec": "memspec/JEDEC_2x8x2Gbx4_DDR5-3200A.json", + "simconfig": "simconfig/example.json", "simulationid": "ddr5-example", "tracesetup": [ { diff --git a/configs/ddr5-rfm.json b/configs/ddr5-rfm.json deleted file mode 100644 index c8bb8160..00000000 --- a/configs/ddr5-rfm.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "simulation": { - "addressmapping": "am_ddr5_2x2x8x4Gbx4_dimm_p1KB_rbc.json", - "mcconfig": "fr_fcfs_rfm.json", - "memspec": "JEDEC_2x2x8x4Gbx4_DDR5-3200A.json", - "simconfig": "example.json", - "simulationid": "ddr5-example", - "tracesetup": [ - { - "clkMhz": 2000, - "type": "generator", - "name": "gen0", - "numRequests": 126000, - "rwRatio": 0.85, - "addressDistribution": "random", - "seed": 123456, - "maxPendingReadRequests": 24, - "maxPendingWriteRequests": 24 - }, - { - "clkMhz": 4000, - "type": "hammer", - "name": "ham0", - "numRequests": 4000, - "rowIncrement": 2097152 - } - ] - } -} diff --git a/configs/hbm2-example.json b/configs/hbm2-example.json index 7b48bc60..2aa7fc3f 100644 --- a/configs/hbm2-example.json +++ b/configs/hbm2-example.json @@ -1,14 +1,14 @@ { "simulation": { - "addressmapping": "am_hbm2_8Gb_pc_brc.json", - "mcconfig": "fr_fcfs.json", - "memspec": "HBM2.json", - "simconfig": "example.json", + "addressmapping": "addressmapping/am_hbm2_8Gb_pc_brc.json", + "mcconfig": "mcconfig/fr_fcfs.json", + "memspec": "memspec/HBM2.json", + "simconfig": "simconfig/example.json", "simulationid": "hbm2-example", "tracesetup": [ { "clkMhz": 1000, - "name": "example.stl" + "name": "traces/example.stl" } ] } diff --git a/configs/hbm3-example.json b/configs/hbm3-example.json index 019ad37f..301b2723 100644 --- a/configs/hbm3-example.json +++ b/configs/hbm3-example.json @@ -1,9 +1,9 @@ { "simulation": { - "addressmapping": "am_hbm3_8Gb_pc_brc.json", - "mcconfig": "fr_fcfs.json", - "memspec": "HBM3.json", - "simconfig": "example.json", + "addressmapping": "addressmapping/am_hbm3_8Gb_pc_brc.json", + "mcconfig": "mcconfig/fr_fcfs.json", + "memspec": "memspec/HBM3.json", + "simconfig": "simconfig/example.json", "simulationid": "hbm3-example", "tracesetup": [ { diff --git a/configs/lpddr4-example.json b/configs/lpddr4-example.json index 39ba60fd..59964d6f 100644 --- a/configs/lpddr4-example.json +++ b/configs/lpddr4-example.json @@ -1,14 +1,14 @@ { "simulation": { - "addressmapping": "am_lpddr4_8Gbx16_brc.json", - "mcconfig": "fr_fcfs.json", - "memspec": "JEDEC_8Gb_LPDDR4-3200_16bit.json", - "simconfig": "example.json", + "addressmapping": "addressmapping/am_lpddr4_8Gbx16_brc.json", + "mcconfig": "mcconfig/fr_fcfs.json", + "memspec": "memspec/JEDEC_8Gb_LPDDR4-3200_16bit.json", + "simconfig": "simconfig/example.json", "simulationid": "lpddr4-example", "tracesetup": [ { "clkMhz": 200, - "name": "example.stl" + "name": "traces/example.stl" } ] } diff --git a/configs/lpddr5-example.json b/configs/lpddr5-example.json index 26179bec..0fdf6c7d 100644 --- a/configs/lpddr5-example.json +++ b/configs/lpddr5-example.json @@ -1,14 +1,14 @@ { "simulation": { - "addressmapping": "am_lpddr5_1Gbx16_BG_rocobabg.json", - "mcconfig": "fr_fcfs_refp2b.json", - "memspec": "JEDEC_1Gbx16_BG_LPDDR5-6400.json", - "simconfig": "example.json", + "addressmapping": "addressmapping/am_lpddr5_1Gbx16_BG_rocobabg.json", + "mcconfig": "mcconfig/fr_fcfs_refp2b.json", + "memspec": "memspec/JEDEC_1Gbx16_BG_LPDDR5-6400.json", + "simconfig": "simconfig/example.json", "simulationid": "lpddr5-example", "tracesetup": [ { "clkMhz": 200, - "name": "example.stl" + "name": "traces/example.stl" } ] } diff --git a/configs/memspec/memspec_ranktest.json b/configs/memspec/memspec_ranktest.json deleted file mode 100644 index f108759d..00000000 --- a/configs/memspec/memspec_ranktest.json +++ /dev/null @@ -1,61 +0,0 @@ -{ - "memspec": { - "memarchitecturespec": { - "burstLength": 8, - "dataRate": 2, - "nbrOfBanks": 8, - "nbrOfColumns": 1024, - "nbrOfRanks": 4, - "nbrOfRows": 16384, - "width": 8, - "nbrOfDevicesOnDIMM": 8, - "nbrOfChannels": 1 - }, - "memoryId": "MICRON_1Gb_DDR3-1600_8bit_G", - "memoryType": "DDR3", - "mempowerspec": { - "idd0": 70.0, - "idd2n": 45.0, - "idd2p0": 12.0, - "idd2p1": 30.0, - "idd3n": 45.0, - "idd3p0": 35.0, - "idd3p1": 35.0, - "idd4r": 140.0, - "idd4w": 145.0, - "idd5": 170.0, - "idd6": 8.0, - "vdd": 1.5 - }, - "memtimingspec": { - "AL": 0, - "CCD": 4, - "CKE": 3, - "CKESR": 4, - "CL": 10, - "DQSCK": 0, - "FAW": 24, - "RAS": 28, - "RC": 38, - "RCD": 10, - "REFI": 6240, - "RFC": 88, - "RL": 10, - "RP": 10, - "RRD": 5, - "RTP": 6, - "WL": 8, - "WR": 12, - "WTR": 6, - "XP": 6, - "XPDLL": 20, - "XS": 96, - "XSDLL": 512, - "ACTPDEN": 1, - "PRPDEN": 1, - "REFPDEN": 1, - "RTRS": 1, - "tCK": 1250 - } - } -} diff --git a/configs/ranktest.json b/configs/ranktest.json deleted file mode 100644 index fbd2c08c..00000000 --- a/configs/ranktest.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "simulation": { - "addressmapping": "am_ranktest.json", - "mcconfig": "fr_fcfs.json", - "memspec": "memspec_ranktest.json", - "simconfig": "example.json", - "simulationid": "ranktest", - "tracesetup": [ - { - "clkMhz": 200, - "name": "ranktest.stl" - } - ] - } -} diff --git a/configs/stt-mram-example.json b/configs/stt-mram-example.json index 83403d0c..322af039 100644 --- a/configs/stt-mram-example.json +++ b/configs/stt-mram-example.json @@ -1,14 +1,14 @@ { "simulation": { - "addressmapping": "am_stt-mram_8x2Gbx8_dimm_p1KB_rbc.json", - "mcconfig": "fr_fcfs_noref.json", - "memspec": "STT-MRAM-1.2x.json", - "simconfig": "example.json", + "addressmapping": "addressmapping/am_stt-mram_8x2Gbx8_dimm_p1KB_rbc.json", + "mcconfig": "mcconfig/fr_fcfs_noref.json", + "memspec": "memspec/STT-MRAM-1.2x.json", + "simconfig": "simconfig/example.json", "simulationid": "stt-mram-example", "tracesetup": [ { "clkMhz": 800, - "name": "example.stl" + "name": "traces/example.stl" } ] } diff --git a/configs/traces/ranktest.stl b/configs/traces/ranktest.stl deleted file mode 100644 index 589ce70c..00000000 --- a/configs/traces/ranktest.stl +++ /dev/null @@ -1,33 +0,0 @@ -0: write 0x00000000 -1: write 0x08000000 -2: write 0x10000000 -3: write 0x18000000 -4: write 0x20000000 -5: write 0x28000000 -6: write 0x30000000 -7: write 0x38000000 -8: write 0x40000000 -9: write 0x48000000 -10: write 0x50000000 -11: write 0x58000000 -12: write 0x60000000 -13: write 0x68000000 -14: write 0x70000000 -15: write 0x78000000 -16: write 0x80000000 -17: write 0x88000000 -18: write 0x90000000 -19: write 0x98000000 -20: write 0xA0000000 -21: write 0xA8000000 -22: write 0xB0000000 -23: write 0xB8000000 -24: write 0xC0000000 -25: write 0xC8000000 -26: write 0xD0000000 -27: write 0xD8000000 -28: write 0xE0000000 -29: write 0xE8000000 -30: write 0xF0000000 -31: write 0xF8000000 -32: write 0x00000000 diff --git a/configs/wideio-thermal.json b/configs/wideio-thermal.json deleted file mode 100644 index d0f488fa..00000000 --- a/configs/wideio-thermal.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "simulation": { - "addressmapping": "am_wideio_thermal.json", - "mcconfig": "fr_fcfs.json", - "memspec": "JEDEC_256Mb_WIDEIO-200_128bit.json", - "simconfig": "wideio_thermal.json", - "simulationid": "wideio-example", - "tracesetup": [ - { - "clkMhz": 1000, - "name": "test_error.stl" - } - ] - } -} diff --git a/src/configuration/CMakeLists.txt b/src/configuration/CMakeLists.txt index a0530342..0f8135a8 100644 --- a/src/configuration/CMakeLists.txt +++ b/src/configuration/CMakeLists.txt @@ -50,10 +50,5 @@ target_link_libraries(configuration nlohmann_json::nlohmann_json ) -target_compile_definitions(configuration - PUBLIC - DRAMSYS_RESOURCE_DIR="${DRAMSYS_RESOURCE_DIR}" -) - target_compile_features(configuration PUBLIC cxx_std_17) add_library(DRAMSys::config ALIAS configuration) diff --git a/src/configuration/DRAMSys/config/AddressMapping.h b/src/configuration/DRAMSys/config/AddressMapping.h index 5e805793..a2382088 100644 --- a/src/configuration/DRAMSys/config/AddressMapping.h +++ b/src/configuration/DRAMSys/config/AddressMapping.h @@ -46,7 +46,6 @@ namespace DRAMSys::Config struct AddressMapping { static constexpr std::string_view KEY = "addressmapping"; - static constexpr std::string_view SUB_DIR = "addressmapping"; using BitEntry = std::variant>; diff --git a/src/configuration/DRAMSys/config/DRAMSysConfiguration.cpp b/src/configuration/DRAMSys/config/DRAMSysConfiguration.cpp index 56f7ad09..542ac11b 100644 --- a/src/configuration/DRAMSys/config/DRAMSysConfiguration.cpp +++ b/src/configuration/DRAMSys/config/DRAMSysConfiguration.cpp @@ -36,14 +36,14 @@ #include "DRAMSysConfiguration.h" #include -#include namespace DRAMSys::Config { -Configuration from_path(std::string_view path, std::string_view resourceDirectory) +Configuration from_path(std::filesystem::path baseConfig) { - std::ifstream file(path.data()); + std::ifstream file(baseConfig); + std::filesystem::path baseDir = baseConfig.parent_path(); enum class SubConfig { @@ -59,7 +59,7 @@ Configuration from_path(std::string_view path, std::string_view resourceDirector // with the actual json data. std::function parser_callback; - parser_callback = [&parser_callback, ¤t_sub_config, resourceDirectory]( + parser_callback = [&parser_callback, ¤t_sub_config, baseDir]( int depth, nlohmann::detail::parse_event_t event, json_t& parsed) -> bool { using nlohmann::detail::parse_event_t; @@ -90,13 +90,10 @@ Configuration from_path(std::string_view path, std::string_view resourceDirector if (event == parse_event_t::value && current_sub_config != SubConfig::Unkown) { // Replace name of json file with actual json data - auto parse_json = [&parser_callback, - resourceDirectory](std::string_view base_dir, - std::string_view sub_config_key, - const std::string& filename) -> json_t + auto parse_json = [&parser_callback, baseDir](std::string_view sub_config_key, + const std::string& filename) -> json_t { - std::filesystem::path path(resourceDirectory); - path /= base_dir; + std::filesystem::path path{baseDir}; path /= filename; std::ifstream json_file(path); @@ -110,15 +107,15 @@ Configuration from_path(std::string_view path, std::string_view resourceDirector }; if (current_sub_config == SubConfig::MemSpec) - parsed = parse_json(MemSpec::SUB_DIR, MemSpec::KEY, parsed); + parsed = parse_json(MemSpec::KEY, parsed); else if (current_sub_config == SubConfig::AddressMapping) - parsed = parse_json(AddressMapping::SUB_DIR, AddressMapping::KEY, parsed); + parsed = parse_json(AddressMapping::KEY, parsed); else if (current_sub_config == SubConfig::McConfig) - parsed = parse_json(McConfig::SUB_DIR, McConfig::KEY, parsed); + parsed = parse_json(McConfig::KEY, parsed); else if (current_sub_config == SubConfig::SimConfig) - parsed = parse_json(SimConfig::SUB_DIR, SimConfig::KEY, parsed); + parsed = parse_json(SimConfig::KEY, parsed); else if (current_sub_config == SubConfig::TraceSetup) - parsed = parse_json(TraceSetupConstants::SUB_DIR, TraceSetupConstants::KEY, parsed); + parsed = parse_json(TraceSetupConstants::KEY, parsed); } return true; @@ -129,7 +126,7 @@ Configuration from_path(std::string_view path, std::string_view resourceDirector json_t simulation = json_t::parse(file, parser_callback, true, true).at(Configuration::KEY); return simulation.get(); } - throw std::runtime_error("Failed to open file " + std::string(path)); + throw std::runtime_error("Failed to open file " + std::string(baseConfig)); } } // namespace DRAMSys::Config diff --git a/src/configuration/DRAMSys/config/DRAMSysConfiguration.h b/src/configuration/DRAMSys/config/DRAMSysConfiguration.h index 7b27df53..c66311fb 100644 --- a/src/configuration/DRAMSys/config/DRAMSysConfiguration.h +++ b/src/configuration/DRAMSys/config/DRAMSysConfiguration.h @@ -75,8 +75,7 @@ struct Configuration NLOHMANN_JSONIFY_ALL_THINGS( Configuration, addressmapping, mcconfig, memspec, simconfig, simulationid, tracesetup) -Configuration from_path(std::string_view path, - std::string_view resourceDirectory = DRAMSYS_RESOURCE_DIR); +Configuration from_path(std::filesystem::path baseConfig); } // namespace DRAMSys::Config diff --git a/src/configuration/DRAMSys/config/McConfig.h b/src/configuration/DRAMSys/config/McConfig.h index 5741e126..bcd64363 100644 --- a/src/configuration/DRAMSys/config/McConfig.h +++ b/src/configuration/DRAMSys/config/McConfig.h @@ -170,7 +170,6 @@ NLOHMANN_JSON_SERIALIZE_ENUM(ArbiterType, struct McConfig { static constexpr std::string_view KEY = "mcconfig"; - static constexpr std::string_view SUB_DIR = "mcconfig"; std::optional PagePolicy; std::optional Scheduler; diff --git a/src/configuration/DRAMSys/config/SimConfig.h b/src/configuration/DRAMSys/config/SimConfig.h index fcbfd6ba..a83d1b8d 100644 --- a/src/configuration/DRAMSys/config/SimConfig.h +++ b/src/configuration/DRAMSys/config/SimConfig.h @@ -58,7 +58,6 @@ NLOHMANN_JSON_SERIALIZE_ENUM(StoreModeType, struct SimConfig { static constexpr std::string_view KEY = "simconfig"; - static constexpr std::string_view SUB_DIR = "simconfig"; std::optional AddressOffset; std::optional CheckTLM2Protocol; diff --git a/src/configuration/DRAMSys/config/TraceSetup.h b/src/configuration/DRAMSys/config/TraceSetup.h index 71003dbf..c93f679a 100644 --- a/src/configuration/DRAMSys/config/TraceSetup.h +++ b/src/configuration/DRAMSys/config/TraceSetup.h @@ -205,7 +205,6 @@ NLOHMANN_JSONIFY_ALL_THINGS(RowHammer, struct TraceSetupConstants { static constexpr std::string_view KEY = "tracesetup"; - static constexpr std::string_view SUB_DIR = "tracesetup"; }; using Initiator = diff --git a/src/configuration/DRAMSys/config/memspec/MemSpec.h b/src/configuration/DRAMSys/config/memspec/MemSpec.h index 3d541fa1..d24bb890 100644 --- a/src/configuration/DRAMSys/config/memspec/MemSpec.h +++ b/src/configuration/DRAMSys/config/memspec/MemSpec.h @@ -78,12 +78,11 @@ NLOHMANN_JSON_SERIALIZE_ENUM(MemoryType, {MemoryType::GDDR6, "GDDR6"}, {MemoryType::HBM2, "HBM2"}, {MemoryType::HBM3, "HBM3"}, - {MemoryType::STTMRAM, "STTMRAM"}}) + {MemoryType::STTMRAM, "STT-MRAM"}}) struct MemSpec { static constexpr std::string_view KEY = "memspec"; - static constexpr std::string_view SUB_DIR = "memspec"; MemArchitectureSpecType memarchitecturespec; std::string memoryId; diff --git a/src/libdramsys/CMakeLists.txt b/src/libdramsys/CMakeLists.txt index 2bcca32e..a32772e6 100644 --- a/src/libdramsys/CMakeLists.txt +++ b/src/libdramsys/CMakeLists.txt @@ -100,6 +100,7 @@ target_compile_features(libdramsys PUBLIC cxx_std_17) target_compile_definitions(libdramsys PUBLIC + DRAMSYS_RESOURCE_DIR="${DRAMSYS_RESOURCE_DIR}" $<$:DRAMPOWER> ) diff --git a/src/simulator/main.cpp b/src/simulator/main.cpp index 32484de1..428f87d4 100644 --- a/src/simulator/main.cpp +++ b/src/simulator/main.cpp @@ -42,21 +42,15 @@ int sc_main(int argc, char** argv) { std::filesystem::path resourceDirectory = DRAMSYS_RESOURCE_DIR; - if (argc >= 3) - { - resourceDirectory = argv[2]; - } - std::filesystem::path baseConfig = resourceDirectory / "ddr4-example.json"; if (argc >= 2) { baseConfig = argv[1]; } - DRAMSys::Config::Configuration configuration = - DRAMSys::Config::from_path(baseConfig.c_str(), resourceDirectory.c_str()); + DRAMSys::Config::Configuration configuration = DRAMSys::Config::from_path(baseConfig.c_str()); - Simulator simulator(std::move(configuration), std::move(resourceDirectory)); + Simulator simulator(std::move(configuration), std::move(baseConfig)); simulator.run(); return 0; diff --git a/src/simulator/simulator/Simulator.cpp b/src/simulator/simulator/Simulator.cpp index 09b87ff0..bd6e0ccc 100644 --- a/src/simulator/simulator/Simulator.cpp +++ b/src/simulator/simulator/Simulator.cpp @@ -41,13 +41,12 @@ #include "player/StlPlayer.h" #include "util.h" -Simulator::Simulator(DRAMSys::Config::Configuration configuration, - std::filesystem::path resourceDirectory) : +Simulator::Simulator(DRAMSys::Config::Configuration configuration, std::filesystem::path baseConfig) : storageEnabled(configuration.simconfig.StoreMode == DRAMSys::Config::StoreModeType::Store), memoryManager(storageEnabled), configuration(std::move(configuration)), - resourceDirectory(std::move(resourceDirectory)), - dramSys(std::make_unique("DRAMSys", this->configuration)) + dramSys(std::make_unique("DRAMSys", this->configuration)), + baseConfig(baseConfig) { terminateInitiator = [this]() { @@ -104,7 +103,7 @@ Simulator::instantiateInitiator(const DRAMSys::Config::Initiator& initiator) } else if constexpr (std::is_same_v) { - std::filesystem::path tracePath = resourceDirectory / TRACE_DIRECTORY / config.name; + std::filesystem::path tracePath = baseConfig.parent_path() / config.name; std::optional traceType; diff --git a/src/simulator/simulator/Simulator.h b/src/simulator/simulator/Simulator.h index 5255169c..4d7a5434 100644 --- a/src/simulator/simulator/Simulator.h +++ b/src/simulator/simulator/Simulator.h @@ -41,13 +41,10 @@ #include #include -static constexpr std::string_view TRACE_DIRECTORY = "traces"; - class Simulator { public: - Simulator(DRAMSys::Config::Configuration configuration, - std::filesystem::path resourceDirectory); + Simulator(DRAMSys::Config::Configuration configuration, std::filesystem::path baseConfig); void run(); @@ -58,7 +55,6 @@ private: MemoryManager memoryManager; DRAMSys::Config::Configuration configuration; - std::filesystem::path resourceDirectory; std::unique_ptr dramSys; std::vector> initiators; @@ -69,4 +65,6 @@ private: unsigned int terminatedInitiators = 0; uint64_t totalTransactions{}; uint64_t transactionsFinished = 0; + + std::filesystem::path baseConfig; }; diff --git a/tests/tests_configuration/test_configuration.cpp b/tests/tests_configuration/test_configuration.cpp index 10ffbed3..5c0047b1 100644 --- a/tests/tests_configuration/test_configuration.cpp +++ b/tests/tests_configuration/test_configuration.cpp @@ -288,12 +288,6 @@ TEST_F(ConfigurationTest, DumpConfiguration) std::cout << json.dump(4) << std::endl; } -TEST(Configuration, ResourceDirectory) -{ - // Test should not throw exceptions - Configuration config = from_path("resources/ddr5-example.json", "resources"); -} - TEST(Configuration, FromPath) { // Test should not throw exceptions diff --git a/tests/tests_regression/CMakeLists.txt b/tests/tests_regression/CMakeLists.txt index 50909034..d04c77ae 100644 --- a/tests/tests_regression/CMakeLists.txt +++ b/tests/tests_regression/CMakeLists.txt @@ -48,7 +48,7 @@ set(TABLES_TO_COMPARE Power ) -function(test_standard standard test_name base_config resource_dir output_filename) +function(test_standard standard test_name base_config output_filename) if(NOT IS_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/${standard}) message(WARNING "Cannot find regression test ${standard}") return() @@ -61,7 +61,7 @@ function(test_standard standard test_name base_config resource_dir output_filena add_test( NAME Regression${test_name}.CreateDatabase WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${test_name} - COMMAND $ ${base_config} ${resource_dir} + COMMAND $ ${base_config} ) set_tests_properties(Regression${test_name}.CreateDatabase PROPERTIES FIXTURES_SETUP Regression${test_name}.CreateDatabase) @@ -89,12 +89,12 @@ function(test_standard standard test_name base_config resource_dir output_filena endforeach() endfunction() -test_standard(DDR3 DDR3 ${CMAKE_CURRENT_SOURCE_DIR}/DDR3/ddr3-example.json ${CMAKE_CURRENT_SOURCE_DIR}/DDR3 DRAMSys_ddr3-dual-rank_ddr3_ch0.tdb) -test_standard(DDR4 DDR4 ${CMAKE_CURRENT_SOURCE_DIR}/DDR4/ddr4-example.json ${CMAKE_CURRENT_SOURCE_DIR}/DDR4 DRAMSys_ddr4-bankgrp_ddr4_ch0.tdb) -test_standard(DDR5 DDR5.Ch0 ${CMAKE_CURRENT_SOURCE_DIR}/DDR5/ddr5-example.json ${CMAKE_CURRENT_SOURCE_DIR}/DDR5 DRAMSys_ddr5-example_ddr5_ch0.tdb) -test_standard(DDR5 DDR5.Ch1 ${CMAKE_CURRENT_SOURCE_DIR}/DDR5/ddr5-example.json ${CMAKE_CURRENT_SOURCE_DIR}/DDR5 DRAMSys_ddr5-example_ddr5_ch1.tdb) -test_standard(LPDDR4 LPDDR4 ${CMAKE_CURRENT_SOURCE_DIR}/LPDDR4/lpddr4-example.json ${CMAKE_CURRENT_SOURCE_DIR}/LPDDR4 DRAMSys_lpddr4-example_lpddr4_ch0.tdb) -test_standard(LPDDR5 LPDDR5 ${CMAKE_CURRENT_SOURCE_DIR}/LPDDR5/lpddr5-example.json ${CMAKE_CURRENT_SOURCE_DIR}/LPDDR5 DRAMSys_lpddr5-example_lpddr5_ch0.tdb) -test_standard(HBM2 HBM2.Ch0 ${CMAKE_CURRENT_SOURCE_DIR}/HBM2/hbm2-example.json ${CMAKE_CURRENT_SOURCE_DIR}/HBM2 DRAMSys_hbm2-example_hbm2_ch0.tdb) -test_standard(HBM2 HBM2.Ch1 ${CMAKE_CURRENT_SOURCE_DIR}/HBM2/hbm2-example.json ${CMAKE_CURRENT_SOURCE_DIR}/HBM2 DRAMSys_hbm2-example_hbm2_ch1.tdb) -test_standard(HBM3 HBM3 ${CMAKE_CURRENT_SOURCE_DIR}/HBM3/hbm3-example.json ${CMAKE_CURRENT_SOURCE_DIR}/HBM3 DRAMSys_hbm3-example_hbm3_ch0.tdb) +test_standard(DDR3 DDR3 ${CMAKE_CURRENT_SOURCE_DIR}/DDR3/ddr3-example.json DRAMSys_ddr3-dual-rank_ddr3_ch0.tdb) +test_standard(DDR4 DDR4 ${CMAKE_CURRENT_SOURCE_DIR}/DDR4/ddr4-example.json DRAMSys_ddr4-bankgrp_ddr4_ch0.tdb) +test_standard(DDR5 DDR5.Ch0 ${CMAKE_CURRENT_SOURCE_DIR}/DDR5/ddr5-example.json DRAMSys_ddr5-example_ddr5_ch0.tdb) +test_standard(DDR5 DDR5.Ch1 ${CMAKE_CURRENT_SOURCE_DIR}/DDR5/ddr5-example.json DRAMSys_ddr5-example_ddr5_ch1.tdb) +test_standard(LPDDR4 LPDDR4 ${CMAKE_CURRENT_SOURCE_DIR}/LPDDR4/lpddr4-example.json DRAMSys_lpddr4-example_lpddr4_ch0.tdb) +test_standard(LPDDR5 LPDDR5 ${CMAKE_CURRENT_SOURCE_DIR}/LPDDR5/lpddr5-example.json DRAMSys_lpddr5-example_lpddr5_ch0.tdb) +test_standard(HBM2 HBM2.Ch0 ${CMAKE_CURRENT_SOURCE_DIR}/HBM2/hbm2-example.json DRAMSys_hbm2-example_hbm2_ch0.tdb) +test_standard(HBM2 HBM2.Ch1 ${CMAKE_CURRENT_SOURCE_DIR}/HBM2/hbm2-example.json DRAMSys_hbm2-example_hbm2_ch1.tdb) +test_standard(HBM3 HBM3 ${CMAKE_CURRENT_SOURCE_DIR}/HBM3/hbm3-example.json DRAMSys_hbm3-example_hbm3_ch0.tdb) diff --git a/tests/tests_regression/DDR3/ddr3-example.json b/tests/tests_regression/DDR3/ddr3-example.json index 09e69bbf..0e49e60b 100644 --- a/tests/tests_regression/DDR3/ddr3-example.json +++ b/tests/tests_regression/DDR3/ddr3-example.json @@ -135,7 +135,7 @@ "tracesetup": [ { "clkMhz": 533, - "name": "trace_test2.stl" + "name": "traces/trace_test2.stl" } ] } diff --git a/tests/tests_regression/DDR4/ddr4-example.json b/tests/tests_regression/DDR4/ddr4-example.json index e7c47e93..326cd060 100644 --- a/tests/tests_regression/DDR4/ddr4-example.json +++ b/tests/tests_regression/DDR4/ddr4-example.json @@ -146,7 +146,7 @@ "tracesetup": [ { "clkMhz": 933, - "name": "trace_test3.stl" + "name": "traces/trace_test3.stl" } ] } diff --git a/tests/tests_regression/DDR5/ddr5-example.json b/tests/tests_regression/DDR5/ddr5-example.json index 27b427c1..31bb498a 100644 --- a/tests/tests_regression/DDR5/ddr5-example.json +++ b/tests/tests_regression/DDR5/ddr5-example.json @@ -158,7 +158,7 @@ "tracesetup": [ { "clkMhz": 1600, - "name": "trace_test3.stl" + "name": "traces/trace_test3.stl" } ] } diff --git a/tests/tests_regression/HBM2/hbm2-example.json b/tests/tests_regression/HBM2/hbm2-example.json index 9690aea3..25d0589f 100644 --- a/tests/tests_regression/HBM2/hbm2-example.json +++ b/tests/tests_regression/HBM2/hbm2-example.json @@ -126,11 +126,11 @@ "tracesetup": [ { "clkMhz": 1000, - "name": "trace1_test4.stl" + "name": "traces/trace1_test4.stl" }, { "clkMhz": 1000, - "name": "trace2_test4.stl" + "name": "traces/trace2_test4.stl" } ] } diff --git a/tests/tests_regression/HBM2/hbm2.txt b/tests/tests_regression/HBM2/hbm2.txt deleted file mode 100644 index e69de29b..00000000 diff --git a/tests/tests_regression/HBM3/hbm3-example.json b/tests/tests_regression/HBM3/hbm3-example.json index 1fba3b38..c20d579e 100644 --- a/tests/tests_regression/HBM3/hbm3-example.json +++ b/tests/tests_regression/HBM3/hbm3-example.json @@ -129,11 +129,11 @@ "tracesetup": [ { "clkMhz": 1600, - "name": "trace1_test4.stl" + "name": "traces/trace1_test4.stl" }, { "clkMhz": 1600, - "name": "trace2_test4.stl" + "name": "traces/trace2_test4.stl" } ] } diff --git a/tests/tests_regression/LPDDR4/lpddr4-example.json b/tests/tests_regression/LPDDR4/lpddr4-example.json index 2e2ca266..a0c9aa08 100644 --- a/tests/tests_regression/LPDDR4/lpddr4-example.json +++ b/tests/tests_regression/LPDDR4/lpddr4-example.json @@ -123,7 +123,7 @@ "tracesetup": [ { "clkMhz": 1600, - "name": "trace_lpddr4.stl" + "name": "traces/trace_lpddr4.stl" } ] } diff --git a/tests/tests_regression/LPDDR5/lpddr5-example.json b/tests/tests_regression/LPDDR5/lpddr5-example.json index b10db8d8..ba4c208e 100644 --- a/tests/tests_regression/LPDDR5/lpddr5-example.json +++ b/tests/tests_regression/LPDDR5/lpddr5-example.json @@ -134,7 +134,7 @@ "tracesetup": [ { "clkMhz": 1600, - "name": "trace_lpddr5.stl" + "name": "traces/trace_lpddr5.stl" } ] } diff --git a/tools/json_converter.cpp b/tools/json_converter.cpp index 22f2afed..6cd7856b 100644 --- a/tools/json_converter.cpp +++ b/tools/json_converter.cpp @@ -54,9 +54,8 @@ int main(int argc, char** argv) } std::string pathToJson = argv[1]; - std::string resourceDirectory = argc <= 3 ? DRAMSYS_RESOURCE_DIR : argv[3]; - auto configuration = DRAMSys::Config::from_path(pathToJson, resourceDirectory); + auto configuration = DRAMSys::Config::from_path(pathToJson); nlohmann::json json; json["simulation"] = configuration;