@@ -86,7 +86,7 @@ static int num_linked_f_pointer_allocated = 0;
8686 * */
8787
8888/* ******************* Subroutines local to route_common.c *******************/
89- static t_trace_branch traceback_branch (int node, int target_pin , std::unordered_set<int >& main_branch_visited);
89+ static t_trace_branch traceback_branch (int node, int target_net_pin_index , std::unordered_set<int >& main_branch_visited);
9090static std::pair<t_trace*, t_trace*> add_trace_non_configurable (t_trace* head, t_trace* tail, int node, std::unordered_set<int >& visited);
9191static std::pair<t_trace*, t_trace*> add_trace_non_configurable_recurr (int node, std::unordered_set<int >& visited, int depth = 0 );
9292
@@ -494,26 +494,28 @@ void init_route_structs(int bb_factor) {
494494 route_ctx.net_status .resize (cluster_ctx.clb_nlist .nets ().size ());
495495}
496496
497- t_trace* update_traceback (t_heap* hptr, int target_pin, ClusterNetId net_id) {
498- /* This routine adds the most recently finished wire segment to the *
499- * traceback linked list. The first connection starts with the net SOURCE *
500- * and begins at the structure pointed to by route_ctx.trace[net_id].head. *
501- * Each connection ends with a SINK. After each SINK, the next connection *
502- * begins (if the net has more than 2 pins). The first element after the *
503- * SINK gives the routing node on a previous piece of the routing, which is *
504- * the link from the existing net to this new piece of the net. *
505- * In each traceback I start at the end of a path and trace back through *
506- * its predecessors to the beginning. I have stored information on the *
507- * predecesser of each node to make traceback easy -- this sacrificies some *
508- * memory for easier code maintenance. This routine returns a pointer to *
509- * the first "new" node in the traceback (node not previously in trace). */
497+ /* This routine adds the most recently finished wire segment to the *
498+ * traceback linked list. The first connection starts with the net SOURCE *
499+ * and begins at the structure pointed to by route_ctx.trace[net_id].head. *
500+ * Each connection ends with a SINK. After each SINK, the next connection *
501+ * begins (if the net has more than 2 pins). The first element after the *
502+ * SINK gives the routing node on a previous piece of the routing, which is *
503+ * the link from the existing net to this new piece of the net. *
504+ * In each traceback I start at the end of a path, which is a SINK with *
505+ * target_net_pin_index (net pin index corresponding to the SINK, ranging *
506+ * from 1 to fanout), and trace back through its predecessors to the *
507+ * beginning. I have stored information on the predecesser of each node to *
508+ * make traceback easy -- this sacrificies some memory for easier code *
509+ * maintenance. This routine returns a pointer to the first "new" node in *
510+ * the traceback (node not previously in trace). */
511+ t_trace* update_traceback (t_heap* hptr, int target_net_pin_index, ClusterNetId net_id) {
510512 auto & route_ctx = g_vpr_ctx.mutable_routing ();
511513
512514 auto & trace_nodes = route_ctx.trace_nodes [net_id];
513515
514516 VTR_ASSERT_SAFE (validate_trace_nodes (route_ctx.trace [net_id].head , trace_nodes));
515517
516- t_trace_branch branch = traceback_branch (hptr->index , target_pin , trace_nodes);
518+ t_trace_branch branch = traceback_branch (hptr->index , target_net_pin_index , trace_nodes);
517519
518520 VTR_ASSERT_SAFE (validate_trace_nodes (branch.head , trace_nodes));
519521
@@ -530,9 +532,10 @@ t_trace* update_traceback(t_heap* hptr, int target_pin, ClusterNetId net_id) {
530532 return (ret_ptr);
531533}
532534
533- // Traces back a new routing branch starting from the specified 'node' and working backwards to any existing routing.
535+ // Traces back a new routing branch starting from the specified SINK 'node' with target_net_pin_index, which is the
536+ // net pin index corresponding to the SINK (ranging from 1 to fanout), and working backwards to any existing routing.
534537// Returns the new branch, and also updates trace_nodes for any new nodes which are included in the branches traceback.
535- static t_trace_branch traceback_branch (int node, int target_pin , std::unordered_set<int >& trace_nodes) {
538+ static t_trace_branch traceback_branch (int node, int target_net_pin_index , std::unordered_set<int >& trace_nodes) {
536539 auto & device_ctx = g_vpr_ctx.device ();
537540 auto & route_ctx = g_vpr_ctx.routing ();
538541
@@ -547,7 +550,7 @@ static t_trace_branch traceback_branch(int node, int target_pin, std::unordered_
547550 t_trace* branch_head = alloc_trace_data ();
548551 t_trace* branch_tail = branch_head;
549552 branch_head->index = node;
550- branch_head->ipin = target_pin;
553+ branch_head->net_pin_index = target_net_pin_index; // The first node is the SINK node, so store its net pin index
551554 branch_head->iswitch = OPEN;
552555 branch_head->next = nullptr ;
553556
@@ -562,7 +565,7 @@ static t_trace_branch traceback_branch(int node, int target_pin, std::unordered_
562565 // Add the current node to the head of traceback
563566 t_trace* prev_ptr = alloc_trace_data ();
564567 prev_ptr->index = inode;
565- prev_ptr->ipin = OPEN;
568+ prev_ptr->net_pin_index = OPEN; // Net pin index is invalid for Non-SINK nodes
566569 prev_ptr->iswitch = device_ctx.rr_nodes .edge_switch (iedge);
567570 prev_ptr->next = branch_head;
568571 branch_head = prev_ptr;
@@ -1199,7 +1202,7 @@ alloc_trace_data() {
11991202 trace_free_head->next = nullptr ;
12001203 }
12011204 temp_ptr = trace_free_head;
1202- temp_ptr->ipin = OPEN; // default
1205+ temp_ptr->net_pin_index = OPEN; // default
12031206 trace_free_head = trace_free_head->next ;
12041207 num_trace_allocated++;
12051208 return (temp_ptr);
@@ -1296,7 +1299,7 @@ void print_route(FILE* fp, const vtr::vector<ClusterNetId, t_traceback>& traceba
12961299
12971300 // Save net pin index for sinks
12981301 if (rr_type == SINK) {
1299- fprintf (fp, " Net_pin_index: %d" , tptr->ipin );
1302+ fprintf (fp, " Net_pin_index: %d" , tptr->net_pin_index );
13001303 }
13011304
13021305 fprintf (fp, " \n " );
0 commit comments