20
20
/* ******************* Subroutines local to this module **********************/
21
21
static void check_node_and_range (int inode, enum e_route_type route_type);
22
22
static void check_source (int inode, ClusterNetId net_id);
23
- static void check_sink (int inode, ClusterNetId net_id, bool * pin_done);
23
+ static void check_sink (int inode, ClusterNetId net_id, std::set<vtr::StrongId<cluster_pin_id_tag>>& pin_done);
24
24
static void check_switch (t_trace* tptr, int num_switch);
25
25
static bool check_adjacent (int from_node, int to_node);
26
26
static int chanx_chany_adjacent (int chanx_node, int chany_node);
@@ -47,7 +47,6 @@ void check_route(enum e_route_type route_type, e_check_route_option check_route_
47
47
}
48
48
49
49
int max_pins, inode, prev_node;
50
- unsigned int ipin;
51
50
bool valid, connects;
52
51
t_trace* tptr;
53
52
@@ -80,15 +79,13 @@ void check_route(enum e_route_type route_type, e_check_route_option check_route_
80
79
for (auto net_id : cluster_ctx.clb_nlist .nets ())
81
80
max_pins = std::max (max_pins, (int )cluster_ctx.clb_nlist .net_pins (net_id).size ());
82
81
83
- auto pin_done = std::make_unique< bool []>(max_pins) ;
82
+ std::set<vtr::StrongId<cluster_pin_id_tag>> pin_done ;
84
83
85
84
/* Now check that all nets are indeed connected. */
86
85
for (auto net_id : cluster_ctx.clb_nlist .nets ()) {
87
86
if (cluster_ctx.clb_nlist .net_is_ignored (net_id) || cluster_ctx.clb_nlist .net_sinks (net_id).size () == 0 ) /* Skip ignored nets. */
88
87
continue ;
89
88
90
- std::fill_n (pin_done.get (), cluster_ctx.clb_nlist .net_pins (net_id).size (), false );
91
-
92
89
/* Check the SOURCE of the net. */
93
90
tptr = route_ctx.trace [net_id].head ;
94
91
if (tptr == nullptr ) {
@@ -102,7 +99,8 @@ void check_route(enum e_route_type route_type, e_check_route_option check_route_
102
99
connected_to_route[inode] = true ; /* Mark as in path. */
103
100
104
101
check_source (inode, net_id);
105
- pin_done[0 ] = true ;
102
+ auto first_net_id = cluster_ctx.clb_nlist .net_pins (net_id).begin ();
103
+ pin_done.insert (*first_net_id); /* Insert the source */
106
104
107
105
prev_node = inode;
108
106
int prev_switch = tptr->iswitch ;
@@ -135,7 +133,7 @@ void check_route(enum e_route_type route_type, e_check_route_option check_route_
135
133
connected_to_route[inode] = true ; /* Mark as in path. */
136
134
137
135
if (device_ctx.rr_nodes [inode].type () == SINK) {
138
- check_sink (inode, net_id, pin_done. get () );
136
+ check_sink (inode, net_id, pin_done);
139
137
num_sinks += 1 ;
140
138
}
141
139
@@ -152,10 +150,11 @@ void check_route(enum e_route_type route_type, e_check_route_option check_route_
152
150
num_sinks, cluster_ctx.clb_nlist .net_sinks (net_id).size ());
153
151
}
154
152
155
- for (ipin = 0 ; ipin < cluster_ctx.clb_nlist .net_pins (net_id).size (); ipin++) {
156
- if (pin_done[ipin] == false ) {
153
+ for (auto pin_id : cluster_ctx.clb_nlist .net_pins (net_id)) {
154
+ if (pin_done.find (pin_id) == pin_done.end ()) {
155
+ int net_pin_index = tile_pin_index (pin_id);
157
156
VPR_FATAL_ERROR (VPR_ERROR_ROUTE,
158
- " in check_route: net %zu does not connect to pin %d.\n " , size_t (net_id), ipin );
157
+ " in check_route: net %zu does not connect to pin %d.\n " , size_t (net_id), net_pin_index );
159
158
}
160
159
}
161
160
@@ -177,7 +176,7 @@ void check_route(enum e_route_type route_type, e_check_route_option check_route_
177
176
178
177
/* Checks that this SINK node is one of the terminals of inet, and marks *
179
178
* the appropriate pin as being reached. */
180
- static void check_sink (int inode, ClusterNetId net_id, bool * pin_done) {
179
+ static void check_sink (int inode, ClusterNetId net_id, std::set<vtr::StrongId<cluster_pin_id_tag>>& pin_done) {
181
180
auto & device_ctx = g_vpr_ctx.device ();
182
181
auto & cluster_ctx = g_vpr_ctx.clustering ();
183
182
auto & place_ctx = g_vpr_ctx.placement ();
@@ -191,22 +190,20 @@ static void check_sink(int inode, ClusterNetId net_id, bool* pin_done) {
191
190
int ifound = 0 ;
192
191
193
192
for (auto bnum : place_ctx.grid_blocks [i][j].blocks ) {
194
- unsigned int ipin = 1 ;
195
193
for (auto pin_id : cluster_ctx.clb_nlist .net_sinks (net_id)) {
196
194
if (cluster_ctx.clb_nlist .pin_block (pin_id) == bnum) {
197
195
int pin_index = tile_pin_index (pin_id);
198
196
int iclass = type->pin_class [pin_index];
199
197
if (iclass == ptc_num) {
200
198
/* Could connect to same pin class on the same clb more than once. Only *
201
199
* update pin_done for a pin that hasn't been reached yet. */
202
- if (pin_done[ipin] == false ) {
200
+ if (pin_done. find (pin_id) == pin_done. end () ) {
203
201
ifound++;
204
- pin_done[ipin] = true ;
202
+ pin_done. insert (pin_id) ;
205
203
break ;
206
204
}
207
205
}
208
206
}
209
- ipin++;
210
207
}
211
208
}
212
209
0 commit comments