48
48
* @param fp The file stream to read from.
49
49
* @param filename The name of the file to read from.
50
50
* @param lineno The line number currently being processed.
51
- * @param verify_route_file_switch_id Whether to verify the RR switch IDs in the routing file.
51
+ * @param verify_route_file_switch_id Whether to verify the RR switch IDs in the routing file.
52
52
* @param is_flat Whether flat-router is enabled.
53
53
*/
54
54
static void process_route (const Netlist<>& net_list,
55
55
std::ifstream& fp,
56
56
const char * filename,
57
57
int & lineno,
58
- bool verify_route_file_switch_id ,
58
+ bool verify_route_file_switch_id,
59
59
bool is_flat);
60
60
61
61
/* *
@@ -65,13 +65,13 @@ static void process_route(const Netlist<>& net_list,
65
65
* @param fp The file stream to read from.
66
66
* @param inet The net ID to process.
67
67
* @param filename The name of the file to read from.
68
- * @param verify_route_file_switch_id Whether to verify the RR switch IDs in the routing file.
68
+ * @param verify_route_file_switch_id Whether to verify the RR switch IDs in the routing file.
69
69
*/
70
70
static void process_nodes (const Netlist<>& net_list,
71
71
std::ifstream& fp,
72
72
ClusterNetId inet,
73
73
const char * filename,
74
- bool verify_route_file_switch_id ,
74
+ bool verify_route_file_switch_id,
75
75
int & lineno);
76
76
77
77
/* *
@@ -84,7 +84,7 @@ static void process_nodes(const Netlist<>& net_list,
84
84
* @param input_tokens The tokens of the net.
85
85
* @param filename The name of the file to read from.
86
86
* @param lineno The line number currently being processed.
87
- * @param verify_route_file_switch_id Whether to verify the RR switch IDs in the routing file.
87
+ * @param verify_route_file_switch_id Whether to verify the RR switch IDs in the routing file.
88
88
* @param is_flat Whether flat-router is enabled.
89
89
*/
90
90
static void process_nets (const Netlist<>& net_list,
@@ -94,16 +94,9 @@ static void process_nets(const Netlist<>& net_list,
94
94
std::vector<std::string> input_tokens,
95
95
const char * filename,
96
96
int & lineno,
97
- bool verify_route_file_switch_id ,
97
+ bool verify_route_file_switch_id,
98
98
bool is_flat);
99
99
100
- /* *
101
- * @brief Update the switch IDs in the routing trace to match the RR Graph.
102
- *
103
- * @param trace Pointer to the head of the routing trace of the net to update.
104
- */
105
- static void update_rr_switch_id (t_trace* trace);
106
-
107
100
/* *
108
101
* @brief This function goes through all the blocks in a global net and verify
109
102
* it with the clustered netlist and the placement
@@ -203,7 +196,7 @@ bool read_route(const char* route_file,
203
196
}
204
197
205
198
/* Read in every net */
206
- process_route (router_net_list, fp, route_file, lineno, router_opts.verify_route_file_switch_id , is_flat);
199
+ process_route (router_net_list, fp, route_file, lineno, router_opts.verify_route_file_switch_id , is_flat);
207
200
208
201
fp.close ();
209
202
@@ -239,7 +232,7 @@ static void process_route(const Netlist<>& net_list,
239
232
std::ifstream& fp,
240
233
const char * filename,
241
234
int & lineno,
242
- bool verify_route_file_switch_id ,
235
+ bool verify_route_file_switch_id,
243
236
bool is_flat) {
244
237
std::string input;
245
238
std::vector<std::string> tokens;
@@ -260,7 +253,7 @@ static void process_route(const Netlist<>& net_list,
260
253
tokens,
261
254
filename,
262
255
lineno,
263
- verify_route_file_switch_id ,
256
+ verify_route_file_switch_id,
264
257
is_flat);
265
258
}
266
259
}
@@ -275,7 +268,7 @@ static void process_nets(const Netlist<>& net_list,
275
268
std::vector<std::string> input_tokens,
276
269
const char * filename,
277
270
int & lineno,
278
- bool verify_route_file_switch_id ,
271
+ bool verify_route_file_switch_id,
279
272
bool is_flat) {
280
273
if (input_tokens.size () > 3 && input_tokens[3 ] == " global"
281
274
&& input_tokens[4 ] == " net" && input_tokens[5 ] == " connecting:" ) {
@@ -313,7 +306,7 @@ static void process_nets(const Netlist<>& net_list,
313
306
fp,
314
307
inet,
315
308
filename,
316
- verify_route_file_switch_id ,
309
+ verify_route_file_switch_id,
317
310
lineno);
318
311
}
319
312
input_tokens.clear ();
@@ -323,7 +316,7 @@ static void process_nodes(const Netlist<>& net_list,
323
316
std::ifstream& fp,
324
317
ClusterNetId inet,
325
318
const char * filename,
326
- bool verify_route_file_switch_id ,
319
+ bool verify_route_file_switch_id,
327
320
int & lineno) {
328
321
/* Not a global net. Goes through every node and add it into trace.head*/
329
322
auto & device_ctx = g_vpr_ctx.mutable_device ();
@@ -516,66 +509,13 @@ static void process_nodes(const Netlist<>& net_list,
516
509
oldpos = fp.tellg ();
517
510
}
518
511
519
- if (verify_route_file_switch_id ) {
520
- VTR_ASSERT (validate_traceback (head_ptr));
521
- } else {
522
- update_rr_switch_id (head_ptr);
523
- }
512
+ VTR_ASSERT (validate_and_update_traceback (head_ptr, verify_route_file_switch_id));
524
513
525
514
/* Convert to route_tree after reading */
526
515
route_ctx.route_trees [inet] = TracebackCompat::traceback_to_route_tree (head_ptr);
527
516
free_traceback (head_ptr);
528
517
}
529
518
530
- static void update_rr_switch_id (t_trace* trace) {
531
- if (trace == nullptr ) {
532
- return ;
533
- }
534
-
535
- std::set<int > seen_rr_nodes;
536
-
537
- std::stack<t_trace*> trace_stack;
538
- trace_stack.push (trace);
539
-
540
-
541
- while (!trace_stack.empty ()) {
542
- trace = trace_stack.top ();
543
- trace_stack.pop ();
544
- seen_rr_nodes.insert (trace->index );
545
- t_trace* next = trace->next ;
546
-
547
- if (next == nullptr ) {
548
- continue ;
549
- }
550
-
551
- if (trace->iswitch == OPEN) { // End of a branch
552
- // Verify that the next element (branch point) has been already seen in the traceback so far
553
- if (!seen_rr_nodes.count (next->index )) {
554
- VPR_FATAL_ERROR (VPR_ERROR_ROUTE, " Traceback branch point %d not found" , next->index );
555
- }
556
- } else { // Midway along branch
557
- // Check there is an edge connecting trace and next
558
- const auto & rr_graph = g_vpr_ctx.device ().rr_graph ;
559
- bool found = false ;
560
- for (t_edge_size iedge = 0 ; iedge < rr_graph.num_edges (RRNodeId (trace->index )); ++iedge) {
561
- int to_node = size_t (rr_graph.edge_sink_node (RRNodeId (trace->index ), iedge));
562
- if (to_node == next->index ) {
563
- found = true ;
564
-
565
- // Verify that the switch matches
566
- int rr_iswitch = rr_graph.edge_switch (RRNodeId (trace->index ), iedge);
567
- trace->iswitch = rr_iswitch;
568
- break ;
569
- }
570
- }
571
- if (!found) {
572
- VPR_FATAL_ERROR (VPR_ERROR_ROUTE, " Traceback no RR edge between RR nodes %d -> %d\n " , trace->index , next->index );
573
- }
574
- }
575
- trace_stack.push (next);
576
- }
577
- }
578
-
579
519
static void process_global_blocks (const Netlist<>& net_list, std::ifstream& fp, ClusterNetId inet, const char * filename, int & lineno, bool is_flat) {
580
520
std::string block, bnum_str;
581
521
int layer_num, x, y;
0 commit comments