Skip to content

Commit

Permalink
Removing cpu node from findMasterScoreboard_, have it look from paren…
Browse files Browse the repository at this point in the history
…t instead of searching for ancestor/root
  • Loading branch information
aarongchan authored and klingaard committed Jan 23, 2024
1 parent b1012b8 commit a00617e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 14 deletions.
12 changes: 3 additions & 9 deletions sparta/src/Scoreboard.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<Scoreboard*(sparta::TreeNode *)> findScoreboard =
[&] (sparta::TreeNode * node) -> Scoreboard * {
Expand Down Expand Up @@ -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,
Expand Down
10 changes: 5 additions & 5 deletions sparta/test/Scoreboard/Scoreboard_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}

Expand Down Expand Up @@ -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; };

Expand Down Expand Up @@ -523,7 +523,7 @@ void testScoreboardClearing()
rtn.enterConfiguring();
rtn.enterFinalized();
sparta::Scoreboard * master_sb = sbtn.getResourceAs<sparta::Scoreboard>();
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);
Expand Down Expand Up @@ -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);
Expand All @@ -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);
Expand Down

0 comments on commit a00617e

Please sign in to comment.