Skip to content

Commit 1c1212a

Browse files
authored
Merge pull request #1518 from verilog-to-routing/check_route_pin_done
Simplify and strengthen check_sink
2 parents ca13b7f + 80414b4 commit 1c1212a

File tree

1 file changed

+9
-34
lines changed

1 file changed

+9
-34
lines changed

vpr/src/route/check_route.cpp

Lines changed: 9 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
/******************** Subroutines local to this module **********************/
2121
static void check_node_and_range(int inode, enum e_route_type route_type);
2222
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, int net_pin_index, ClusterNetId net_id, bool* pin_done);
2424
static void check_switch(t_trace* tptr, int num_switch);
2525
static bool check_adjacent(int from_node, int to_node);
2626
static int chanx_chany_adjacent(int chanx_node, int chany_node);
@@ -46,7 +46,7 @@ void check_route(enum e_route_type route_type, e_check_route_option check_route_
4646
return;
4747
}
4848

49-
int max_pins, inode, prev_node;
49+
int max_pins, inode, net_pin_index, prev_node;
5050
unsigned int ipin;
5151
bool valid, connects;
5252
t_trace* tptr;
@@ -112,6 +112,7 @@ void check_route(enum e_route_type route_type, e_check_route_option check_route_
112112
size_t num_sinks = 0;
113113
while (tptr != nullptr) {
114114
inode = tptr->index;
115+
net_pin_index = tptr->net_pin_index;
115116
check_node_and_range(inode, route_type);
116117
check_switch(tptr, num_switches);
117118

@@ -135,7 +136,7 @@ void check_route(enum e_route_type route_type, e_check_route_option check_route_
135136
connected_to_route[inode] = true; /* Mark as in path. */
136137

137138
if (device_ctx.rr_nodes[inode].type() == SINK) {
138-
check_sink(inode, net_id, pin_done.get());
139+
check_sink(inode, net_pin_index, net_id, pin_done.get());
139140
num_sinks += 1;
140141
}
141142

@@ -177,48 +178,22 @@ void check_route(enum e_route_type route_type, e_check_route_option check_route_
177178

178179
/* Checks that this SINK node is one of the terminals of inet, and marks *
179180
* the appropriate pin as being reached. */
180-
static void check_sink(int inode, ClusterNetId net_id, bool* pin_done) {
181+
static void check_sink(int inode, int net_pin_index, ClusterNetId net_id, bool* pin_done) {
181182
auto& device_ctx = g_vpr_ctx.device();
182183
auto& cluster_ctx = g_vpr_ctx.clustering();
183-
auto& place_ctx = g_vpr_ctx.placement();
184184

185185
VTR_ASSERT(device_ctx.rr_nodes[inode].type() == SINK);
186-
int i = device_ctx.rr_nodes[inode].xlow();
187-
int j = device_ctx.rr_nodes[inode].ylow();
188-
auto type = device_ctx.grid[i][j].type;
189-
/* For sinks, ptc_num is the class */
190-
int ptc_num = device_ctx.rr_nodes[inode].ptc_num();
191-
int ifound = 0;
192-
193-
for (auto bnum : place_ctx.grid_blocks[i][j].blocks) {
194-
unsigned int ipin = 1;
195-
for (auto pin_id : cluster_ctx.clb_nlist.net_sinks(net_id)) {
196-
if (cluster_ctx.clb_nlist.pin_block(pin_id) == bnum) {
197-
int pin_index = tile_pin_index(pin_id);
198-
int iclass = type->pin_class[pin_index];
199-
if (iclass == ptc_num) {
200-
/* Could connect to same pin class on the same clb more than once. Only *
201-
* update pin_done for a pin that hasn't been reached yet. */
202-
if (pin_done[ipin] == false) {
203-
ifound++;
204-
pin_done[ipin] = true;
205-
break;
206-
}
207-
}
208-
}
209-
ipin++;
210-
}
211-
}
212-
213-
VTR_ASSERT(ifound <= 1);
214186

215-
if (ifound < 1) {
187+
if (net_pin_index == OPEN) { /* If there is no legal net pin index associated with this sink node */
216188
VPR_FATAL_ERROR(VPR_ERROR_ROUTE,
217189
"in check_sink: node %d does not connect to any terminal of net %s #%lu.\n"
218190
"This error is usually caused by incorrectly specified logical equivalence in your architecture file.\n"
219191
"You should try to respecify what pins are equivalent or turn logical equivalence off.\n",
220192
inode, cluster_ctx.clb_nlist.net_name(net_id).c_str(), size_t(net_id));
221193
}
194+
195+
VTR_ASSERT(!pin_done[net_pin_index]); /* Should not have found a routed cnnection to it before */
196+
pin_done[net_pin_index] = true;
222197
}
223198

224199
/* Checks that the node passed in is a valid source for this net. */

0 commit comments

Comments
 (0)