Skip to content

Commit

Permalink
🚨 clang-tidy warnings (#507)
Browse files Browse the repository at this point in the history
* clang-tidy suggestions

* 📝 Update pyfiction docstrings

Signed-off-by: GitHub Actions <[email protected]>

* Update clang-tidy-review.yml

* Update orthogonal.hpp

* 🎨 Incorporated pre-commit fixes

---------

Signed-off-by: GitHub Actions <[email protected]>
Co-authored-by: GitHub Actions <[email protected]>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
3 people committed Aug 22, 2024
1 parent ab74363 commit b03282c
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 45 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/clang-tidy-review.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ concurrency:
jobs:
clangtidy:
runs-on: ubuntu-latest
name: Clang-Tidy
name: 🚨 Clang-Tidy

steps:
- name: Clone Repository
Expand Down
14 changes: 14 additions & 0 deletions bindings/pyfiction/include/pyfiction/pybind11_mkdoc_docstrings.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3971,6 +3971,20 @@ static const char *__doc_fiction_detail_color_routing_impl_pst = R"doc(Statistic

static const char *__doc_fiction_detail_color_routing_impl_run = R"doc()doc";

static const char *__doc_fiction_detail_coloring_container = R"doc()doc";

static const char *__doc_fiction_detail_coloring_container_color_east = R"doc()doc";

static const char *__doc_fiction_detail_coloring_container_color_ntk = R"doc()doc";

static const char *__doc_fiction_detail_coloring_container_color_null = R"doc()doc";

static const char *__doc_fiction_detail_coloring_container_color_south = R"doc()doc";

static const char *__doc_fiction_detail_coloring_container_coloring_container = R"doc()doc";

static const char *__doc_fiction_detail_coloring_container_opposite_color = R"doc()doc";

static const char *__doc_fiction_detail_compare_gate_tiles =
R"doc(Custom comparison function for sorting tiles based on the sum of their
coordinates that breaks ties based on the x-coordinate.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ using node_dict_type = mockturtle::node_map<mockturtle::signal<Lyt>, Ntk>;
/**
* This enum class indicates the allowed positions for PIs.
*/
enum class pi_locations
enum class pi_locations : std::uint8_t
{
/**
* Flag indicating if primary inputs (PIs) can be placed at the top.
Expand Down Expand Up @@ -263,11 +263,11 @@ struct search_space_graph
/**
* The network associated with this search space graph.
*/
tec_nt network{};
tec_nt network;
/**
* Topological list of nodes to be placed in the layout.
*/
std::vector<mockturtle::node<tec_nt>> nodes_to_place{};
std::vector<mockturtle::node<tec_nt>> nodes_to_place;
/**
* Enum indicating if primary inputs (PIs) can be placed at the top or left.
*/
Expand Down Expand Up @@ -508,7 +508,7 @@ class topo_view_ci_to_co : public mockturtle::immutable_view<Ntk>
if (this->visited(this->get_node(f)) != this->trav_id())
{
not_visited = true;
};
}
});

if (not_visited)
Expand All @@ -532,7 +532,7 @@ class topo_view_ci_to_co : public mockturtle::immutable_view<Ntk>
* When checking for possible paths on a layout between two tiles SRC and DEST, one of them could also be the new tile
* for the next gate to be placed and it therefore has to be checked if said tile is still empty
*/
enum class new_gate_location
enum class new_gate_location : std::uint8_t
{
/**
* Do not check any tiles.
Expand Down Expand Up @@ -823,9 +823,21 @@ class graph_oriented_layout_design_impl
}
};

const uint64_t max_iterations = (pi_locs == pi_locations::TOP_AND_LEFT) ?
std::max(layout.x(), layout.y()) :
((pi_locs == pi_locations::TOP) ? layout.x() : layout.y());
uint64_t max_iterations = 0;

if (pi_locs == pi_locations::TOP_AND_LEFT)
{
max_iterations = std::max(layout.x(), layout.y());
}
else if (pi_locs == pi_locations::TOP)
{
max_iterations = layout.x();
}
else
{
max_iterations = layout.y();
}

const uint64_t expansion_limit = (pi_locs == pi_locations::TOP_AND_LEFT) ? 2 * num_expansions : num_expansions;
possible_positions.reserve(expansion_limit);

Expand Down Expand Up @@ -1401,8 +1413,6 @@ class graph_oriented_layout_design_impl
node_dict_type<ObstrLyt, tec_nt> node2pos{ssg.network};
placement_info<ObstrLyt> place_info{0ul, 0ul, node2pos, pi2node};

bool found_solution = false;

coord_vec_type<ObstrLyt> possible_positions{};
possible_positions.reserve(2 * ssg.num_expansions);

Expand All @@ -1415,7 +1425,7 @@ class graph_oriented_layout_design_impl
{
const auto position = ssg.current_vertex[idx];

found_solution = place_and_route(position, layout, ssg, place_info);
bool found_solution = place_and_route(position, layout, ssg, place_info);

uint64_t area = 0ul;

Expand Down
33 changes: 2 additions & 31 deletions include/fiction/algorithms/physical_design/orthogonal.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
#include <mockturtle/views/topo_view.hpp>

#include <algorithm>
#include <cstdint>
#include <optional>
#include <set>
#include <vector>
Expand Down Expand Up @@ -63,36 +64,6 @@ struct orthogonal_physical_design_stats
namespace detail
{

/**
* Determine siblings of the given node. A sibling is a node that shares the same fan-in with n.
* @param n Node to consider.
* @return Siblings of n.
*/
template <typename Ntk>
std::vector<mockturtle::node<Ntk>> siblings(const Ntk& ntk, const mockturtle::node<Ntk> n) noexcept
{
std::vector<mockturtle::node<Ntk>> sibs{};
ntk.foreach_fanin(n,
[&ntk, &sibs, &n](const auto& fi)
{
// skip constants
if (const auto fin = ntk.get_node(fi); !ntk.is_constant(fin))
{
ntk.foreach_fanout(fin,
[&ntk, &sibs, &n](const auto& fon)
{
// do not consider constants or n itself
if (!ntk.is_constant(fon) && (fon != n))
{
sibs.push_back(fon);
}
});
}
});

return sibs;
}

template <typename Ntk>
struct coloring_container
{
Expand All @@ -104,7 +75,7 @@ struct coloring_container

out_of_place_edge_color_view<Ntk> color_ntk;

const uint32_t color_null = 0ul, color_east, color_south;
uint32_t color_null = 0ul, color_east, color_south;

[[nodiscard]] uint32_t opposite_color(const uint32_t c) const noexcept
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@
#include <mockturtle/views/fanout_view.hpp>
#include <mockturtle/views/names_view.hpp>

#include <type_traits>

using namespace fiction;

template <typename Lyt, typename Ntk>
Expand Down

0 comments on commit b03282c

Please sign in to comment.