Skip to content

Commit

Permalink
🎨 Incorporated pre-commit fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
pre-commit-ci[bot] committed Oct 16, 2024
1 parent 65cb54d commit a99c765
Showing 1 changed file with 58 additions and 58 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -850,72 +850,72 @@ d!fanins.empty()
!(fanins.size() == 2 && new_path_from_fanin_2_to_gate.empty()) &&
&!fanouts.empty()
!(fanouts.size() == 2 && new_path_from_gate_to_fanout_2.empty()))
{
for (const auto& path : {new_path_from_fanin_1_to_gate, new_path_from_fanin_2_to_gate,
new_path_from_gate_to_fanout_1, new_path_from_gate_to_fanout_2})
{
if (!path.empty())
{
route_path(lyt, path);
for (const auto& tile : path)
{
for (const auto& path : {new_path_from_fanin_1_to_gate, new_path_from_fanin_2_to_gate,
new_path_from_gate_to_fanout_1, new_path_from_gate_to_fanout_2})
{
if (!path.empty())
{
route_path(lyt, path);
for (const auto& tile : path)
{
lyt.obstruct_coordinate(tile);
}
}
}
lyt.obstruct_coordinate(tile);
}
}
}

moved_gate = true;
moved_gate = true;

// update children based on number of fanins
if (fanins.size() == 2)
{
lyt.move_node(lyt.get_node(new_pos), new_pos,
{
lyt.make_signal(lyt.get_node(new_path_from_fanin_1_to_gate.end()[-2])),
lyt.make_signal(lyt.get_node(new_path_from_fanin_2_to_gate.end()[-2])),
});
}
else if (fanins.size() == 1)
{
lyt.move_node(lyt.get_node(new_pos), new_pos,
{lyt.make_signal(lyt.get_node(new_path_from_fanin_1_to_gate.end()[-2]))});
}
// update children based on number of fanins
if (fanins.size() == 2)
{
lyt.move_node(lyt.get_node(new_pos), new_pos,
{
lyt.make_signal(lyt.get_node(new_path_from_fanin_1_to_gate.end()[-2])),
lyt.make_signal(lyt.get_node(new_path_from_fanin_2_to_gate.end()[-2])),
});
}
else if (fanins.size() == 1)
{
lyt.move_node(lyt.get_node(new_pos), new_pos,
{lyt.make_signal(lyt.get_node(new_path_from_fanin_1_to_gate.end()[-2]))});
}

// update children of fanouts
for (const auto& fanout : fanouts)
{
std::vector<mockturtle::signal<ObstrLyt>> signals{};
signals.reserve(lyt.fanin_size(lyt.get_node(fanout)));
// update children of fanouts
for (const auto& fanout : fanouts)
{
std::vector<mockturtle::signal<ObstrLyt>> signals{};
signals.reserve(lyt.fanin_size(lyt.get_node(fanout)));

lyt.foreach_fanin(lyt.get_node(fanout),
[&lyt, &signals](const auto& i)
{
auto fout = static_cast<tile<ObstrLyt>>(i);
signals.push_back(lyt.make_signal(lyt.get_node(fout)));
});
lyt.foreach_fanin(lyt.get_node(fanout),
[&lyt, &signals](const auto& i)
{
auto fout = static_cast<tile<ObstrLyt>>(i);
signals.push_back(lyt.make_signal(lyt.get_node(fout)));
});

lyt.move_node(lyt.get_node(fanout), fanout, signals);
}
lyt.move_node(lyt.get_node(fanout), fanout, signals);
}

if (new_pos == old_pos)
{
return false;
}
}
// if no routing was found, remove added obstructions
else
{
for (const auto& path : {new_path_from_fanin_1_to_gate, new_path_from_fanin_2_to_gate,
new_path_from_gate_to_fanout_1, new_path_from_gate_to_fanout_2})
{
for (const auto& tile : path)
{
lyt.clear_obstructed_coordinate(tile);
}
}
}
if (new_pos == old_pos)
{
return false;
}
}
// if no routing was found, remove added obstructions
else
{
for (const auto& path : {new_path_from_fanin_1_to_gate, new_path_from_fanin_2_to_gate,
new_path_from_gate_to_fanout_1, new_path_from_gate_to_fanout_2})
{
for (const auto& tile : path)
{
lyt.clear_obstructed_coordinate(tile);
}
}
}

current_pos = new_pos;
current_pos = new_pos;
}
return true;
}
Expand Down

0 comments on commit a99c765

Please sign in to comment.