Skip to content

Commit ba95e7c

Browse files
committed
fixed issue with warning being thrown for short switch types.
1 parent c7b9ce0 commit ba95e7c

File tree

1 file changed

+13
-6
lines changed

1 file changed

+13
-6
lines changed

libs/librrgraph/src/utils/alloc_and_load_rr_indexed_data.cpp

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ static float get_delay_normalization_fac(const vtr::vector<RRIndexedDataId, t_rr
2929

3030
static void load_rr_indexed_data_T_values(const RRGraphView& rr_graph, vtr::vector<RRIndexedDataId, t_rr_indexed_data>& rr_indexed_data);
3131

32-
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<RRNodeId, std::vector<RREdgeId>>& fan_in_list);
32+
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<RRNodeId, std::vector<RREdgeId>>& fan_in_list);
3333

3434
static void fixup_rr_indexed_data_T_values(vtr::vector<RRIndexedDataId, t_rr_indexed_data>& rr_indexed_data, size_t num_segment);
3535

@@ -546,12 +546,15 @@ static void load_rr_indexed_data_T_values(const RRGraphView& rr_graph,
546546
double avg_switch_T = 0;
547547
double avg_switch_Cinternal = 0;
548548
int num_switches = 0;
549+
int num_shorts = 0;
549550
short buffered = UNDEFINED;
550-
calculate_average_switch(rr_graph, (size_t)rr_id, avg_switch_R, avg_switch_T, avg_switch_Cinternal, num_switches, buffered, fan_in_list);
551+
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);
551552

552553
if (num_switches == 0) {
553-
VTR_LOG_WARN("Node: %d with RR_type: %s at Location:%s, had no out-going switches\n", rr_id,
554-
rr_graph.node_type_string(rr_id), node_cords.c_str());
554+
if (num_shorts == 0) {
555+
VTR_LOG_WARN("Node: %d with RR_type: %s at Location:%s, had no out-going switches\n", rr_id,
556+
rr_graph.node_type_string(rr_id), node_cords.c_str());
557+
}
555558
continue;
556559
}
557560
VTR_ASSERT(num_switches > 0);
@@ -638,20 +641,24 @@ static void load_rr_indexed_data_T_values(const RRGraphView& rr_graph,
638641
* It is not safe to assume that each node of the same wire type has the same switches with the same
639642
* delays, therefore we take their average to take into account the possible differences
640643
*/
641-
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<RRNodeId, std::vector<RREdgeId>>& fan_in_list) {
644+
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<RRNodeId, std::vector<RREdgeId>>& fan_in_list) {
642645
auto node = RRNodeId(inode);
643646

644647
avg_switch_R = 0;
645648
avg_switch_T = 0;
646649
avg_switch_Cinternal = 0;
647650
num_switches = 0;
651+
num_shorts = 0;
648652
buffered = UNDEFINED;
649653
for (const auto& edge : fan_in_list[node]) {
650654
/* want to get C/R/Tdel/Cinternal of switches that connect this track segment to other track segments */
651655
if (rr_graph.node_type(node) == CHANX || rr_graph.node_type(node) == CHANY) {
652656
int switch_index = rr_graph.rr_nodes().edge_switch(edge);
653657

654-
if (rr_graph.rr_switch_inf(RRSwitchId(switch_index)).type() == SwitchType::SHORT) continue;
658+
if (rr_graph.rr_switch_inf(RRSwitchId(switch_index)).type() == SwitchType::SHORT) {
659+
num_shorts++;
660+
continue;
661+
}
655662

656663
avg_switch_R += rr_graph.rr_switch_inf(RRSwitchId(switch_index)).R;
657664
avg_switch_T += rr_graph.rr_switch_inf(RRSwitchId(switch_index)).Tdel;

0 commit comments

Comments
 (0)