Skip to content

Commit

Permalink
Memory interface type check (#373)
Browse files Browse the repository at this point in the history
This PR adds extra checks to the model configuration to ensure memory interface type restrictions are enforced
  • Loading branch information
jj16791 authored and ABenC377 committed Feb 7, 2024
1 parent 7cf73cd commit d576779
Show file tree
Hide file tree
Showing 9 changed files with 76 additions and 32 deletions.
24 changes: 24 additions & 0 deletions src/lib/config/ModelConfig.cc
Original file line number Diff line number Diff line change
Expand Up @@ -902,6 +902,30 @@ void ModelConfig::postValidation() {
// Record any unlinked port names
for (const auto& prt : portnames)
invalid_ << "\t- " << prt << " has no associated reservation station\n";

// Ensure the L1-[Data|Instruction]-Memory:Interface-Type restrictions are
// enforced
std::string simMode =
configTree_["Core"]["Simulation-Mode"].as<std::string>();
// Currently, only outoforder core types can use non-Flat L1-Data-Memory
// interfaces
if (simMode != "outoforder") {
std::string l1dType =
configTree_["L1-Data-Memory"]["Interface-Type"].as<std::string>();
if (l1dType != "Flat")
invalid_ << "\t- Only a Flat L1-Data-Memory Interface-Type may be used "
"with the "
<< simMode << " Simulation-Mode. Interface-Type used is "
<< l1dType << "\n";
}

// Currently, only a Flat L1-Instruction-Memory:Interface-Type is supported
std::string l1iType =
configTree_["L1-Instruction-Memory"]["Interface-Type"].as<std::string>();
if (l1iType != "Flat")
invalid_ << "\t- Only a 'Flat' L1-Instruction-Memory Interface-Type is "
"supported. Interface-Type used is "
<< l1iType << "\n";
}

ryml::Tree ModelConfig::getConfig() { return configTree_; }
Expand Down
4 changes: 3 additions & 1 deletion test/regression/aarch64/MicroOperation.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1084,7 +1084,9 @@ INSTANTIATE_TEST_SUITE_P(
::testing::Values(
std::make_tuple(EMULATION, "{Core: {Micro-Operations: True}}"),
std::make_tuple(INORDER, "{Core: {Micro-Operations: True}}"),
std::make_tuple(OUTOFORDER, "{Core: {Micro-Operations: True}}")),
std::make_tuple(OUTOFORDER,
"{Core: {Micro-Operations: True}, L1-Data-Memory: "
"{Interface-Type: Fixed}}")),
paramToString);

} // namespace
13 changes: 8 additions & 5 deletions test/regression/aarch64/SmokeTest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,13 @@ TEST_P(SmokeTest, heap) {
EXPECT_EQ(getMemoryValue<uint32_t>(process_->getHeapStart() + 4), 42u);
}

INSTANTIATE_TEST_SUITE_P(AArch64, SmokeTest,
::testing::Values(std::make_tuple(EMULATION, "{}"),
std::make_tuple(INORDER, "{}"),
std::make_tuple(OUTOFORDER, "{}")),
paramToString);
INSTANTIATE_TEST_SUITE_P(
AArch64, SmokeTest,
::testing::Values(std::make_tuple(EMULATION, "{}"),
std::make_tuple(INORDER, "{}"),
std::make_tuple(OUTOFORDER,
"{L1-Data-Memory: "
"{Interface-Type: Fixed}}")),
paramToString);

} // namespace
13 changes: 8 additions & 5 deletions test/regression/aarch64/Syscall.cc
Original file line number Diff line number Diff line change
Expand Up @@ -871,10 +871,13 @@ TEST_P(Syscall, ftruncate) {
EXPECT_EQ(getGeneralRegister<uint64_t>(23), 0);
}

INSTANTIATE_TEST_SUITE_P(AArch64, Syscall,
::testing::Values(std::make_tuple(EMULATION, "{}"),
std::make_tuple(INORDER, "{}"),
std::make_tuple(OUTOFORDER, "{}")),
paramToString);
INSTANTIATE_TEST_SUITE_P(
AArch64, Syscall,
::testing::Values(std::make_tuple(EMULATION, "{}"),
std::make_tuple(INORDER, "{}"),
std::make_tuple(OUTOFORDER,
"{L1-Data-Memory: "
"{Interface-Type: Fixed}}")),
paramToString);

} // namespace
13 changes: 8 additions & 5 deletions test/regression/aarch64/SystemRegisters.cc
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,13 @@ TEST_P(SystemRegister, counter_timers) {
EXPECT_EQ(getSystemRegister(0xdf02), 2);
}

INSTANTIATE_TEST_SUITE_P(AArch64, SystemRegister,
::testing::Values(std::make_tuple(EMULATION, "{}"),
std::make_tuple(INORDER, "{}"),
std::make_tuple(OUTOFORDER, "{}")),
paramToString);
INSTANTIATE_TEST_SUITE_P(
AArch64, SystemRegister,
::testing::Values(std::make_tuple(EMULATION, "{}"),
std::make_tuple(INORDER, "{}"),
std::make_tuple(OUTOFORDER,
"{L1-Data-Memory: "
"{Interface-Type: Fixed}}")),
paramToString);

} // namespace
13 changes: 8 additions & 5 deletions test/regression/riscv/LoadStoreQueue.cc
Original file line number Diff line number Diff line change
Expand Up @@ -97,10 +97,13 @@ TEST_P(LoadStoreQueue, SpeculativeInvalidLoad) {
EXPECT_EQ(getGeneralRegister<uint64_t>(5), 12u);
}

INSTANTIATE_TEST_SUITE_P(RISCV, LoadStoreQueue,
::testing::Values(std::make_tuple(EMULATION, "{}"),
std::make_tuple(INORDER, "{}"),
std::make_tuple(OUTOFORDER, "{}")),
paramToString);
INSTANTIATE_TEST_SUITE_P(
RISCV, LoadStoreQueue,
::testing::Values(std::make_tuple(EMULATION, "{}"),
std::make_tuple(INORDER, "{}"),
std::make_tuple(OUTOFORDER,
"{L1-Data-Memory: "
"{Interface-Type: Fixed}}")),
paramToString);

} // namespace
2 changes: 1 addition & 1 deletion test/regression/riscv/RISCVRegressionTest.hh
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ static const char* RISCV_ADDITIONAL_CONFIG = R"YAML(
},
L1-Data-Memory:
{
Interface-Type: Fixed,
Interface-Type: Flat,
},
L1-Instruction-Memory:
{
Expand Down
13 changes: 8 additions & 5 deletions test/regression/riscv/SmokeTest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,13 @@ TEST_P(SmokeTest, instruction) {
EXPECT_EQ(getGeneralRegister<uint64_t>(15), 32u);
}

INSTANTIATE_TEST_SUITE_P(RISCV, SmokeTest,
::testing::Values(std::make_tuple(EMULATION, "{}"),
std::make_tuple(INORDER, "{}"),
std::make_tuple(OUTOFORDER, "{}")),
paramToString);
INSTANTIATE_TEST_SUITE_P(
RISCV, SmokeTest,
::testing::Values(std::make_tuple(EMULATION, "{}"),
std::make_tuple(INORDER, "{}"),
std::make_tuple(OUTOFORDER,
"{L1-Data-Memory: "
"{Interface-Type: Fixed}}")),
paramToString);

} // namespace
13 changes: 8 additions & 5 deletions test/regression/riscv/Syscall.cc
Original file line number Diff line number Diff line change
Expand Up @@ -880,9 +880,12 @@ TEST_P(Syscall, ftruncate) {
EXPECT_EQ(getGeneralRegister<uint64_t>(28), 0);
}

INSTANTIATE_TEST_SUITE_P(RISCV, Syscall,
::testing::Values(std::make_tuple(EMULATION, "{}"),
std::make_tuple(INORDER, "{}"),
std::make_tuple(OUTOFORDER, "{}")),
paramToString);
INSTANTIATE_TEST_SUITE_P(
RISCV, Syscall,
::testing::Values(std::make_tuple(EMULATION, "{}"),
std::make_tuple(INORDER, "{}"),
std::make_tuple(OUTOFORDER,
"{L1-Data-Memory: "
"{Interface-Type: Fixed}}")),
paramToString);
} // namespace

0 comments on commit d576779

Please sign in to comment.