51
51
#include " old_traceback.h"
52
52
53
53
/* ************Functions local to this module*************/
54
- static void process_route (std::ifstream& fp, const char * filename, int & lineno);
55
- static void process_nodes (std::ifstream& fp, ClusterNetId inet, const char * filename, int & lineno);
56
- static void process_nets (std::ifstream& fp, ClusterNetId inet, std::string name, std::vector<std::string> input_tokens, const char * filename, int & lineno);
57
- static void process_global_blocks (std::ifstream& fp, ClusterNetId inet, const char * filename, int & lineno);
54
+ static void process_route (const Netlist<>& net_list, std::ifstream& fp, const char * filename, int & lineno, bool is_flat );
55
+ static void process_nodes (const Netlist<>& net_list, std::ifstream& fp, ClusterNetId inet, const char * filename, int & lineno);
56
+ static void process_nets (const Netlist<>& net_list, std::ifstream& fp, ClusterNetId inet, std::string name, std::vector<std::string> input_tokens, const char * filename, int & lineno, bool is_flat );
57
+ static void process_global_blocks (const Netlist<>& net_list, std::ifstream& fp, ClusterNetId inet, const char * filename, int & lineno, bool is_flat );
58
58
static void format_coordinates (int & layer_num, int & x, int & y, std::string coord, ClusterNetId net, const char * filename, const int lineno);
59
59
static void format_pin_info (std::string& pb_name, std::string& port_name, int & pb_pin_num, std::string input);
60
60
static std::string format_name (std::string name);
@@ -69,7 +69,7 @@ void print_route(const Netlist<>& net_list, FILE* fp, bool is_flat);
69
69
* Perform a series of verification tests to ensure the netlist,
70
70
* placement, and routing files match
71
71
*/
72
- bool read_route (const char * route_file, const t_router_opts& router_opts, bool verify_file_digests) {
72
+ bool read_route (const char * route_file, const t_router_opts& router_opts, bool verify_file_digests, bool is_flat ) {
73
73
auto & device_ctx = g_vpr_ctx.mutable_device ();
74
74
auto & place_ctx = g_vpr_ctx.placement ();
75
75
bool flat_router = router_opts.flat_routing ;
@@ -124,7 +124,7 @@ bool read_route(const char* route_file, const t_router_opts& router_opts, bool v
124
124
}
125
125
126
126
/* Read in every net */
127
- process_route (fp, route_file, lineno);
127
+ process_route (router_net_list, fp, route_file, lineno, is_flat );
128
128
129
129
fp.close ();
130
130
@@ -157,7 +157,7 @@ bool read_route(const char* route_file, const t_router_opts& router_opts, bool v
157
157
}
158
158
159
159
// /@brief Walks through every net and add the routing appropriately
160
- static void process_route (std::ifstream& fp, const char * filename, int & lineno) {
160
+ static void process_route (const Netlist<>& net_list, std::ifstream& fp, const char * filename, int & lineno, bool is_flat ) {
161
161
std::string input;
162
162
std::vector<std::string> tokens;
163
163
while (std::getline (fp, input)) {
@@ -170,59 +170,55 @@ static void process_route(std::ifstream& fp, const char* filename, int& lineno)
170
170
continue ; // Skip commented lines
171
171
} else if (tokens[0 ] == " Net" ) {
172
172
ClusterNetId inet (atoi (tokens[1 ].c_str ()));
173
- process_nets (fp, inet, tokens[2 ], tokens, filename, lineno);
173
+ process_nets (net_list, fp, inet, tokens[2 ], tokens, filename, lineno, is_flat );
174
174
}
175
175
}
176
176
177
177
tokens.clear ();
178
178
}
179
179
180
180
// /@brief Check if the net is global or not, and process appropriately
181
- static void process_nets (std::ifstream& fp, ClusterNetId inet, std::string name, std::vector<std::string> input_tokens, const char * filename, int & lineno) {
182
- auto & cluster_ctx = g_vpr_ctx.mutable_clustering ();
183
-
181
+ static void process_nets (const Netlist<>& net_list, std::ifstream& fp, ClusterNetId inet, std::string name, std::vector<std::string> input_tokens, const char * filename, int & lineno, bool is_flat) {
184
182
if (input_tokens.size () > 3 && input_tokens[3 ] == " global"
185
183
&& input_tokens[4 ] == " net" && input_tokens[5 ] == " connecting:" ) {
186
184
/* Global net. Never routed. */
187
- if (!cluster_ctx. clb_nlist .net_is_ignored (inet)) {
185
+ if (!net_list .net_is_ignored (inet)) {
188
186
vpr_throw (VPR_ERROR_ROUTE, filename, lineno,
189
187
" Net %lu should be a global net" , size_t (inet));
190
188
}
191
189
/* erase an extra colon for global nets*/
192
190
name.erase (name.end () - 1 );
193
191
name = format_name (name);
194
192
195
- if (0 != cluster_ctx. clb_nlist .net_name (inet).compare (name)) {
193
+ if (0 != net_list .net_name (inet).compare (name)) {
196
194
vpr_throw (VPR_ERROR_ROUTE, filename, lineno,
197
- " Net name %s for net number %lu specified in the routing file does not match given %s" ,
198
- name.c_str (), size_t (inet), cluster_ctx. clb_nlist .net_name (inet).c_str ());
195
+ " Net name %s for net number %lu specified in the routing file does not match given %s. Running without flat routing; if this file was created with flat routing, re-run vpr with the --flat_routing option " ,
196
+ name.c_str (), size_t (inet), net_list .net_name (inet).c_str ());
199
197
}
200
198
201
- process_global_blocks (fp, inet, filename, lineno);
199
+ process_global_blocks (net_list, fp, inet, filename, lineno, is_flat );
202
200
} else {
203
201
/* Not a global net */
204
- if (cluster_ctx. clb_nlist .net_is_ignored (inet)) {
205
- VTR_LOG_WARN (" Net %lu (%s) is marked as global in the netlist, but is non-global in the .route file\n " , size_t (inet), cluster_ctx. clb_nlist .net_name (inet).c_str ());
202
+ if (net_list .net_is_ignored (inet)) {
203
+ VTR_LOG_WARN (" Net %lu (%s) is marked as global in the netlist, but is non-global in the .route file\n " , size_t (inet), net_list .net_name (inet).c_str ());
206
204
}
207
205
208
206
name = format_name (name);
209
207
210
- if (0 != cluster_ctx. clb_nlist .net_name (inet).compare (name)) {
208
+ if (0 != net_list .net_name (inet).compare (name)) {
211
209
vpr_throw (VPR_ERROR_ROUTE, filename, lineno,
212
- " Net name %s for net number %lu specified in the routing file does not match given %s" ,
213
- name.c_str (), size_t (inet), cluster_ctx. clb_nlist .net_name (inet).c_str ());
210
+ " Net name %s for net number %lu specified in the routing file does not match given %s. Running without flat routing; if this file was created with flat routing, re-run vpr with the --flat_routing option " ,
211
+ name.c_str (), size_t (inet), net_list .net_name (inet).c_str ());
214
212
}
215
213
216
- process_nodes (fp, inet, filename, lineno);
214
+ process_nodes (net_list, fp, inet, filename, lineno);
217
215
}
218
216
input_tokens.clear ();
219
217
return ;
220
218
}
221
219
222
- static void process_nodes (std::ifstream& fp, ClusterNetId inet, const char * filename, int & lineno) {
220
+ static void process_nodes (const Netlist<>& net_list, std::ifstream& fp, ClusterNetId inet, const char * filename, int & lineno) {
223
221
/* Not a global net. Goes through every node and add it into trace.head*/
224
-
225
- auto & cluster_ctx = g_vpr_ctx.mutable_clustering ();
226
222
auto & device_ctx = g_vpr_ctx.mutable_device ();
227
223
const auto & rr_graph = device_ctx.rr_graph ;
228
224
auto & route_ctx = g_vpr_ctx.mutable_routing ();
@@ -257,7 +253,7 @@ static void process_nodes(std::ifstream& fp, ClusterNetId inet, const char* file
257
253
fp.seekg (oldpos);
258
254
break ;
259
255
} else if (input == " \n\n Used in local cluster only, reserved one CLB pin\n\n " ) {
260
- if (cluster_ctx. clb_nlist .net_sinks (inet).size () != 0 ) {
256
+ if (net_list .net_sinks (inet).size () != 0 ) {
261
257
vpr_throw (VPR_ERROR_ROUTE, filename, lineno,
262
258
" Net %d should be used in local cluster only, reserved one CLB pin" );
263
259
}
@@ -327,7 +323,7 @@ static void process_nodes(std::ifstream& fp, ClusterNetId inet, const char* file
327
323
ptc = atoi (tokens[5 + offset].c_str ());
328
324
if (rr_graph.node_ptc_num (RRNodeId (inode)) != ptc) {
329
325
vpr_throw (VPR_ERROR_ROUTE, filename, lineno,
330
- " The ptc num of node %d does not match the rr graph" , inode);
326
+ " The ptc num of node %d does not match the rr graph, Running without flat routing; if this file was created with flat routing, re-run vpr with the --flat_routing option " , inode);
331
327
}
332
328
333
329
/* Process switches and pb pin info if it is ipin or opin type*/
@@ -336,17 +332,25 @@ static void process_nodes(std::ifstream& fp, ClusterNetId inet, const char* file
336
332
auto type = device_ctx.grid .get_physical_type ({x, y, layer_num});
337
333
if (!is_io_type (type) && (tokens[2 ] == " IPIN" || tokens[2 ] == " OPIN" )) {
338
334
int pin_num = rr_graph.node_pin_num (RRNodeId (inode));
339
-
335
+ int width_offset = device_ctx. grid . get_width_offset ({x, y, layer_num});
340
336
int height_offset = device_ctx.grid .get_height_offset ({x, y, layer_num});
337
+ auto physical_tile = device_ctx.grid .get_physical_type ({x, y, layer_num});
338
+ const t_sub_tile* sub_tile;
339
+ int sub_tile_rel_cap;
340
+ std::tie (sub_tile, sub_tile_rel_cap) = get_sub_tile_from_pin_physical_num (physical_tile, pin_num);
341
+ int sub_tile_offset = sub_tile->capacity .low + sub_tile_rel_cap;
341
342
342
- int capacity, relative_pin ;
343
- std::tie (capacity, relative_pin) = get_capacity_location_from_physical_pin (type, pin_num );
343
+ ClusterBlockId iblock = place_ctx. grid_blocks . block_at_location ({x - width_offset, y - height_offset, sub_tile_offset, layer_num}) ;
344
+ VTR_ASSERT (iblock );
344
345
345
- ClusterBlockId iblock = place_ctx. grid_blocks . block_at_location ({x, y - height_offset, capacity, layer_num}) ;
346
+ const t_pb_graph_pin* pb_pin ;
346
347
347
- t_pb_graph_pin* pb_pin;
348
+ if (is_pin_on_tile (physical_tile, pin_num)) {
349
+ pb_pin = get_pb_graph_node_pin_from_block_pin (iblock, pin_num);
350
+ } else {
351
+ pb_pin = get_pb_pin_from_pin_physical_num (physical_tile, pin_num);
352
+ }
348
353
349
- pb_pin = get_pb_graph_node_pin_from_block_pin (iblock, pin_num);
350
354
t_pb_type* pb_type = pb_pin->parent_node ->pb_type ;
351
355
352
356
std::string pb_name, port_name;
@@ -415,14 +419,10 @@ static void process_nodes(std::ifstream& fp, ClusterNetId inet, const char* file
415
419
* @brief This function goes through all the blocks in a global net and verify
416
420
* it with the clustered netlist and the placement
417
421
*/
418
- static void process_global_blocks (std::ifstream& fp, ClusterNetId inet, const char * filename, int & lineno) {
419
- auto & cluster_ctx = g_vpr_ctx.mutable_clustering ();
420
- auto & place_ctx = g_vpr_ctx.placement ();
421
-
422
+ static void process_global_blocks (const Netlist<>& net_list, std::ifstream& fp, ClusterNetId inet, const char * filename, int & lineno, bool is_flat) {
422
423
std::string block, bnum_str;
423
424
int layer_num, x, y;
424
425
std::vector<std::string> tokens;
425
- int pin_counter = 0 ;
426
426
427
427
std::streampos oldpos = fp.tellg ();
428
428
/* Walk through every block line*/
@@ -446,27 +446,29 @@ static void process_global_blocks(std::ifstream& fp, ClusterNetId inet, const ch
446
446
bnum_str = format_name (tokens[2 ]);
447
447
/* remove #*/
448
448
bnum_str.erase (bnum_str.begin ());
449
- ClusterBlockId bnum (atoi (bnum_str.c_str ()));
449
+ ParentBlockId bnum (atoi (bnum_str.c_str ()));
450
450
451
451
/* Check for name, coordinate, and pins*/
452
- if (0 != cluster_ctx. clb_nlist .block_name (bnum).compare (tokens[1 ])) {
452
+ if (0 != net_list .block_name (bnum).compare (tokens[1 ])) {
453
453
vpr_throw (VPR_ERROR_ROUTE, filename, lineno,
454
454
" Block %s for block number %lu specified in the routing file does not match given %s" ,
455
- tokens[1 ].c_str (), size_t (bnum), cluster_ctx. clb_nlist .block_name (bnum).c_str ());
455
+ tokens[1 ].c_str (), size_t (bnum), net_list .block_name (bnum).c_str ());
456
456
}
457
- if (place_ctx.block_locs [bnum].loc .x != x || place_ctx.block_locs [bnum].loc .y != y) {
457
+
458
+ auto block_loc = get_block_loc (bnum, is_flat);
459
+
460
+ if (block_loc.loc .x != x || block_loc.loc .y != y) {
458
461
vpr_throw (VPR_ERROR_ROUTE, filename, lineno,
459
462
" The placement coordinates (%d, %d) of %d block does not match given (%d, %d)" ,
460
- x, y, place_ctx. block_locs [bnum]. loc .x , place_ctx. block_locs [bnum] .loc .y );
463
+ x, y, block_loc. loc .x , block_loc .loc .y );
461
464
}
462
465
463
- int pin_index = net_pin_to_tile_pin_index (inet, pin_counter );
464
- if (physical_tile_type (bnum)-> pin_class [pin_index] != atoi (tokens[7 ].c_str ())) {
466
+ auto pin_class = get_class_range_for_block (bnum, is_flat );
467
+ if (pin_class. low > atoi (tokens[ 7 ]. c_str ()) || pin_class. high < atoi (tokens[7 ].c_str ())) {
465
468
vpr_throw (VPR_ERROR_ROUTE, filename, lineno,
466
469
" The pin class %d of %lu net does not match given " ,
467
- atoi (tokens[7 ].c_str ()), size_t (inet), physical_tile_type (bnum)-> pin_class [pin_index] );
470
+ atoi (tokens[7 ].c_str ()), size_t (inet));
468
471
}
469
- pin_counter++;
470
472
}
471
473
oldpos = fp.tellg ();
472
474
}
0 commit comments