@@ -96,38 +96,41 @@ void CRRConnectionBuilder::build_connections_for_location(size_t x,
9696 auto source_it = source_nodes.find (row_idx);
9797 auto sink_it = sink_nodes.find (col_idx);
9898
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);
118- }
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);
99+ if (source_it == source_nodes.end () || sink_it == sink_nodes.end ()) {
100+ continue ;
101+ }
102+
103+ RRNodeId source_node = source_it->second ;
104+ e_rr_type source_node_type = rr_graph_.node_type (source_node);
105+ RRNodeId sink_node = sink_it->second ;
106+ e_rr_type sink_node_type = rr_graph_.node_type (sink_node);
107+ std::string sw_template_id = sw_block_file_name + " _" + std::to_string (row_idx) + " _" + std::to_string (col_idx);
108+ // If the source node is an IPIN, then it should be considered as
109+ // a sink of the connection.
110+ if (source_node_type == e_rr_type::IPIN) {
111+ int delay_ps = get_connection_delay_ps (cell.as_string (),
112+ rr_node_typename[source_node_type],
113+ sink_node,
114+ source_node);
115+
116+ tile_connections.emplace_back (source_node, sink_node, delay_ps, sw_template_id);
117+ } else {
118+ int segment_length = -1 ;
119+ if (sink_node_type == e_rr_type::CHANX || sink_node_type == e_rr_type::CHANY) {
120+ segment_length = rr_graph_.node_length (sink_node);
126121 }
122+ int delay_ps = get_connection_delay_ps (cell.as_string (),
123+ rr_node_typename[sink_node_type],
124+ source_node,
125+ sink_node,
126+ segment_length);
127+
128+ tile_connections.emplace_back (sink_node, source_node, delay_ps, sw_template_id);
127129 }
128130 }
129131 }
130132
133+ // Uniqueify the connections
131134 std::sort (tile_connections.begin (), tile_connections.end ());
132135 tile_connections.erase (std::unique (tile_connections.begin (),
133136 tile_connections.end ()),
@@ -157,8 +160,11 @@ std::map<size_t, RRNodeId> CRRConnectionBuilder::get_tile_source_nodes(int x,
157160
158161 for (size_t row = NUM_EMPTY_ROWS; row < df.rows (); ++row) {
159162 SegmentInfo info = parse_segment_info (df, row, true );
160- RRNodeId node_id;
163+ if (!info.is_valid ()) {
164+ continue ;
165+ }
161166
167+ RRNodeId node_id;
162168 if (info.side == e_sw_template_dir::IPIN || info.side == e_sw_template_dir::OPIN) {
163169 node_id = process_opin_ipin_node (info, x, y, node_lookup);
164170 } else if (info.side == e_sw_template_dir::LEFT || info.side == e_sw_template_dir::RIGHT || info.side == e_sw_template_dir::TOP || info.side == e_sw_template_dir::BOTTOM) {
@@ -189,7 +195,7 @@ std::map<size_t, RRNodeId> CRRConnectionBuilder::get_tile_sink_nodes(int x,
189195
190196 for (size_t col = NUM_EMPTY_COLS; col < df.cols (); ++col) {
191197 SegmentInfo info = parse_segment_info (df, col, false );
192- if (info.side == e_sw_template_dir::NUM_SIDES ) {
198+ if (! info.is_valid () ) {
193199 continue ;
194200 }
195201 RRNodeId node_id;
0 commit comments