diff --git a/sparta/src/Scoreboard.cpp b/sparta/src/Scoreboard.cpp index a540ea5fdc..9bb9fdc445 100644 --- a/sparta/src/Scoreboard.cpp +++ b/sparta/src/Scoreboard.cpp @@ -309,14 +309,8 @@ namespace sparta // Try to find the master scoreboard, if it's available (has // been created by the Sparta framework) - - // Go as high as the CPU node in this Tree. If we go higher, - // we could bind to a Scoreboard in another CPU! That'd be - // bad. - - // Search from the root - auto cpu_node = parent->getRoot(); - sparta_assert(cpu_node != nullptr, "Could not find the core nodes in this simulation"); + + // Search for scoreboards from parent std::function findScoreboard = [&] (sparta::TreeNode * node) -> Scoreboard * { @@ -350,7 +344,7 @@ namespace sparta return scoreboard; }; - Scoreboard * master_sb = findScoreboard(cpu_node); + Scoreboard * master_sb = findScoreboard(parent); // Gotta be more than 0 sparta_assert(master_sb != nullptr, diff --git a/sparta/test/Scoreboard/Scoreboard_test.cpp b/sparta/test/Scoreboard/Scoreboard_test.cpp index 5e3b3ccf24..61b7dc4735 100644 --- a/sparta/test/Scoreboard/Scoreboard_test.cpp +++ b/sparta/test/Scoreboard/Scoreboard_test.cpp @@ -152,7 +152,7 @@ class ExeUnit : public sparta::Unit my_scoreboard_view_.reset (new sparta::ScoreboardView(getContainer()->getName(), // ALU0, ALU1, LSU, FPU, etc sb_unit_type_, // integer, fp, vector - getContainer())); // Used to find the Scoreboard + getContainer()->getRoot())); // Used to find the Scoreboard advance_->schedule(); } @@ -316,7 +316,7 @@ void testScoreboardRegistration() sched.finalize(); // view from ALU0, integer - sparta::ScoreboardView view(UNIT_NAMES[0], SB_NAMES[0], &sbtn); + sparta::ScoreboardView view(UNIT_NAMES[0], SB_NAMES[0], &cpu); bool ready = false; auto ready_callback = [&ready](const sparta::Scoreboard::RegisterBitMask &) { ready = true; }; @@ -523,7 +523,7 @@ void testScoreboardClearing() rtn.enterConfiguring(); rtn.enterFinalized(); sparta::Scoreboard * master_sb = sbtn.getResourceAs(); - sparta::ScoreboardView view(UNIT_NAMES[0], SB_NAMES[0], &sbtn); + sparta::ScoreboardView view(UNIT_NAMES[0], SB_NAMES[0], &cpu); auto is_set = view.isSet({0b1000}); EXPECT_TRUE(is_set); @@ -561,7 +561,7 @@ void testScoreboardClearing() void testScoreboardNonCore() { - // testing scoreboard view is able to find scoreboards when there is not a "core" node + // testing scoreboard view is able to find scoreboards when there is a non core.* sparta::RootTreeNode rtn; sparta::Scheduler sched; sparta::ClockManager cm(&sched); @@ -588,7 +588,7 @@ void testScoreboardNonCore() rtn.enterConfiguring(); rtn.enterFinalized(); - sparta::ScoreboardView view(UNIT_NAMES[0], SB_NAMES[0], &sbtn); + sparta::ScoreboardView view(UNIT_NAMES[0], SB_NAMES[0], &cpu); auto is_set = view.isSet({0b1000}); EXPECT_TRUE(is_set);