4848 * @param fp The file stream to read from.
4949 * @param filename The name of the file to read from.
5050 * @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.
5252 * @param is_flat Whether flat-router is enabled.
5353 */
5454static void process_route (const Netlist<>& net_list,
5555 std::ifstream& fp,
5656 const char * filename,
5757 int & lineno,
58- bool verify_route_file_switch_id ,
58+ bool verify_route_file_switch_id,
5959 bool is_flat);
6060
6161/* *
@@ -65,13 +65,13 @@ static void process_route(const Netlist<>& net_list,
6565 * @param fp The file stream to read from.
6666 * @param inet The net ID to process.
6767 * @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.
6969 */
7070static void process_nodes (const Netlist<>& net_list,
7171 std::ifstream& fp,
7272 ClusterNetId inet,
7373 const char * filename,
74- bool verify_route_file_switch_id ,
74+ bool verify_route_file_switch_id,
7575 int & lineno);
7676
7777/* *
@@ -84,7 +84,7 @@ static void process_nodes(const Netlist<>& net_list,
8484 * @param input_tokens The tokens of the net.
8585 * @param filename The name of the file to read from.
8686 * @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.
8888 * @param is_flat Whether flat-router is enabled.
8989 */
9090static void process_nets (const Netlist<>& net_list,
@@ -94,16 +94,9 @@ static void process_nets(const Netlist<>& net_list,
9494 std::vector<std::string> input_tokens,
9595 const char * filename,
9696 int & lineno,
97- bool verify_route_file_switch_id ,
97+ bool verify_route_file_switch_id,
9898 bool is_flat);
9999
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-
107100/* *
108101 * @brief This function goes through all the blocks in a global net and verify
109102 * it with the clustered netlist and the placement
@@ -203,7 +196,7 @@ bool read_route(const char* route_file,
203196 }
204197
205198 /* 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);
207200
208201 fp.close ();
209202
@@ -239,7 +232,7 @@ static void process_route(const Netlist<>& net_list,
239232 std::ifstream& fp,
240233 const char * filename,
241234 int & lineno,
242- bool verify_route_file_switch_id ,
235+ bool verify_route_file_switch_id,
243236 bool is_flat) {
244237 std::string input;
245238 std::vector<std::string> tokens;
@@ -260,7 +253,7 @@ static void process_route(const Netlist<>& net_list,
260253 tokens,
261254 filename,
262255 lineno,
263- verify_route_file_switch_id ,
256+ verify_route_file_switch_id,
264257 is_flat);
265258 }
266259 }
@@ -275,7 +268,7 @@ static void process_nets(const Netlist<>& net_list,
275268 std::vector<std::string> input_tokens,
276269 const char * filename,
277270 int & lineno,
278- bool verify_route_file_switch_id ,
271+ bool verify_route_file_switch_id,
279272 bool is_flat) {
280273 if (input_tokens.size () > 3 && input_tokens[3 ] == " global"
281274 && input_tokens[4 ] == " net" && input_tokens[5 ] == " connecting:" ) {
@@ -313,7 +306,7 @@ static void process_nets(const Netlist<>& net_list,
313306 fp,
314307 inet,
315308 filename,
316- verify_route_file_switch_id ,
309+ verify_route_file_switch_id,
317310 lineno);
318311 }
319312 input_tokens.clear ();
@@ -323,7 +316,7 @@ static void process_nodes(const Netlist<>& net_list,
323316 std::ifstream& fp,
324317 ClusterNetId inet,
325318 const char * filename,
326- bool verify_route_file_switch_id ,
319+ bool verify_route_file_switch_id,
327320 int & lineno) {
328321 /* Not a global net. Goes through every node and add it into trace.head*/
329322 auto & device_ctx = g_vpr_ctx.mutable_device ();
@@ -516,66 +509,13 @@ static void process_nodes(const Netlist<>& net_list,
516509 oldpos = fp.tellg ();
517510 }
518511
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));
524513
525514 /* Convert to route_tree after reading */
526515 route_ctx.route_trees [inet] = TracebackCompat::traceback_to_route_tree (head_ptr);
527516 free_traceback (head_ptr);
528517}
529518
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-
579519static void process_global_blocks (const Netlist<>& net_list, std::ifstream& fp, ClusterNetId inet, const char * filename, int & lineno, bool is_flat) {
580520 std::string block, bnum_str;
581521 int layer_num, x, y;
0 commit comments