Skip to content

Commit c90ac0d

Browse files
authored
Merge pull request #2713 from byuccl/fix_short_warn
fixed issue with warning being thrown for short switch types
2 parents b8c1ef1 + 694e76d commit c90ac0d

File tree

1 file changed

+15
-8
lines changed

1 file changed

+15
-8
lines changed

libs/librrgraph/src/utils/alloc_and_load_rr_indexed_data.cpp

Lines changed: 15 additions & 8 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

@@ -541,15 +541,18 @@ static void load_rr_indexed_data_T_values(const RRGraphView& rr_graph,
541541
double avg_switch_T = 0;
542542
double avg_switch_Cinternal = 0;
543543
int num_switches = 0;
544+
int num_shorts = 0;
544545
short buffered = UNDEFINED;
545-
calculate_average_switch(rr_graph, (size_t)rr_id, avg_switch_R, avg_switch_T, avg_switch_Cinternal, num_switches, buffered, fan_in_list);
546+
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);
546547

547548
if (num_switches == 0) {
548-
VTR_LOG_WARN("Node: %d with RR_type: %s at Location:%s, had no incoming switches\n", rr_id,
549-
rr_graph.node_type_string(rr_id), node_cords.c_str());
549+
if (num_shorts == 0) {
550+
VTR_LOG_WARN("Node: %d with RR_type: %s at Location:%s, had no out-going switches\n", rr_id,
551+
rr_graph.node_type_string(rr_id), node_cords.c_str());
552+
}
550553
continue;
551-
}
552-
VTR_ASSERT(num_switches > 0);
554+
}
555+
VTR_ASSERT(num_switches > 0 || num_shorts > 0);
553556

554557
num_nodes_of_index[cost_index]++;
555558
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,
633636
* It is not safe to assume that each node of the same wire type has the same switches with the same
634637
* delays, therefore we take their average to take into account the possible differences
635638
*/
636-
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) {
639+
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) {
637640
auto node = RRNodeId(inode);
638641

639642
avg_switch_R = 0;
640643
avg_switch_T = 0;
641644
avg_switch_Cinternal = 0;
642645
num_switches = 0;
646+
num_shorts = 0;
643647
buffered = UNDEFINED;
644648
for (const auto& edge : fan_in_list[node]) {
645649
/* want to get C/R/Tdel/Cinternal of switches that connect this track segment to other track segments */
646650
if (rr_graph.node_type(node) == CHANX || rr_graph.node_type(node) == CHANY) {
647651
int switch_index = rr_graph.rr_nodes().edge_switch(edge);
648652

649-
if (rr_graph.rr_switch_inf(RRSwitchId(switch_index)).type() == SwitchType::SHORT) continue;
653+
if (rr_graph.rr_switch_inf(RRSwitchId(switch_index)).type() == SwitchType::SHORT) {
654+
num_shorts++;
655+
continue;
656+
}
650657

651658
avg_switch_R += rr_graph.rr_switch_inf(RRSwitchId(switch_index)).R;
652659
avg_switch_T += rr_graph.rr_switch_inf(RRSwitchId(switch_index)).Tdel;

0 commit comments

Comments
 (0)