@@ -1957,11 +1957,15 @@ void Router::timing_driven_expand_neighbours(t_heap* current,
1957
1957
// For each node associated with the current heap element, expand all of it's neighbors
1958
1958
int from_node_int = current->index ;
1959
1959
RRNodeId from_node (from_node_int);
1960
- int num_edges = rr_nodes_->num_edges (from_node);
1960
+ RREdgeId first_edge = rr_nodes_->first_edge (from_node);
1961
+ RREdgeId last_edge = rr_nodes_->last_edge (from_node);
1962
+ int num_edges = size_t (last_edge) - size_t (first_edge);
1961
1963
for (int iconn = 0 ; iconn < num_edges; iconn++) {
1962
- RRNodeId to_node = rr_nodes_->edge_sink_node (from_node, iconn);
1964
+ RREdgeId from_edge (size_t (first_edge) + iconn);
1965
+ RRNodeId to_node = rr_nodes_->edge_sink_node (from_edge);
1963
1966
timing_driven_expand_neighbour (current,
1964
1967
from_node_int,
1968
+ from_edge,
1965
1969
iconn,
1966
1970
size_t (to_node),
1967
1971
cost_params,
@@ -1976,7 +1980,8 @@ void Router::timing_driven_expand_neighbours(t_heap* current,
1976
1980
// to the heap.
1977
1981
void Router::timing_driven_expand_neighbour (t_heap* current,
1978
1982
const int from_node,
1979
- const t_edge_size from_edge,
1983
+ const RREdgeId from_edge,
1984
+ const t_edge_size from_edge_int,
1980
1985
const int to_node_int,
1981
1986
const t_conn_cost_params cost_params,
1982
1987
const t_bb bounding_box,
@@ -1996,7 +2001,7 @@ void Router::timing_driven_expand_neighbour(t_heap* current,
1996
2001
" Pruned expansion of node %d edge %d -> %d"
1997
2002
" (to node location %d,%dx%d,%d outside of expanded"
1998
2003
" net bounding box %d,%dx%d,%d)\n " ,
1999
- from_node, from_edge , to_node_int,
2004
+ from_node, from_edge_int , to_node_int,
2000
2005
to_xlow, to_ylow, to_xhigh, to_yhigh,
2001
2006
bounding_box.xmin , bounding_box.ymin , bounding_box.xmax , bounding_box.ymax );
2002
2007
return ; /* Node is outside (expanded) bounding box. */
@@ -2019,7 +2024,7 @@ void Router::timing_driven_expand_neighbour(t_heap* current,
2019
2024
" Pruned expansion of node %d edge %d -> %d"
2020
2025
" (to node is IPIN at %d,%dx%d,%d which does not"
2021
2026
" lead to target block %d,%dx%d,%d)\n " ,
2022
- from_node, from_edge , to_node_int,
2027
+ from_node, from_edge_int , to_node_int,
2023
2028
to_xlow, to_ylow, to_xhigh, to_yhigh,
2024
2029
target_bb.xmin , target_bb.ymin , target_bb.xmax , target_bb.ymax );
2025
2030
return ;
@@ -2028,13 +2033,14 @@ void Router::timing_driven_expand_neighbour(t_heap* current,
2028
2033
}
2029
2034
2030
2035
VTR_LOGV_DEBUG (f_router_debug, " Expanding node %d edge %d -> %d\n " ,
2031
- from_node, from_edge , to_node_int);
2036
+ from_node, from_edge_int , to_node_int);
2032
2037
2033
2038
timing_driven_add_to_heap (cost_params,
2034
2039
current,
2035
2040
from_node,
2036
2041
to_node_int,
2037
2042
from_edge,
2043
+ from_edge_int,
2038
2044
target_node);
2039
2045
}
2040
2046
@@ -2043,65 +2049,59 @@ void Router::timing_driven_add_to_heap(const t_conn_cost_params cost_params,
2043
2049
const t_heap* current,
2044
2050
const int from_node,
2045
2051
const int to_node,
2052
+ const RREdgeId from_edge,
2046
2053
const int iconn,
2047
2054
const int target_node) {
2048
- t_heap* next = alloc_heap_data ();
2049
- next->index = to_node;
2055
+ t_heap next;
2050
2056
2051
2057
// Costs initialized to current
2052
- next-> cost = std::numeric_limits<float >::infinity (); // Not used directly
2053
- next-> backward_path_cost = current->backward_path_cost ;
2054
- next-> R_upstream = current->R_upstream ;
2058
+ next. cost = std::numeric_limits<float >::infinity (); // Not used directly
2059
+ next. backward_path_cost = current->backward_path_cost ;
2060
+ next. R_upstream = current->R_upstream ;
2055
2061
2056
- timing_driven_expand_node (cost_params,
2057
- next, from_node, to_node, iconn, target_node);
2062
+
2063
+ VTR_LOGV_DEBUG (f_router_debug, " Expanding to node %d (%s)\n " , to_node, describe_rr_node (to_node).c_str ());
2064
+
2065
+ evaluate_timing_driven_node_costs (&next,
2066
+ cost_params,
2067
+ from_node,
2068
+ to_node,
2069
+ from_edge,
2070
+ target_node);
2058
2071
2059
2072
float best_total_cost = rr_node_route_inf_[to_node].path_cost ;
2060
2073
float best_back_cost = rr_node_route_inf_[to_node].backward_path_cost ;
2061
2074
2062
- float new_total_cost = next->cost ;
2063
- float new_back_cost = next->backward_path_cost ;
2064
-
2065
- VTR_ASSERT_SAFE (next->index == to_node);
2075
+ float new_total_cost = next.cost ;
2076
+ float new_back_cost = next.backward_path_cost ;
2066
2077
2067
2078
if (new_total_cost < best_total_cost && new_back_cost < best_back_cost) {
2068
2079
// Add node to the heap only if the cost via the current partial path is less than the
2069
2080
// best known cost, since there is no reason for the router to expand more expensive paths.
2070
2081
//
2071
2082
// Pre-heap prune to keep the heap small, by not putting paths which are known to be
2072
2083
// sub-optimal (at this point in time) into the heap.
2073
- add_to_heap (next);
2074
- ++router_stats_->heap_pushes ;
2075
- } else {
2076
- free_heap_data (next);
2077
- }
2078
- }
2084
+ t_heap* next_ptr = alloc_heap_data ();
2079
2085
2080
- // Updates current (path step and costs) to account for the step taken to reach to_node
2081
- void Router::timing_driven_expand_node (const t_conn_cost_params cost_params,
2082
- t_heap* current,
2083
- const int from_node,
2084
- const int to_node,
2085
- const int iconn,
2086
- const int target_node) {
2087
- VTR_LOGV_DEBUG (f_router_debug, " Expanding to node %d (%s)\n " , to_node, describe_rr_node (to_node).c_str ());
2086
+ // Record how we reached this node
2087
+ next_ptr->cost = next.cost ;
2088
+ next_ptr->R_upstream = next.R_upstream ;
2089
+ next_ptr->backward_path_cost = next.backward_path_cost ;
2090
+ next_ptr->index = to_node;
2091
+ next_ptr->u .prev .edge = iconn;
2092
+ next_ptr->u .prev .node = from_node;
2088
2093
2089
- evaluate_timing_driven_node_costs (current,
2090
- cost_params,
2091
- from_node, to_node, iconn, target_node);
2092
-
2093
- // Record how we reached this node
2094
- current->index = to_node;
2095
- current->u .prev .edge = iconn;
2096
- current->u .prev .node = from_node;
2094
+ add_to_heap (next_ptr);
2095
+ ++router_stats_->heap_pushes ;
2096
+ }
2097
2097
}
2098
2098
2099
2099
// Calculates the cost of reaching to_node
2100
2100
void Router::evaluate_timing_driven_node_costs (t_heap* to,
2101
2101
const t_conn_cost_params cost_params,
2102
2102
const int from_node,
2103
2103
const int to_node,
2104
- const int iconn ,
2104
+ const RREdgeId from_edge ,
2105
2105
const int target_node) {
2106
2106
/* new_costs.backward_cost: is the "known" part of the cost to this node -- the
2107
2107
* congestion cost of all the routing resources back to the existing route
@@ -2113,7 +2113,7 @@ void Router::evaluate_timing_driven_node_costs(t_heap* to,
2113
2113
*/
2114
2114
2115
2115
// Info for the switch connecting from_node to_node
2116
- int iswitch = rr_nodes_->edge_switch (RRNodeId (from_node), iconn );
2116
+ int iswitch = rr_nodes_->edge_switch (from_edge );
2117
2117
bool switch_buffered = rr_switch_inf_[iswitch].buffered ();
2118
2118
bool reached_configurably = rr_switch_inf_[iswitch].configurable ();
2119
2119
float switch_R = rr_switch_inf_[iswitch].R ;
0 commit comments