Skip to content

Commit 4ed0868

Browse files
committed
[vpr][route][crr] remove redundant if
1 parent b07a8bd commit 4ed0868

File tree

1 file changed

+33
-31
lines changed

1 file changed

+33
-31
lines changed

vpr/src/route/rr_graph_generation/tileable_rr_graph/crr_generator/crr_connection_builder.cpp

Lines changed: 33 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -89,38 +89,40 @@ void CRRConnectionBuilder::build_connections_for_location(size_t x,
8989
for (size_t col_idx = NUM_EMPTY_COLS; col_idx < df->cols(); ++col_idx) {
9090
const Cell& cell = df->at(row_idx, col_idx);
9191

92-
if (!cell.is_empty()) {
93-
auto source_it = source_nodes.find(row_idx);
94-
auto sink_it = sink_nodes.find(col_idx);
95-
96-
if (source_it != source_nodes.end() && sink_it != sink_nodes.end()) {
97-
RRNodeId source_node = source_it->second;
98-
e_rr_type source_node_type = rr_graph_.node_type(source_node);
99-
RRNodeId sink_node = sink_it->second;
100-
e_rr_type sink_node_type = rr_graph_.node_type(sink_node);
101-
std::string sw_template_id = sw_block_file_name + "_" + std::to_string(row_idx) + "_" + std::to_string(col_idx);
102-
// If the source node is an IPIN, then it should be considered as
103-
// a sink of the connection.
104-
if (source_node_type == e_rr_type::IPIN) {
105-
int delay_ps = get_connection_delay_ps(cell.as_string(),
106-
rr_node_typename[source_node_type],
107-
sink_node,
108-
source_node);
109-
110-
tile_connections.emplace_back(source_node, sink_node, delay_ps, sw_template_id);
111-
} else {
112-
int segment_length = -1;
113-
if (sink_node_type == e_rr_type::CHANX || sink_node_type == e_rr_type::CHANY) {
114-
segment_length = rr_graph_.node_length(sink_node);
115-
}
116-
int delay_ps = get_connection_delay_ps(cell.as_string(),
117-
rr_node_typename[sink_node_type],
118-
source_node,
119-
sink_node,
120-
segment_length);
121-
122-
tile_connections.emplace_back(sink_node, source_node, delay_ps, sw_template_id);
92+
if (cell.is_empty()) {
93+
continue;
94+
}
95+
96+
auto source_it = source_nodes.find(row_idx);
97+
auto sink_it = sink_nodes.find(col_idx);
98+
99+
if (source_it != source_nodes.end() && sink_it != sink_nodes.end()) {
100+
RRNodeId source_node = source_it->second;
101+
e_rr_type source_node_type = rr_graph_.node_type(source_node);
102+
RRNodeId sink_node = sink_it->second;
103+
e_rr_type sink_node_type = rr_graph_.node_type(sink_node);
104+
std::string sw_template_id = sw_block_file_name + "_" + std::to_string(row_idx) + "_" + std::to_string(col_idx);
105+
// If the source node is an IPIN, then it should be considered as
106+
// a sink of the connection.
107+
if (source_node_type == e_rr_type::IPIN) {
108+
int delay_ps = get_connection_delay_ps(cell.as_string(),
109+
rr_node_typename[source_node_type],
110+
sink_node,
111+
source_node);
112+
113+
tile_connections.emplace_back(source_node, sink_node, delay_ps, sw_template_id);
114+
} else {
115+
int segment_length = -1;
116+
if (sink_node_type == e_rr_type::CHANX || sink_node_type == e_rr_type::CHANY) {
117+
segment_length = rr_graph_.node_length(sink_node);
123118
}
119+
int delay_ps = get_connection_delay_ps(cell.as_string(),
120+
rr_node_typename[sink_node_type],
121+
source_node,
122+
sink_node,
123+
segment_length);
124+
125+
tile_connections.emplace_back(sink_node, source_node, delay_ps, sw_template_id);
124126
}
125127
}
126128
}

0 commit comments

Comments
 (0)