Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

⚡ Improved performance of SAT-based clock number assignment #449

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 27 additions & 14 deletions include/fiction/algorithms/physical_design/determine_clocking.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@
#include <bill/sat/tseytin.hpp>
#include <fmt/format.h>
#include <mockturtle/traits.hpp>
#include <mockturtle/utils/cost_functions.hpp>
#include <mockturtle/utils/stopwatch.hpp>
#include <mockturtle/views/depth_view.hpp>

#include <algorithm>
#include <functional>
Expand Down Expand Up @@ -268,30 +270,41 @@
*/
void symmetry_breaking() noexcept
{
// compute the critical path of the layout (unit cost for all nodes, no complemented edges, consider PI cost)
mockturtle::depth_view depth_layout{layout, mockturtle::unit_cost<Lyt>(), {false, true}};

const std::function<void(const mockturtle::node<Lyt>& n)> recurse =
[this, &recurse, clk = 0](const auto& n) mutable
[this, &depth_layout, &recurse, clk = 0](const auto& n) mutable

Check warning on line 277 in include/fiction/algorithms/physical_design/determine_clocking.hpp

View check run for this annotation

Codecov / codecov/patch

include/fiction/algorithms/physical_design/determine_clocking.hpp#L277

Added line #L277 was not covered by tests
{
const auto t = layout.get_tile(n);
const auto t = depth_layout.get_tile(n);

Check warning on line 279 in include/fiction/algorithms/physical_design/determine_clocking.hpp

View check run for this annotation

Codecov / codecov/patch

include/fiction/algorithms/physical_design/determine_clocking.hpp#L279

Added line #L279 was not covered by tests

// pre-assign tile t to clock number clk
solver.add_clause(variables[{t, clk++ % number_of_clocks}]);

layout.foreach_fanout(n,
[&recurse](auto const& fon)
{
recurse(fon);

return false; // terminate after one iteration
});
depth_layout.foreach_fanout(n,
[&depth_layout, &recurse](auto const& fon)

Check warning on line 285 in include/fiction/algorithms/physical_design/determine_clocking.hpp

View check run for this annotation

Codecov / codecov/patch

include/fiction/algorithms/physical_design/determine_clocking.hpp#L284-L285

Added lines #L284 - L285 were not covered by tests
{
if (depth_layout.is_on_critical_path(fon))
{
recurse(fon);
return false; // terminate

Check warning on line 290 in include/fiction/algorithms/physical_design/determine_clocking.hpp

View check run for this annotation

Codecov / codecov/patch

include/fiction/algorithms/physical_design/determine_clocking.hpp#L289-L290

Added lines #L289 - L290 were not covered by tests
}

return true; // continue until fan-out on critical path is found

Check warning on line 293 in include/fiction/algorithms/physical_design/determine_clocking.hpp

View check run for this annotation

Codecov / codecov/patch

include/fiction/algorithms/physical_design/determine_clocking.hpp#L293

Added line #L293 was not covered by tests
});
};

// only for the first PI
layout.foreach_pi(
[&recurse](const auto& pi)
// only for the PI on the critical path
depth_layout.foreach_pi(
[&depth_layout, &recurse](const auto& pi)
{
recurse(pi);
if (depth_layout.is_on_critical_path(pi))
{
recurse(pi);
return false; // terminate

Check warning on line 304 in include/fiction/algorithms/physical_design/determine_clocking.hpp

View check run for this annotation

Codecov / codecov/patch

include/fiction/algorithms/physical_design/determine_clocking.hpp#L303-L304

Added lines #L303 - L304 were not covered by tests
}

return false; // terminate after one iteration
return true; // continue until PI on critical path is found
});
}
/**
Expand Down
Loading