Skip to content

Commit

Permalink
substitute po signals
Browse files Browse the repository at this point in the history
  • Loading branch information
simon1hofmann committed Nov 7, 2023
1 parent 0e15b05 commit 4d77573
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 2 deletions.
7 changes: 5 additions & 2 deletions include/fiction/algorithms/physical_design/orthogonal.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -394,8 +394,11 @@ class orthogonal_impl
{
// measure run time
mockturtle::stopwatch stop{pst.time_total};
ntk.substitute_po_signals();
mockturtle::topo_view ntk_topo{ntk};

// compute a coloring
const auto ctn = east_south_edge_coloring(ntk);
const auto ctn = east_south_edge_coloring(ntk_topo);

mockturtle::node_map<mockturtle::signal<Lyt>, decltype(ctn.color_ntk)> node2pos{ctn.color_ntk};

Expand Down Expand Up @@ -598,7 +601,7 @@ class orthogonal_impl
}

private:
mockturtle::topo_view<mockturtle::fanout_view<mockturtle::names_view<technology_network>>> ntk;
mockturtle::fanout_view<mockturtle::names_view<technology_network>> ntk;

orthogonal_physical_design_params ps;
orthogonal_physical_design_stats& pst;
Expand Down
31 changes: 31 additions & 0 deletions test/networks/technology_network.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
#include <kitty/operations.hpp>
#include <kitty/operators.hpp>
#include <mockturtle/networks/sequential.hpp>
#include <mockturtle/views/topo_view.hpp>

#include <vector>

Expand Down Expand Up @@ -823,3 +824,33 @@ TEST_CASE("substitute PO signals", "[technology-network]")
CHECK(tec.fanout_size(i) == 2);
CHECK(tec.fanout_size(b) == 1);
}

TEST_CASE("substitute PO signals corner case", "[technology-network]")
{
technology_network tec{};

const auto x1 = tec.create_pi();
const auto x2 = tec.create_pi();

const auto a = tec.create_and(x1, x2);

tec.create_po(a);
tec.create_po(a);

CHECK(tec.size() == 5);
CHECK(tec.is_po(a));
CHECK(tec.fanout_size(a) == 2);

tec.substitute_po_signals();
mockturtle::topo_view tec_topo{tec};

CHECK(tec.size() == 7);
CHECK(!tec_topo.is_po(a));
CHECK(tec_topo.fanout_size(a) == 2);

std::vector<uint64_t> nodes{};
tec_topo.foreach_node([&](const auto& node) { nodes.push_back(node); });

tec_topo.foreach_po([&](const auto& gate)
{ CHECK(std::find(nodes.begin(), nodes.end(), tec_topo.get_node(gate)) != nodes.end()); });
}

0 comments on commit 4d77573

Please sign in to comment.