@@ -964,16 +964,21 @@ void ConnectionRouter<Heap>::add_route_tree_node_to_heap(
964
964
}
965
965
}
966
966
967
- static t_bb adjust_highfanout_bounding_box (t_bb highfanout_bb) {
968
- t_bb bb = highfanout_bb;
967
+ /* Expand bb by inode's extents and clip against net_bb */
968
+ inline void expand_highfanout_bounding_box (t_bb& bb, const t_bb& net_bb, RRNodeId inode, const RRGraphView* rr_graph) {
969
+ bb.xmin = std::max<int >(net_bb.xmin , std::min<int >(bb.xmin , rr_graph->node_xlow (inode)));
970
+ bb.ymin = std::max<int >(net_bb.ymin , std::min<int >(bb.ymin , rr_graph->node_ylow (inode)));
971
+ bb.xmax = std::min<int >(net_bb.xmax , std::max<int >(bb.xmax , rr_graph->node_xhigh (inode)));
972
+ bb.ymax = std::min<int >(net_bb.ymax , std::max<int >(bb.ymax , rr_graph->node_yhigh (inode)));
973
+ }
969
974
975
+ /* Expand bb by HIGH_FANOUT_BB_FAC and clip against net_bb */
976
+ inline void adjust_highfanout_bounding_box (t_bb& bb, const t_bb& net_bb) {
970
977
constexpr int HIGH_FANOUT_BB_FAC = 3 ;
971
- bb.xmin -= HIGH_FANOUT_BB_FAC;
972
- bb.ymin -= HIGH_FANOUT_BB_FAC;
973
- bb.xmax += HIGH_FANOUT_BB_FAC;
974
- bb.ymax += HIGH_FANOUT_BB_FAC;
975
-
976
- return bb;
978
+ bb.xmin = std::max<int >(net_bb.xmin , bb.xmin - HIGH_FANOUT_BB_FAC);
979
+ bb.ymin = std::max<int >(net_bb.ymin , bb.ymin - HIGH_FANOUT_BB_FAC);
980
+ bb.xmax = std::min<int >(net_bb.xmax , bb.xmax + HIGH_FANOUT_BB_FAC);
981
+ bb.ymax = std::min<int >(net_bb.ymax , bb.ymax + HIGH_FANOUT_BB_FAC);
977
982
}
978
983
979
984
template <typename Heap>
@@ -1032,11 +1037,8 @@ t_bb ConnectionRouter<Heap>::add_high_fanout_route_tree_to_heap(
1032
1037
// Put the node onto the heap
1033
1038
add_route_tree_node_to_heap (rt_node, target_node, cost_params, true );
1034
1039
1035
- // Update Bounding Box
1036
- highfanout_bb.xmin = std::min<int >(highfanout_bb.xmin , rr_graph_->node_xlow (rr_node_to_add));
1037
- highfanout_bb.ymin = std::min<int >(highfanout_bb.ymin , rr_graph_->node_ylow (rr_node_to_add));
1038
- highfanout_bb.xmax = std::max<int >(highfanout_bb.xmax , rr_graph_->node_xhigh (rr_node_to_add));
1039
- highfanout_bb.ymax = std::max<int >(highfanout_bb.ymax , rr_graph_->node_yhigh (rr_node_to_add));
1040
+ // Expand HF BB to include the node (clip by original BB)
1041
+ expand_highfanout_bounding_box (highfanout_bb, net_bounding_box, rr_node_to_add, rr_graph_);
1040
1042
if (is_flat_) {
1041
1043
if (rr_graph_->node_type (rr_node_to_add) == CHANY || rr_graph_->node_type (rr_node_to_add) == CHANX) {
1042
1044
chan_nodes_added++;
@@ -1062,15 +1064,14 @@ t_bb ConnectionRouter<Heap>::add_high_fanout_route_tree_to_heap(
1062
1064
if (done) break ;
1063
1065
}
1064
1066
1065
- t_bb bounding_box = net_bounding_box;
1066
1067
if (nodes_added == 0 ) { // If the target bin, and it's surrounding bins were empty, just add the full route tree
1067
1068
add_route_tree_to_heap (rt_root, target_node, cost_params, true );
1069
+ return net_bounding_box;
1068
1070
} else {
1069
1071
// We found nearby routing, replace original bounding box to be localized around that routing
1070
- bounding_box = adjust_highfanout_bounding_box (highfanout_bb);
1072
+ adjust_highfanout_bounding_box (highfanout_bb, net_bounding_box);
1073
+ return highfanout_bb;
1071
1074
}
1072
-
1073
- return bounding_box;
1074
1075
}
1075
1076
1076
1077
std::unique_ptr<ConnectionRouterInterface> make_connection_router (e_heap_type heap_type,
0 commit comments