@@ -86,7 +86,7 @@ static int num_linked_f_pointer_allocated = 0;
86
86
* */
87
87
88
88
/* ******************* Subroutines local to route_common.c *******************/
89
- static t_trace_branch traceback_branch (int node, 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);
90
90
static std::pair<t_trace*, t_trace*> add_trace_non_configurable (t_trace* head, t_trace* tail, int node, std::unordered_set<int >& visited);
91
91
static std::pair<t_trace*, t_trace*> add_trace_non_configurable_recurr (int node, std::unordered_set<int >& visited, int depth = 0 );
92
92
@@ -484,26 +484,28 @@ void init_route_structs(int bb_factor) {
484
484
route_ctx.net_status .resize (cluster_ctx.clb_nlist .nets ().size ());
485
485
}
486
486
487
- t_trace* update_traceback (t_heap* hptr, ClusterNetId net_id) {
488
- /* This routine adds the most recently finished wire segment to the *
489
- * traceback linked list. The first connection starts with the net SOURCE *
490
- * and begins at the structure pointed to by route_ctx.trace[net_id].head. *
491
- * Each connection ends with a SINK. After each SINK, the next connection *
492
- * begins (if the net has more than 2 pins). The first element after the *
493
- * SINK gives the routing node on a previous piece of the routing, which is *
494
- * the link from the existing net to this new piece of the net. *
495
- * In each traceback I start at the end of a path and trace back through *
496
- * its predecessors to the beginning. I have stored information on the *
497
- * predecesser of each node to make traceback easy -- this sacrificies some *
498
- * memory for easier code maintenance. This routine returns a pointer to *
499
- * the first "new" node in the traceback (node not previously in trace). */
487
+ /* This routine adds the most recently finished wire segment to the *
488
+ * traceback linked list. The first connection starts with the net SOURCE *
489
+ * and begins at the structure pointed to by route_ctx.trace[net_id].head. *
490
+ * Each connection ends with a SINK. After each SINK, the next connection *
491
+ * begins (if the net has more than 2 pins). The first element after the *
492
+ * SINK gives the routing node on a previous piece of the routing, which is *
493
+ * the link from the existing net to this new piece of the net. *
494
+ * In each traceback I start at the end of a path, which is a SINK with *
495
+ * target_net_pin_index (net pin index corresponding to the SINK, ranging *
496
+ * from 1 to fanout), and trace back through its predecessors to the *
497
+ * beginning. I have stored information on the predecesser of each node to *
498
+ * make traceback easy -- this sacrificies some memory for easier code *
499
+ * maintenance. This routine returns a pointer to the first "new" node in *
500
+ * the traceback (node not previously in trace). */
501
+ t_trace* update_traceback (t_heap* hptr, int target_net_pin_index, ClusterNetId net_id) {
500
502
auto & route_ctx = g_vpr_ctx.mutable_routing ();
501
503
502
504
auto & trace_nodes = route_ctx.trace_nodes [net_id];
503
505
504
506
VTR_ASSERT_SAFE (validate_trace_nodes (route_ctx.trace [net_id].head , trace_nodes));
505
507
506
- t_trace_branch branch = traceback_branch (hptr->index , trace_nodes);
508
+ t_trace_branch branch = traceback_branch (hptr->index , target_net_pin_index, trace_nodes);
507
509
508
510
VTR_ASSERT_SAFE (validate_trace_nodes (branch.head , trace_nodes));
509
511
@@ -520,9 +522,10 @@ t_trace* update_traceback(t_heap* hptr, ClusterNetId net_id) {
520
522
return (ret_ptr);
521
523
}
522
524
523
- // Traces back a new routing branch starting from the specified 'node' and working backwards to any existing routing.
525
+ // Traces back a new routing branch starting from the specified SINK 'node' with target_net_pin_index, which is the
526
+ // net pin index corresponding to the SINK (ranging from 1 to fanout), and working backwards to any existing routing.
524
527
// Returns the new branch, and also updates trace_nodes for any new nodes which are included in the branches traceback.
525
- static t_trace_branch traceback_branch (int node, std::unordered_set<int >& trace_nodes) {
528
+ static t_trace_branch traceback_branch (int node, int target_net_pin_index, std::unordered_set<int >& trace_nodes) {
526
529
auto & device_ctx = g_vpr_ctx.device ();
527
530
auto & route_ctx = g_vpr_ctx.routing ();
528
531
@@ -537,6 +540,7 @@ static t_trace_branch traceback_branch(int node, std::unordered_set<int>& trace_
537
540
t_trace* branch_head = alloc_trace_data ();
538
541
t_trace* branch_tail = branch_head;
539
542
branch_head->index = node;
543
+ branch_head->net_pin_index = target_net_pin_index; // The first node is the SINK node, so store its net pin index
540
544
branch_head->iswitch = OPEN;
541
545
branch_head->next = nullptr ;
542
546
@@ -551,6 +555,7 @@ static t_trace_branch traceback_branch(int node, std::unordered_set<int>& trace_
551
555
// Add the current node to the head of traceback
552
556
t_trace* prev_ptr = alloc_trace_data ();
553
557
prev_ptr->index = inode;
558
+ prev_ptr->net_pin_index = OPEN; // Net pin index is invalid for Non-SINK nodes
554
559
prev_ptr->iswitch = device_ctx.rr_nodes .edge_switch (iedge);
555
560
prev_ptr->next = branch_head;
556
561
branch_head = prev_ptr;
@@ -731,11 +736,16 @@ void mark_ends(ClusterNetId net_id) {
731
736
}
732
737
}
733
738
734
- void mark_remaining_ends (const std::vector<int >& remaining_sinks) {
739
+ void mark_remaining_ends (ClusterNetId net_id, const std::vector<int >& remaining_sinks) {
735
740
// like mark_ends, but only performs it for the remaining sinks of a net
741
+ int inode;
742
+
736
743
auto & route_ctx = g_vpr_ctx.mutable_routing ();
737
- for (int sink_node : remaining_sinks)
738
- ++route_ctx.rr_node_route_inf [sink_node].target_flag ;
744
+
745
+ for (int sink_pin : remaining_sinks) {
746
+ inode = route_ctx.net_rr_terminals [net_id][sink_pin];
747
+ ++route_ctx.rr_node_route_inf [inode].target_flag ;
748
+ }
739
749
}
740
750
741
751
void drop_traceback_tail (ClusterNetId net_id) {
@@ -1182,6 +1192,7 @@ alloc_trace_data() {
1182
1192
trace_free_head->next = nullptr ;
1183
1193
}
1184
1194
temp_ptr = trace_free_head;
1195
+ temp_ptr->net_pin_index = OPEN; // default
1185
1196
trace_free_head = trace_free_head->next ;
1186
1197
num_trace_allocated++;
1187
1198
return (temp_ptr);
@@ -1276,6 +1287,11 @@ void print_route(FILE* fp, const vtr::vector<ClusterNetId, t_traceback>& traceba
1276
1287
* used in the routing. */
1277
1288
fprintf (fp, " Switch: %d" , tptr->iswitch );
1278
1289
1290
+ // Save net pin index for sinks
1291
+ if (rr_type == SINK) {
1292
+ fprintf (fp, " Net_pin_index: %d" , tptr->net_pin_index );
1293
+ }
1294
+
1279
1295
fprintf (fp, " \n " );
1280
1296
1281
1297
tptr = tptr->next ;
0 commit comments