Remove hard-coded subdirectory paths for configs

Previously, the subdirectories in which the sub-json files were searched
in were hardcoded. Now, DRAMSys simply searches in the directory of the
base config, making this approach more flexible.
This commit is contained in:
2025-04-07 13:26:47 +02:00
parent a97b676b92
commit 939fc90f98
34 changed files with 61 additions and 285 deletions

View File

@@ -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
]
}
}

View File

@@ -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"
}
]
}

View File

@@ -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"
}
}

View File

@@ -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"
}
]
}

View File

@@ -147,7 +147,7 @@
"tracesetup": [
{
"clkMhz": 200,
"name": "example.stl"
"name": "traces/example.stl"
}
]
}

View File

@@ -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"
}
]
}

View File

@@ -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": [
{

View File

@@ -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
}
]
}
}

View File

@@ -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"
}
]
}

View File

@@ -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": [
{

View File

@@ -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"
}
]
}

View File

@@ -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"
}
]
}

View File

@@ -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
}
}
}

View File

@@ -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"
}
]
}
}

View File

@@ -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"
}
]
}

View File

@@ -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

View File

@@ -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"
}
]
}
}

View File

@@ -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<unsigned int, std::vector<unsigned int>>;

View File

@@ -36,7 +36,6 @@
#include "DRAMSysConfiguration.h"
#include <fstream>
#include <iostream>
namespace DRAMSys::Config
{
@@ -91,12 +90,10 @@ Configuration from_path(std::filesystem::path baseConfig)
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, baseDir](std::string_view base_dir,
std::string_view sub_config_key,
auto parse_json = [&parser_callback, baseDir](std::string_view sub_config_key,
const std::string& filename) -> json_t
{
std::filesystem::path path{baseDir};
path /= base_dir;
path /= filename;
std::ifstream json_file(path);
@@ -110,15 +107,15 @@ Configuration from_path(std::filesystem::path baseConfig)
};
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;

View File

@@ -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<PagePolicyType> PagePolicy;
std::optional<SchedulerType> Scheduler;

View File

@@ -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<uint64_t> AddressOffset;
std::optional<bool> CheckTLM2Protocol;

View File

@@ -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 =

View File

@@ -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;

View File

@@ -103,7 +103,7 @@ Simulator::instantiateInitiator(const DRAMSys::Config::Initiator& initiator)
}
else if constexpr (std::is_same_v<T, DRAMSys::Config::TracePlayer>)
{
std::filesystem::path tracePath = baseConfig.parent_path() / TRACE_DIRECTORY / config.name;
std::filesystem::path tracePath = baseConfig.parent_path() / config.name;
std::optional<StlPlayer::TraceType> traceType;

View File

@@ -41,8 +41,6 @@
#include <DRAMSys/config/DRAMSysConfiguration.h>
#include <DRAMSys/simulation/DRAMSys.h>
static constexpr std::string_view TRACE_DIRECTORY = "traces";
class Simulator
{
public:

View File

@@ -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");
}
TEST(Configuration, FromPath)
{
// Test should not throw exceptions

View File

@@ -135,7 +135,7 @@
"tracesetup": [
{
"clkMhz": 533,
"name": "trace_test2.stl"
"name": "traces/trace_test2.stl"
}
]
}

View File

@@ -146,7 +146,7 @@
"tracesetup": [
{
"clkMhz": 933,
"name": "trace_test3.stl"
"name": "traces/trace_test3.stl"
}
]
}

View File

@@ -158,7 +158,7 @@
"tracesetup": [
{
"clkMhz": 1600,
"name": "trace_test3.stl"
"name": "traces/trace_test3.stl"
}
]
}

View File

@@ -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"
}
]
}

View File

@@ -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"
}
]
}

View File

@@ -123,7 +123,7 @@
"tracesetup": [
{
"clkMhz": 1600,
"name": "trace_lpddr4.stl"
"name": "traces/trace_lpddr4.stl"
}
]
}

View File

@@ -134,7 +134,7 @@
"tracesetup": [
{
"clkMhz": 1600,
"name": "trace_lpddr5.stl"
"name": "traces/trace_lpddr5.stl"
}
]
}