diff --git a/openfpga/src/repack/repack.cpp b/openfpga/src/repack/repack.cpp index 33c27937b..577dd00cd 100644 --- a/openfpga/src/repack/repack.cpp +++ b/openfpga/src/repack/repack.cpp @@ -258,7 +258,8 @@ static std::vector find_routed_pb_graph_pins_atom_net( * 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 - * - candidate can be limited to a set of pb pins + * - First-tier candidates are in the same port of the source pin + * - If nothing is found in first-tier, we find expand the range by considering all the pins in the same type that are available at the top-level pb_graph_node ***************************************************************************************/ static std::vector find_pb_route_by_atom_net( const t_pb* pb, const t_pb_graph_pin* source_pb_pin, @@ -267,6 +268,7 @@ static std::vector find_pb_route_by_atom_net( 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)) || @@ -277,12 +279,23 @@ static std::vector find_pb_route_by_atom_net( if (atom_net_id != pb->pb_route.at(pin).atom_net_id) { continue; } + candidate_pool.push_back(pin); + } + for (int pin : candidate_pool) { if (source_pb_pin->port == pb->pb_route.at(pin).pb_graph_pin->port) { pb_route_indices.push_back(pin); } } + if (pb_route_indices.empty()) { + for (int pin : candidate_pool) { + if (pb->pb_route.at(pin).pb_graph_pin->parent_node->is_root() && source_pb_pin->port->type == pb->pb_route.at(pin).pb_graph_pin->port->type) { + pb_route_indices.push_back(pin); + } + } + } + return pb_route_indices; } @@ -662,9 +675,12 @@ static void add_lb_router_nets( if (0 == pb_route_indices.size()) { VTR_LOGV(verbose, "Bypass routing due to no routing traces found\n"); continue; - } else { - VTR_ASSERT(1 == pb_route_indices.size()); + } else if (1 == pb_route_indices.size()) { pb_route_index = pb_route_indices[0]; + } else { + VTR_LOG_ERROR("Found %d routing traces for net \'%s\' in clustered block \'%s\'. Expect only 1.\n", + pb_route_indices.size(), atom_ctx.nlist.net_name(atom_net_id_to_route).c_str(), clustering_ctx.clb_nlist.block_name(block_id).c_str()); + VTR_ASSERT(1 == pb_route_indices.size()); } t_pb_graph_pin* packing_source_pb_pin = get_pb_graph_node_pin_from_block_pin(block_id, pb_route_index);