Skip to content

Commit c078262

Browse files
committed
[vpr][route] add all route tree nodes if no node from the target layer is added to the heap
1 parent 1cebe67 commit c078262

File tree

1 file changed

+16
-10
lines changed

1 file changed

+16
-10
lines changed

vpr/src/route/connection_router.cpp

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -379,12 +379,11 @@ void ConnectionRouter<Heap>::timing_driven_expand_cheapest(t_heap* cheapest,
379379
VTR_LOGV_DEBUG(router_debug_, " Better cost to %d\n", inode);
380380
VTR_LOGV_DEBUG(router_debug_, " New total cost: %g\n", new_total_cost);
381381
VTR_LOGV_DEBUG(router_debug_, " New back cost: %g\n", new_back_cost);
382-
VTR_LOGV_DEBUG(router_debug_ && (rr_nodes_.node_type(RRNodeId(cheapest->index)) != t_rr_type::SOURCE) &&
383-
(rr_nodes_.node_type(RRNodeId(cheapest->index)) != t_rr_type::OPIN),
384-
" Setting path costs for associated node %d (from %d edge %zu)\n",
385-
cheapest->index,
386-
static_cast<size_t>(rr_graph_->edge_src_node(cheapest->prev_edge())),
387-
static_cast<size_t>(cheapest->prev_edge()));
382+
VTR_LOGV_DEBUG(router_debug_ && (cheapest->prev_edge() != RREdgeId::INVALID()),
383+
" Setting path costs for associated node %d (from %d edge %zu)\n",
384+
cheapest->index,
385+
static_cast<size_t>(rr_graph_->edge_src_node(cheapest->prev_edge())),
386+
static_cast<size_t>(cheapest->prev_edge()));
388387

389388
update_cheapest(cheapest, route_inf);
390389

@@ -979,19 +978,22 @@ t_bb ConnectionRouter<Heap>::add_high_fanout_route_tree_to_heap(
979978
int target_bin_x = grid_to_bin_x(rr_graph_->node_xlow(target_node), spatial_rt_lookup);
980979
int target_bin_y = grid_to_bin_y(rr_graph_->node_ylow(target_node), spatial_rt_lookup);
981980

981+
auto target_layer = rr_graph_->node_layer(target_node);
982+
982983
int chan_nodes_added = 0;
983984

984985
t_bb highfanout_bb;
985986
highfanout_bb.xmin = rr_graph_->node_xlow(target_node);
986987
highfanout_bb.xmax = rr_graph_->node_xhigh(target_node);
987988
highfanout_bb.ymin = rr_graph_->node_ylow(target_node);
988989
highfanout_bb.ymax = rr_graph_->node_yhigh(target_node);
989-
highfanout_bb.layer_min = rr_graph_->node_layer(target_node);
990-
highfanout_bb.layer_max = rr_graph_->node_layer(target_node);
990+
highfanout_bb.layer_min = target_layer;
991+
highfanout_bb.layer_max = target_layer;
991992

992993
//Add existing routing starting from the target bin.
993994
//If the target's bin has insufficient existing routing add from the surrounding bins
994995
bool done = false;
996+
bool found_node_on_same_layer = false;
995997
for (int dx : {0, -1, +1}) {
996998
size_t bin_x = target_bin_x + dx;
997999

@@ -1017,6 +1019,10 @@ t_bb ConnectionRouter<Heap>::add_high_fanout_route_tree_to_heap(
10171019
if (!inside_bb(rr_node_to_add, net_bounding_box))
10181020
continue;
10191021

1022+
auto rt_node_layer_num = rr_graph_->node_layer(rr_node_to_add);
1023+
if (rt_node_layer_num == target_layer)
1024+
found_node_on_same_layer = true;
1025+
10201026
// Put the node onto the heap
10211027
add_route_tree_node_to_heap(rt_node, target_node, cost_params, net_bounding_box);
10221028

@@ -1029,7 +1035,7 @@ t_bb ConnectionRouter<Heap>::add_high_fanout_route_tree_to_heap(
10291035
}
10301036

10311037
constexpr int SINGLE_BIN_MIN_NODES = 2;
1032-
if (dx == 0 && dy == 0 && chan_nodes_added > SINGLE_BIN_MIN_NODES) {
1038+
if (dx == 0 && dy == 0 && chan_nodes_added > SINGLE_BIN_MIN_NODES && found_node_on_same_layer) {
10331039
//Target bin contained at least minimum amount of routing
10341040
//
10351041
//We require at least SINGLE_BIN_MIN_NODES to be added.
@@ -1043,7 +1049,7 @@ t_bb ConnectionRouter<Heap>::add_high_fanout_route_tree_to_heap(
10431049
if (done) break;
10441050
}
10451051

1046-
if (chan_nodes_added == 0) { //If the target bin, and it's surrounding bins were empty, just add the full route tree
1052+
if (chan_nodes_added == 0 || !found_node_on_same_layer) { //If the target bin, and it's surrounding bins were empty, just add the full route tree
10471053
add_route_tree_to_heap(rt_root, target_node, cost_params, net_bounding_box);
10481054
return net_bounding_box;
10491055
} else {

0 commit comments

Comments
 (0)