diff --git a/libs/librrgraph/src/utils/alloc_and_load_rr_indexed_data.cpp b/libs/librrgraph/src/utils/alloc_and_load_rr_indexed_data.cpp index 6e99f099d58..1cfdba42f92 100644 --- a/libs/librrgraph/src/utils/alloc_and_load_rr_indexed_data.cpp +++ b/libs/librrgraph/src/utils/alloc_and_load_rr_indexed_data.cpp @@ -29,7 +29,7 @@ static float get_delay_normalization_fac(const vtr::vector& rr_indexed_data); -static void calculate_average_switch(const RRGraphView& rr_graph, int inode, double& avg_switch_R, double& avg_switch_T, double& avg_switch_Cinternal, int& num_switches, short& buffered, vtr::vector>& fan_in_list); +static void calculate_average_switch(const RRGraphView& rr_graph, int inode, double& avg_switch_R, double& avg_switch_T, double& avg_switch_Cinternal, int& num_switches, int& num_shorts, short& buffered, vtr::vector>& fan_in_list); static void fixup_rr_indexed_data_T_values(vtr::vector& rr_indexed_data, size_t num_segment); @@ -541,15 +541,18 @@ static void load_rr_indexed_data_T_values(const RRGraphView& rr_graph, double avg_switch_T = 0; double avg_switch_Cinternal = 0; int num_switches = 0; + int num_shorts = 0; short buffered = UNDEFINED; - calculate_average_switch(rr_graph, (size_t)rr_id, avg_switch_R, avg_switch_T, avg_switch_Cinternal, num_switches, buffered, fan_in_list); + calculate_average_switch(rr_graph, (size_t)rr_id, avg_switch_R, avg_switch_T, avg_switch_Cinternal, num_switches, num_shorts, buffered, fan_in_list); if (num_switches == 0) { - VTR_LOG_WARN("Node: %d with RR_type: %s at Location:%s, had no incoming switches\n", rr_id, - rr_graph.node_type_string(rr_id), node_cords.c_str()); + if (num_shorts == 0) { + VTR_LOG_WARN("Node: %d with RR_type: %s at Location:%s, had no out-going switches\n", rr_id, + rr_graph.node_type_string(rr_id), node_cords.c_str()); + } continue; - } - VTR_ASSERT(num_switches > 0); + } + VTR_ASSERT(num_switches > 0 || num_shorts > 0); num_nodes_of_index[cost_index]++; C_total[cost_index].push_back(rr_graph.node_C(rr_id)); @@ -633,20 +636,24 @@ static void load_rr_indexed_data_T_values(const RRGraphView& rr_graph, * It is not safe to assume that each node of the same wire type has the same switches with the same * delays, therefore we take their average to take into account the possible differences */ -static void calculate_average_switch(const RRGraphView& rr_graph, int inode, double& avg_switch_R, double& avg_switch_T, double& avg_switch_Cinternal, int& num_switches, short& buffered, vtr::vector>& fan_in_list) { +static void calculate_average_switch(const RRGraphView& rr_graph, int inode, double& avg_switch_R, double& avg_switch_T, double& avg_switch_Cinternal, int& num_switches, int& num_shorts, short& buffered, vtr::vector>& fan_in_list) { auto node = RRNodeId(inode); avg_switch_R = 0; avg_switch_T = 0; avg_switch_Cinternal = 0; num_switches = 0; + num_shorts = 0; buffered = UNDEFINED; for (const auto& edge : fan_in_list[node]) { /* want to get C/R/Tdel/Cinternal of switches that connect this track segment to other track segments */ if (rr_graph.node_type(node) == CHANX || rr_graph.node_type(node) == CHANY) { int switch_index = rr_graph.rr_nodes().edge_switch(edge); - if (rr_graph.rr_switch_inf(RRSwitchId(switch_index)).type() == SwitchType::SHORT) continue; + if (rr_graph.rr_switch_inf(RRSwitchId(switch_index)).type() == SwitchType::SHORT) { + num_shorts++; + continue; + } avg_switch_R += rr_graph.rr_switch_inf(RRSwitchId(switch_index)).R; avg_switch_T += rr_graph.rr_switch_inf(RRSwitchId(switch_index)).Tdel;