From f9cd01636d004b6dfc91f9a67aa8cf088cc29564 Mon Sep 17 00:00:00 2001 From: tangxifan Date: Fri, 31 May 2024 17:57:36 -0700 Subject: [PATCH] [core] fixed the bug where there is only 1 routing trace for a net which should be ignored (due to treated as global). This net should not be ignored unless there are >1 routing traces on the top-level pb. Then we can merge one. --- openfpga/src/repack/repack.cpp | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/openfpga/src/repack/repack.cpp b/openfpga/src/repack/repack.cpp index 0d3ad48fc..c12e3a596 100644 --- a/openfpga/src/repack/repack.cpp +++ b/openfpga/src/repack/repack.cpp @@ -304,6 +304,33 @@ static std::vector find_pb_route_by_atom_net( return pb_route_indices; } +/*************************************************************************************** + * This function will find the actual routing traces of the demanded net + * There is a specific search space applied when searching the routing traces: + * - ONLY applicable to the pb_pin of top-level pb_graph_node + ***************************************************************************************/ +static std::vector find_pb_routes_by_atom_net_among_top_pb_pins( + const t_pb* pb, const AtomNetId& atom_net_id) { + std::vector pb_route_indices; + + std::vector candidate_pool; + for (int pin = 0; pin < pb->pb_graph_node->total_pb_pins; ++pin) { + /* Bypass unused pins */ + if ((0 == pb->pb_route.count(pin)) || + (AtomNetId::INVALID() == pb->pb_route.at(pin).atom_net_id)) { + continue; + } + /* Get the driver pb pin id, it must be valid */ + if (atom_net_id != pb->pb_route.at(pin).atom_net_id) { + continue; + } + if (pb->pb_route.at(pin).pb_graph_pin->parent_node->is_root()) { + candidate_pool.push_back(pin); + } + } + return candidate_pool; +} + /*************************************************************************************** * This function will find the actual routing traces of the demanded net * There is a specific search space applied when searching the routing traces: @@ -584,7 +611,6 @@ static void add_lb_router_nets( std::string(lb_type->pb_type->name), curr_pin))) { /* Find the net mapped to this pin in clustering results*/ AtomNetId atom_net_id = pb_pin_mapped_nets[source_pb_pin]; - std::vector pb_route_indices = find_pb_route_by_atom_net(pb, source_pb_pin, atom_net_id); VTR_ASSERT(1 == pb_route_indices.size()); @@ -641,6 +667,7 @@ static void add_lb_router_nets( BasicPort curr_pin(std::string(source_pb_pin->port->name), source_pb_pin->pin_number, source_pb_pin->pin_number); if ((ignored_atom_nets[atom_net_id]) && + (find_pb_routes_by_atom_net_among_top_pb_pins(pb, atom_net_id).size() > 1) && (options.is_pin_ignore_global_nets(std::string(lb_type->pb_type->name), curr_pin))) { VTR_LOGV(verbose, "Skip net '%s' as it is global and set to be ignored\n", atom_ctx.nlist.net_name(atom_net_id).c_str());