@@ -139,16 +139,18 @@ void load_rr_file(const t_graph_type graph_type,
139
139
int max_chan_width = (is_global_graph ? 1 : nodes_per_chan.max );
140
140
VTR_ASSERT (max_chan_width > 0 );
141
141
142
- /* Loads edges, switches, and node look up tables*/
143
- next_component = get_single_child (rr_graph, " switches" , loc_data);
144
-
145
- int numSwitches = count_children (next_component, " switch" , loc_data);
146
- device_ctx.rr_switch_inf .resize (numSwitches);
147
-
148
- process_switches (next_component, loc_data);
149
142
/* Branches to binary format */
150
143
next_component = get_single_child (rr_graph, " binary_nodes_and_edges" , loc_data, OPTIONAL);
151
144
if (next_component) {
145
+ /* Loads edges, switches, and node look up tables*/
146
+ next_component = get_single_child (rr_graph, " switches" , loc_data);
147
+
148
+ int numSwitches = count_children (next_component, " switch" , loc_data);
149
+ device_ctx.rr_switch_inf .resize (numSwitches);
150
+
151
+ process_switches (next_component, loc_data);
152
+
153
+ next_component = get_single_child (rr_graph, " binary_nodes_and_edges" , loc_data, OPTIONAL);
152
154
auto filename = get_attribute (next_component, " file" , loc_data).as_string (" " );
153
155
VTR_LOG (" Using Binary File: %s\n " , filename);
154
156
FILE* fp = fopen (filename, " rb" );
@@ -164,35 +166,49 @@ void load_rr_file(const t_graph_type graph_type,
164
166
alloc_and_load_rr_indexed_data (segment_inf, device_ctx.rr_node_indices ,
165
167
max_chan_width, *wire_to_rr_ipin_switch, base_cost_type);
166
168
167
- } else {
168
- /* Alloc rr nodes and count count nodes */
169
- next_component = get_single_child (rr_graph, " rr_nodes" , loc_data);
169
+ device_ctx.chan_width = nodes_per_chan;
170
+ device_ctx.read_rr_graph_filename = std::string (read_rr_graph_name);
170
171
171
- int num_rr_nodes = count_children (next_component, " node " , loc_data );
172
+ check_rr_graph (graph_type, grid, device_ctx. physical_tile_types );
172
173
173
- device_ctx. rr_nodes . resize (num_rr_nodes) ;
174
- process_nodes (next_component, loc_data);
174
+ return ;
175
+ }
175
176
176
- next_component = get_single_child (rr_graph, " rr_edges " , loc_data);
177
- process_edges (next_component, loc_data, wire_to_rr_ipin_switch, numSwitches );
177
+ /* Alloc rr nodes and count count nodes */
178
+ next_component = get_single_child (rr_graph, " rr_nodes " , loc_data );
178
179
179
- // Partition the rr graph edges for efficient access to configurable/non-configurable
180
- // edge subsets. Must be done after RR switches have been allocated
181
- partition_rr_graph_edges (device_ctx);
180
+ int num_rr_nodes = count_children (next_component, " node" , loc_data);
182
181
183
- process_rr_node_indices (grid);
182
+ device_ctx.rr_nodes .resize (num_rr_nodes);
183
+ process_nodes (next_component, loc_data);
184
184
185
- init_fan_in (device_ctx.rr_nodes , device_ctx.rr_nodes .size ());
185
+ /* Loads edges, switches, and node look up tables*/
186
+ next_component = get_single_child (rr_graph, " switches" , loc_data);
186
187
187
- // sets the cost index and seg id information
188
- next_component = get_single_child (rr_graph, " rr_nodes" , loc_data);
189
- set_cost_indices (next_component, loc_data, is_global_graph, segment_inf.size ());
188
+ int numSwitches = count_children (next_component, " switch" , loc_data);
189
+ device_ctx.rr_switch_inf .resize (numSwitches);
190
190
191
- alloc_and_load_rr_indexed_data (segment_inf, device_ctx.rr_node_indices ,
192
- max_chan_width, *wire_to_rr_ipin_switch, base_cost_type);
191
+ process_switches (next_component, loc_data);
193
192
194
- process_seg_id (next_component, loc_data);
195
- }
193
+ next_component = get_single_child (rr_graph, " rr_edges" , loc_data);
194
+ process_edges (next_component, loc_data, wire_to_rr_ipin_switch, numSwitches);
195
+
196
+ // Partition the rr graph edges for efficient access to configurable/non-configurable
197
+ // edge subsets. Must be done after RR switches have been allocated
198
+ partition_rr_graph_edges (device_ctx);
199
+
200
+ process_rr_node_indices (grid);
201
+
202
+ init_fan_in (device_ctx.rr_nodes , device_ctx.rr_nodes .size ());
203
+
204
+ // sets the cost index and seg id information
205
+ next_component = get_single_child (rr_graph, " rr_nodes" , loc_data);
206
+ set_cost_indices (next_component, loc_data, is_global_graph, segment_inf.size ());
207
+
208
+ alloc_and_load_rr_indexed_data (segment_inf, device_ctx.rr_node_indices ,
209
+ max_chan_width, *wire_to_rr_ipin_switch, base_cost_type);
210
+
211
+ process_seg_id (next_component, loc_data);
196
212
197
213
device_ctx.chan_width = nodes_per_chan;
198
214
device_ctx.read_rr_graph_filename = std::string (read_rr_graph_name);
@@ -204,6 +220,33 @@ void load_rr_file(const t_graph_type graph_type,
204
220
}
205
221
}
206
222
223
+ /* This function sets the Source pins, sink pins, ipin, and opin
224
+ * to their unique cost index identifier. CHANX and CHANY cost indicies are set after the
225
+ * seg_id is read in from the rr graph */
226
+ void set_cost_index_bin (int inode, t_rr_type node_type, const bool is_global_graph, const int num_seg_types, short seg_id) {
227
+ auto & device_ctx = g_vpr_ctx.mutable_device ();
228
+ auto & node = device_ctx.rr_nodes [inode];
229
+ // set the cost index in order to load the segment information, rr nodes should be set already
230
+ if (node_type == SOURCE) {
231
+ node.set_cost_index (SOURCE_COST_INDEX);
232
+ } else if (node_type == SINK) {
233
+ node.set_cost_index (SINK_COST_INDEX);
234
+ } else if (node_type == IPIN) {
235
+ node.set_cost_index (IPIN_COST_INDEX);
236
+ } else if (node_type == OPIN) {
237
+ node.set_cost_index (OPIN_COST_INDEX);
238
+ } else if (node_type == CHANX || node_type == CHANY) {
239
+ /* CHANX and CHANY cost index is dependent on the segment id*/
240
+ if (is_global_graph) {
241
+ node.set_cost_index (0 );
242
+ } else if (device_ctx.rr_nodes [inode].type () == CHANX) {
243
+ node.set_cost_index (CHANX_COST_INDEX_START + seg_id);
244
+ } else if (device_ctx.rr_nodes [inode].type () == CHANY) {
245
+ node.set_cost_index (CHANX_COST_INDEX_START + num_seg_types + seg_id);
246
+ }
247
+ }
248
+ }
249
+
207
250
void process_nodes_and_switches_bin (FILE* fp,
208
251
int * wire_to_rr_ipin_switch,
209
252
bool is_global_graph,
@@ -1002,30 +1045,3 @@ void set_cost_indices(pugi::xml_node parent, const pugiutil::loc_data& loc_data,
1002
1045
rr_node = rr_node.next_sibling (rr_node.name ());
1003
1046
}
1004
1047
}
1005
-
1006
- /* This function sets the Source pins, sink pins, ipin, and opin
1007
- * to their unique cost index identifier. CHANX and CHANY cost indicies are set after the
1008
- * seg_id is read in from the rr graph */
1009
- void set_cost_index_bin (int inode, t_rr_type node_type, const bool is_global_graph, const int num_seg_types, short seg_id) {
1010
- auto & device_ctx = g_vpr_ctx.mutable_device ();
1011
- auto & node = device_ctx.rr_nodes [inode];
1012
- // set the cost index in order to load the segment information, rr nodes should be set already
1013
- if (node_type == SOURCE) {
1014
- node.set_cost_index (SOURCE_COST_INDEX);
1015
- } else if (node_type == SINK) {
1016
- node.set_cost_index (SINK_COST_INDEX);
1017
- } else if (node_type == IPIN) {
1018
- node.set_cost_index (IPIN_COST_INDEX);
1019
- } else if (node_type == OPIN) {
1020
- node.set_cost_index (OPIN_COST_INDEX);
1021
- } else if (node_type == CHANX || node_type == CHANY) {
1022
- /* CHANX and CHANY cost index is dependent on the segment id*/
1023
- if (is_global_graph) {
1024
- node.set_cost_index (0 );
1025
- } else if (device_ctx.rr_nodes [inode].type () == CHANX) {
1026
- node.set_cost_index (CHANX_COST_INDEX_START + seg_id);
1027
- } else if (device_ctx.rr_nodes [inode].type () == CHANY) {
1028
- node.set_cost_index (CHANX_COST_INDEX_START + num_seg_types + seg_id);
1029
- }
1030
- }
1031
- }
0 commit comments