Extract plausability check from AddressDecoder to separate function
This commit is contained in:
@@ -37,70 +37,6 @@
|
||||
|
||||
#include <string>
|
||||
|
||||
inline constexpr std::string_view memSpecJsonString = R"(
|
||||
{
|
||||
"memspec": {
|
||||
"memarchitecturespec": {
|
||||
"burstLength": 16,
|
||||
"dataRate": 8,
|
||||
"nbrOfBankGroups": 4,
|
||||
"nbrOfBanks": 16,
|
||||
"nbrOfColumns": 1024,
|
||||
"nbrOfRows": 65536,
|
||||
"nbrOfRanks": 1,
|
||||
"nbrOfDevices": 1,
|
||||
"nbrOfChannels": 1,
|
||||
"width": 16,
|
||||
"per2BankOffset": 8
|
||||
},
|
||||
"memoryId": "JEDEC_1Gbx16_BG_LPDDR5-6400",
|
||||
"memoryType": "LPDDR5",
|
||||
"memtimingspec": {
|
||||
"RCD_L": 15,
|
||||
"RCD_S": 15,
|
||||
"PPD": 2,
|
||||
"RPab": 17,
|
||||
"RPpb": 15,
|
||||
"RAS": 34,
|
||||
"RCab": 51,
|
||||
"RCpb": 48,
|
||||
"FAW": 16,
|
||||
"RRD": 4,
|
||||
"RL": 17,
|
||||
"WCK2CK": 0,
|
||||
"WCK2DQO": 1,
|
||||
"RBTP": 4,
|
||||
"RPRE": 0,
|
||||
"RPST": 0,
|
||||
"WL": 9,
|
||||
"WCK2DQI": 0,
|
||||
"WPRE": 0,
|
||||
"WPST": 0,
|
||||
"WR": 28,
|
||||
"WTR_L": 10,
|
||||
"WTR_S": 5,
|
||||
"CCDMW": 16,
|
||||
"REFI": 3124,
|
||||
"REFIpb": 390,
|
||||
"RFCab": 224,
|
||||
"RFCpb": 112,
|
||||
"RTRS": 1,
|
||||
"BL_n_min_16": 2,
|
||||
"BL_n_max_16": 4,
|
||||
"BL_n_L_16": 4,
|
||||
"BL_n_S_16": 2,
|
||||
"BL_n_min_32": 6,
|
||||
"BL_n_max_32": 8,
|
||||
"BL_n_L_32": 8,
|
||||
"BL_n_S_32": 2,
|
||||
"pbR2act": 6,
|
||||
"pbR2pbR": 72,
|
||||
"clkMhz": 800
|
||||
}
|
||||
}
|
||||
}
|
||||
)";
|
||||
|
||||
inline constexpr std::string_view addressMappingJsonString = R"(
|
||||
{
|
||||
"addressmapping": {
|
||||
|
||||
@@ -35,32 +35,23 @@
|
||||
|
||||
#include "AddressDecoderConfigs.h"
|
||||
|
||||
#include <bitset>
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include <DRAMSys/configuration/memspec/MemSpecLPDDR5.h>
|
||||
#include <DRAMSys/simulation/AddressDecoder.h>
|
||||
|
||||
class AddressDecoderFixture : public ::testing::Test
|
||||
{
|
||||
protected:
|
||||
AddressDecoderFixture() :
|
||||
addressMappingJson(nlohmann::json::parse(addressMappingJsonString).at("addressmapping")),
|
||||
memSpecJson(nlohmann::json::parse(memSpecJsonString).at("memspec")),
|
||||
addressMappingConfig(addressMappingJson.get<DRAMSys::Config::AddressMapping>()),
|
||||
memSpecConfig(memSpecJson.get<DRAMSys::Config::MemSpec>()),
|
||||
memSpec(memSpecConfig),
|
||||
addressDecoder(addressMappingConfig, memSpec)
|
||||
addressMappingConfig(nlohmann::json::parse(addressMappingJsonString)
|
||||
.at("addressmapping")
|
||||
.get<DRAMSys::Config::AddressMapping>()),
|
||||
addressDecoder(addressMappingConfig)
|
||||
{
|
||||
}
|
||||
|
||||
nlohmann::json addressMappingJson;
|
||||
nlohmann::json memSpecJson;
|
||||
|
||||
// Configs
|
||||
DRAMSys::Config::AddressMapping addressMappingConfig;
|
||||
DRAMSys::Config::MemSpec memSpecConfig;
|
||||
|
||||
DRAMSys::MemSpecLPDDR5 memSpec;
|
||||
DRAMSys::AddressDecoder addressDecoder;
|
||||
};
|
||||
|
||||
@@ -116,4 +107,4 @@ TEST_F(AddressDecoderFixture, DeEncoding)
|
||||
|
||||
EXPECT_EQ(encodedAddress, address);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user