Use key "addressmapping" instead of "CONGEN" in addressmapping configs

This commit is contained in:
2023-03-17 14:01:17 +01:00
parent b0d7e4a18b
commit a49afa40eb
64 changed files with 227 additions and 241 deletions

View File

@@ -182,7 +182,7 @@ Used fields:
```json
{
"CONGEN": {
"addressmapping": {
"XOR": [
{
"FIRST": 13,

View File

@@ -1,5 +1,5 @@
{
"CONGEN": {
"addressmapping": {
"BANK_BIT": [
28,
29,

View File

@@ -1,5 +1,5 @@
{
"CONGEN": {
"addressmapping": {
"BANK_BIT": [
13,
14,

View File

@@ -1,5 +1,5 @@
{
"CONGEN": {
"addressmapping": {
"BANK_BIT": [
27,
28,

View File

@@ -1,5 +1,5 @@
{
"CONGEN": {
"addressmapping": {
"BANK_BIT": [
13,
14,

View File

@@ -1,5 +1,5 @@
{
"CONGEN": {
"addressmapping": {
"BANK_BIT": [
28,
29,

View File

@@ -1,5 +1,5 @@
{
"CONGEN": {
"addressmapping": {
"BANK_BIT": [
13,
14,

View File

@@ -1,5 +1,5 @@
{
"CONGEN": {
"addressmapping": {
"BANK_BIT": [
26,
27,

View File

@@ -1,5 +1,5 @@
{
"CONGEN": {
"addressmapping": {
"BANK_BIT": [
13,
14,

View File

@@ -1,5 +1,5 @@
{
"CONGEN": {
"addressmapping": {
"BANKGROUP_BIT":[
28,
29

View File

@@ -1,5 +1,5 @@
{
"CONGEN": {
"addressmapping": {
"BYTE_BIT": [
0,
1

View File

@@ -1,5 +1,5 @@
{
"CONGEN": {
"addressmapping": {
"BYTE_BIT": [
0,
1

View File

@@ -1,5 +1,5 @@
{
"CONGEN": {
"addressmapping": {
"BYTE_BIT": [
0,
1

View File

@@ -1,5 +1,5 @@
{
"CONGEN": {
"addressmapping": {
"BYTE_BIT": [
0,
1

View File

@@ -1,5 +1,5 @@
{
"CONGEN": {
"addressmapping": {
"PSEUDOCHANNEL_BIT":[
29
],

View File

@@ -1,5 +1,5 @@
{
"CONGEN": {
"addressmapping": {
"PSEUDOCHANNEL_BIT":[
28
],

View File

@@ -1,5 +1,5 @@
{
"CONGEN": {
"addressmapping": {
"BANK_BIT": [
28,
29,

View File

@@ -1,5 +1,5 @@
{
"CONGEN": {
"addressmapping": {
"BANK_BIT": [
11,
12,

View File

@@ -1,5 +1,5 @@
{
"CONGEN": {
"addressmapping": {
"BANK_BIT": [
5,
6,

View File

@@ -1,5 +1,5 @@
{
"CONGEN": {
"addressmapping": {
"BANK_BIT": [
27,
28,

View File

@@ -1,5 +1,5 @@
{
"CONGEN": {
"addressmapping": {
"BANK_BIT": [
11,
12,

View File

@@ -1,5 +1,5 @@
{
"CONGEN": {
"addressmapping": {
"BANK_BIT": [
5,
6,

View File

@@ -1,5 +1,5 @@
{
"CONGEN": {
"addressmapping": {
"BANK_BIT": [
27,
28,

View File

@@ -1,5 +1,5 @@
{
"CONGEN": {
"addressmapping": {
"BYTE_BIT": [
0
],

View File

@@ -1,5 +1,5 @@
{
"CONGEN": {
"addressmapping": {
"BYTE_BIT": [
0
],

View File

@@ -1,5 +1,5 @@
{
"CONGEN": {
"addressmapping": {
"BYTE_BIT": [
0
],

View File

@@ -1,5 +1,5 @@
{
"CONGEN": {
"addressmapping": {
"BYTE_BIT": [
0
],

View File

@@ -1,5 +1,5 @@
{
"CONGEN": {
"addressmapping": {
"BYTE_BIT": [
0
],

View File

@@ -1,5 +1,5 @@
{
"CONGEN": {
"addressmapping": {
"BYTE_BIT": [
0
],

View File

@@ -1,5 +1,5 @@
{
"CONGEN": {
"addressmapping": {
"BYTE_BIT": [
0
],

View File

@@ -1,5 +1,5 @@
{
"CONGEN": {
"addressmapping": {
"BYTE_BIT": [
0
],

View File

@@ -1,5 +1,5 @@
{
"CONGEN": {
"addressmapping": {
"BYTE_BIT": [
0
],

View File

@@ -1,5 +1,5 @@
{
"CONGEN": {
"addressmapping": {
"BYTE_BIT": [
0
],

View File

@@ -1,5 +1,5 @@
{
"CONGEN": {
"addressmapping": {
"BYTE_BIT": [
0
],

View File

@@ -1,5 +1,5 @@
{
"CONGEN": {
"addressmapping": {
"BYTE_BIT": [
0
],

View File

@@ -1,5 +1,5 @@
{
"CONGEN": {
"addressmapping": {
"RANK_BIT":[
30,
31

View File

@@ -1,5 +1,5 @@
{
"CONGEN": {
"addressmapping": {
"BANK_BIT": [
13,
14,

View File

@@ -1,5 +1,5 @@
{
"CONGEN": {
"addressmapping": {
"BANK_BIT": [
25,
26,

View File

@@ -1,5 +1,5 @@
{
"CONGEN": {
"addressmapping": {
"BANK_BIT": [
12,
13,

View File

@@ -1,5 +1,5 @@
{
"CONGEN": {
"addressmapping": {
"BANK_BIT": [
25,
26

View File

@@ -1,5 +1,5 @@
{
"CONGEN": {
"addressmapping": {
"BANK_BIT": [
11,
12

View File

@@ -1,5 +1,5 @@
{
"CONGEN": {
"addressmapping": {
"BANK_BIT": [
23,
24

View File

@@ -1,5 +1,5 @@
{
"CONGEN": {
"addressmapping": {
"BANK_BIT": [
11,
12

View File

@@ -1,5 +1,5 @@
{
"CONGEN": {
"addressmapping": {
"BANK_BIT": [
26,
27

View File

@@ -1,5 +1,5 @@
{
"CONGEN": {
"addressmapping": {
"BANK_BIT": [
11,
12

View File

@@ -1,5 +1,5 @@
{
"CONGEN": {
"addressmapping": {
"BANK_BIT": [
27,
28

View File

@@ -1,5 +1,5 @@
{
"CONGEN": {
"addressmapping": {
"BANK_BIT": [
12,
13

View File

@@ -1,5 +1,5 @@
{
"CONGEN": {
"addressmapping": {
"BANK_BIT": [
24,
25

View File

@@ -1,5 +1,5 @@
{
"CONGEN": {
"addressmapping": {
"BANK_BIT": [
11,
12

View File

@@ -1,5 +1,5 @@
{
"CONGEN": {
"addressmapping": {
"BANK_BIT": [
4,
5

View File

@@ -54,10 +54,8 @@ NLOHMANN_JSONIFY_ALL_THINGS(XorPair, FIRST, SECOND)
struct AddressMapping
{
static constexpr std::string_view KEY = "addressmapping";
static constexpr std::string_view INNER_KEY = "CONGEN";
static constexpr std::string_view PATH = "addressmapping";
static constexpr std::string_view SUB_DIR = "addressmapping";
struct ConGen {
std::optional<std::vector<unsigned int>> BYTE_BIT;
std::optional<std::vector<unsigned int>> COLUMN_BIT;
std::optional<std::vector<unsigned int>> ROW_BIT;
@@ -67,12 +65,9 @@ struct AddressMapping
std::optional<std::vector<unsigned int>> PSEUDOCHANNEL_BIT;
std::optional<std::vector<unsigned int>> CHANNEL_BIT;
std::optional<std::vector<XorPair>> XOR;
} CONGEN;
};
NLOHMANN_JSONIFY_ALL_THINGS(AddressMapping, CONGEN)
NLOHMANN_JSONIFY_ALL_THINGS(AddressMapping::ConGen,
NLOHMANN_JSONIFY_ALL_THINGS(AddressMapping,
BYTE_BIT,
COLUMN_BIT,
ROW_BIT,

View File

@@ -57,6 +57,8 @@ Configuration from_path(std::string_view path, std::string_view resourceDirector
Unkown
} current_sub_config;
// This custom parser callback is responsible to swap out the paths to the sub-config json files
// with the actual json data.
std::function<bool(int depth, nlohmann::detail::parse_event_t event, json_t &parsed)>
parser_callback;
parser_callback =
@@ -84,6 +86,8 @@ Configuration from_path(std::string_view path, std::string_view resourceDirector
current_sub_config = SubConfig::Unkown;
}
// In case we have an value (string) instead of an object, replace the value with the loaded
// json object.
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,
@@ -105,23 +109,15 @@ Configuration from_path(std::string_view path, std::string_view resourceDirector
};
if (current_sub_config == SubConfig::MemSpec)
parsed = parse_json(MemSpec::PATH, MemSpec::KEY, parsed);
parsed = parse_json(MemSpec::SUB_DIR, MemSpec::KEY, parsed);
else if (current_sub_config == SubConfig::AddressMapping)
{
parsed = parse_json(AddressMapping::PATH, AddressMapping::INNER_KEY, parsed);
if (!parsed.contains(AddressMapping::INNER_KEY)) {
auto temp = parsed;
parsed = json_t();
parsed[AddressMapping::INNER_KEY] = temp;
}
}
parsed = parse_json(AddressMapping::SUB_DIR, AddressMapping::KEY, parsed);
else if (current_sub_config == SubConfig::McConfig)
parsed = parse_json(McConfig::PATH, McConfig::KEY, parsed);
parsed = parse_json(McConfig::SUB_DIR, McConfig::KEY, parsed);
else if (current_sub_config == SubConfig::SimConfig)
parsed = parse_json(SimConfig::PATH, SimConfig::KEY, parsed);
parsed = parse_json(SimConfig::SUB_DIR, SimConfig::KEY, parsed);
else if (current_sub_config == SubConfig::TraceSetup)
parsed = parse_json(TraceSetupConstants::PATH, TraceSetupConstants::KEY, parsed);
parsed = parse_json(TraceSetupConstants::SUB_DIR, TraceSetupConstants::KEY, parsed);
}
return true;

View File

@@ -150,7 +150,7 @@ NLOHMANN_JSON_SERIALIZE_ENUM(ArbiterType, {{ArbiterType::Invalid, nullptr},
struct McConfig
{
static constexpr std::string_view KEY = "mcconfig";
static constexpr std::string_view PATH = "mcconfig";
static constexpr std::string_view SUB_DIR = "mcconfig";
std::optional<PagePolicyType> PagePolicy;
std::optional<SchedulerType> Scheduler;

View File

@@ -59,7 +59,7 @@ NLOHMANN_JSON_SERIALIZE_ENUM(StoreModeType, {{StoreModeType::Invalid, nullptr},
struct SimConfig
{
static constexpr std::string_view KEY = "simconfig";
static constexpr std::string_view PATH = "simconfig";
static constexpr std::string_view SUB_DIR = "simconfig";
std::optional<uint64_t> AddressOffset;
std::optional<bool> CheckTLM2Protocol;

View File

@@ -194,7 +194,7 @@ NLOHMANN_JSONIFY_ALL_THINGS(
struct TraceSetupConstants
{
static constexpr std::string_view KEY = "tracesetup";
static constexpr std::string_view PATH = "tracesetup";
static constexpr std::string_view SUB_DIR = "tracesetup";
};
using TraceSetup = std::vector<

View File

@@ -48,7 +48,7 @@ namespace DRAMSys::Config {
struct MemSpec
{
static constexpr std::string_view KEY = "memspec";
static constexpr std::string_view PATH = "memspec";
static constexpr std::string_view SUB_DIR = "memspec";
MemArchitectureSpecType memarchitecturespec;
std::string memoryId;

View File

@@ -46,27 +46,27 @@
AddressDecoder::AddressDecoder(const DRAMSys::Config::AddressMapping &addressMapping, const MemSpec &memSpec)
{
if (const auto &channelBits = addressMapping.CONGEN.CHANNEL_BIT)
if (const auto &channelBits = addressMapping.CHANNEL_BIT)
{
std::copy(channelBits->begin(), channelBits->end(), std::back_inserter(vChannelBits));
}
if (const auto &rankBits = addressMapping.CONGEN.RANK_BIT)
if (const auto &rankBits = addressMapping.RANK_BIT)
{
std::copy(rankBits->begin(), rankBits->end(), std::back_inserter(vRankBits));
}
if (const auto& bankGroupBits = addressMapping.CONGEN.BANKGROUP_BIT)
if (const auto& bankGroupBits = addressMapping.BANKGROUP_BIT)
{
std::copy(bankGroupBits->begin(), bankGroupBits->end(), std::back_inserter(vBankGroupBits));
}
if (const auto &byteBits = addressMapping.CONGEN.BYTE_BIT)
if (const auto &byteBits = addressMapping.BYTE_BIT)
{
std::copy(byteBits->begin(), byteBits->end(), std::back_inserter(vByteBits));
}
if (const auto &xorBits = addressMapping.CONGEN.XOR)
if (const auto &xorBits = addressMapping.XOR)
{
for (const auto& xorBit : *xorBits)
{
@@ -74,17 +74,17 @@ AddressDecoder::AddressDecoder(const DRAMSys::Config::AddressMapping &addressMap
}
}
if (const auto &bankBits = addressMapping.CONGEN.BANK_BIT)
if (const auto &bankBits = addressMapping.BANK_BIT)
{
std::copy(bankBits->begin(), bankBits->end(), std::back_inserter(vBankBits));
}
if (const auto &rowBits = addressMapping.CONGEN.ROW_BIT)
if (const auto &rowBits = addressMapping.ROW_BIT)
{
std::copy(rowBits->begin(), rowBits->end(), std::back_inserter(vRowBits));
}
if (const auto &columnBits = addressMapping.CONGEN.COLUMN_BIT)
if (const auto &columnBits = addressMapping.COLUMN_BIT)
{
std::copy(columnBits->begin(), columnBits->end(), std::back_inserter(vColumnBits));
}

View File

@@ -1,7 +1,6 @@
{
"simulation": {
"addressmapping": {
"CONGEN": {
"BANKGROUP_BIT": [
17,
18,
@@ -48,7 +47,6 @@
"ROW_BIT": [
16
]
}
},
"mcconfig": {
"Arbiter": "Simple",

View File

@@ -1,5 +1,5 @@
{
"CONGEN": {
"addressmapping": {
"BYTE_BIT": [
0,
1

View File

@@ -63,7 +63,7 @@ protected:
static DRAMSys::Config::RowHammer createTraceHammer();
DRAMSys::Config::AddressMapping addressMapping{
{{{0, 1}},
{{0, 1}},
{{2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12}},
{{16}},
{{13, 14, 15}},
@@ -71,7 +71,7 @@ protected:
{{33}},
std::nullopt,
std::nullopt,
std::nullopt}};
std::nullopt};
DRAMSys::Config::McConfig mcConfig{PagePolicyType::Open,
SchedulerType::FrFcfs,
@@ -439,7 +439,7 @@ TEST_F(ConfigurationTest, AddressMapping)
{
std::string_view addressmapping_string = R"(
{
"CONGEN": {
"addressmapping": {
"BANKGROUP_BIT": [
17,
18,
@@ -491,7 +491,8 @@ TEST_F(ConfigurationTest, AddressMapping)
)";
json_t addressmapping_reference = json_t::parse(addressmapping_string);
json_t addressmapping_test = addressMapping;
json_t addressmapping_test;
addressmapping_test[AddressMapping::KEY] = addressMapping;
EXPECT_EQ(addressmapping_test, addressmapping_reference);
}

View File

@@ -102,7 +102,7 @@ inline constexpr std::string_view memSpecJsonString = R"(
inline constexpr std::string_view addressMappingJsonString = R"(
{
"CONGEN": {
"addressmapping": {
"BYTE_BIT": [
0
],

View File

@@ -44,7 +44,7 @@ class AddressDecoderFixture : public ::testing::Test
{
protected:
AddressDecoderFixture() :
addressMappingJson(nlohmann::json::parse(addressMappingJsonString)),
addressMappingJson(nlohmann::json::parse(addressMappingJsonString).at("addressmapping")),
memSpecJson(nlohmann::json::parse(memSpecJsonString).at("memspec")),
addressMappingConfig(addressMappingJson.get<DRAMSys::Config::AddressMapping>()),
memSpec(memSpecConfig),

View File

@@ -1,7 +1,6 @@
{
"simulation": {
"addressmapping": {
"CONGEN": {
"BANKGROUP_BIT": [
28,
29
@@ -44,7 +43,6 @@
26,
27
]
}
},
"mcconfig": {
"Arbiter": "Simple",

View File

@@ -1,7 +1,6 @@
{
"simulation": {
"addressmapping": {
"CONGEN": {
"BANKGROUP_BIT": [
28,
29
@@ -44,7 +43,6 @@
26,
27
]
}
},
"mcconfig": {
"Arbiter": "Simple",