@@ -47,23 +47,6 @@ static void fixup_atom_pb_graph_pin_mapping(void);
47
47
48
48
/* Function definitions */
49
49
50
- /* * Is the clock net found in the routing results?
51
- * (If not, clock_modeling is probably ideal and we should preserve clock routing while rebuilding.) */
52
- inline bool is_clock_net_routed (void ){
53
- auto & atom_ctx = g_vpr_ctx.atom ();
54
- auto & route_ctx = g_vpr_ctx.routing ();
55
-
56
- for (auto net_id: atom_ctx.nlist .nets ()){
57
- auto & tree = route_ctx.route_trees [net_id];
58
- if (!tree)
59
- continue ;
60
- if (route_ctx.is_clock_net [net_id]) /* Clock net has routing */
61
- return true ;
62
- }
63
-
64
- return false ;
65
- }
66
-
67
50
/* * Get the ClusterBlockId for a given RRNodeId. */
68
51
inline ClusterBlockId get_cluster_block_from_rr_node (RRNodeId inode){
69
52
auto & device_ctx = g_vpr_ctx.device ();
@@ -190,21 +173,19 @@ static void sync_pb_routes_to_routing(void){
190
173
auto & device_ctx = g_vpr_ctx.device ();
191
174
auto & atom_ctx = g_vpr_ctx.atom ();
192
175
auto & cluster_ctx = g_vpr_ctx.mutable_clustering ();
176
+ auto & place_ctx = g_vpr_ctx.placement ();
193
177
auto & route_ctx = g_vpr_ctx.routing ();
194
178
auto & rr_graph = device_ctx.rr_graph ;
195
179
196
- /* Was the clock net routed? */
197
- bool clock_net_is_routed = is_clock_net_routed ();
198
-
199
180
/* Clear out existing pb_routes: they were made by the intra cluster router and are invalid now */
200
181
for (ClusterBlockId clb_blk_id : cluster_ctx.clb_nlist .blocks ()) {
201
- /* If we don't have routing for the clock net, don't erase entries associated with a clock net.
202
- * Otherwise we won't have data to rebuild them */
182
+ /* Don't erase entries for nets without routing in place (clocks, globals...) */
203
183
std::vector<int > pins_to_erase;
204
184
auto & pb_routes = cluster_ctx.clb_nlist .block_pb (clb_blk_id)->pb_route ;
205
185
for (auto & [pin, pb_route]: pb_routes){
206
- if (clock_net_is_routed || !route_ctx.is_clock_net [pb_route.atom_net_id ])
207
- pins_to_erase.push_back (pin);
186
+ if (!route_ctx.route_trees [ParentNetId (int (pb_route.atom_net_id ))])
187
+ continue ;
188
+ pins_to_erase.push_back (pin);
208
189
}
209
190
210
191
for (int pin: pins_to_erase){
@@ -286,8 +267,6 @@ static void sync_clustered_netlist_to_routing(void){
286
267
auto & atom_ctx = g_vpr_ctx.mutable_atom ();
287
268
auto & atom_lookup = atom_ctx.lookup ;
288
269
289
- bool clock_net_is_routed = is_clock_net_routed ();
290
-
291
270
/* 1. Remove all nets, pins and ports from the clustered netlist.
292
271
* If the clock net is not routed, don't remove entries for the clock net
293
272
* otherwise we won't have data to rebuild them. */
@@ -297,26 +276,26 @@ static void sync_clustered_netlist_to_routing(void){
297
276
298
277
for (auto net_id: clb_netlist.nets ()){
299
278
auto atom_net_id = atom_lookup.atom_net (net_id);
300
- if (!clock_net_is_routed && route_ctx.is_clock_net [ atom_net_id])
279
+ if (!route_ctx.route_trees [ ParentNetId ( int ( atom_net_id)) ])
301
280
continue ;
302
281
303
282
nets_to_remove.push_back (net_id);
304
283
}
305
- for (auto pin_id: clb_netlist.pins ()){
306
- ClusterNetId clb_net_id = clb_netlist.pin_net (pin_id);
307
- auto atom_net_id = atom_lookup.atom_net (clb_net_id);
308
- if (!clock_net_is_routed && atom_net_id && route_ctx.is_clock_net [atom_net_id])
309
- continue ;
310
-
311
- pins_to_remove.push_back (pin_id);
312
- }
313
284
for (auto port_id: clb_netlist.ports ()){
314
- ClusterNetId clb_net_id = clb_netlist.port_net (port_id, 0 );
315
- auto atom_net_id = atom_lookup.atom_net (clb_net_id);
316
- if (!clock_net_is_routed && atom_net_id && route_ctx.is_clock_net [atom_net_id])
317
- continue ;
285
+ size_t skipped_pins = 0 ;
286
+
287
+ for (auto pin_id: clb_netlist.port_pins (port_id)){
288
+ ClusterNetId clb_net_id = clb_netlist.pin_net (pin_id);
289
+ auto atom_net_id = atom_lookup.atom_net (clb_net_id);
290
+ if (atom_net_id && !route_ctx.route_trees [ParentNetId (int (atom_net_id))]){
291
+ skipped_pins++;
292
+ }else {
293
+ pins_to_remove.push_back (pin_id);
294
+ }
295
+ }
318
296
319
- ports_to_remove.push_back (port_id);
297
+ if (!skipped_pins) // All pins have been removed, remove port
298
+ ports_to_remove.push_back (port_id);
320
299
}
321
300
322
301
/* ClusteredNetlist's iterators rely on internal lookups, so we mark for removal
@@ -357,7 +336,14 @@ static void sync_clustered_netlist_to_routing(void){
357
336
358
337
int pin_index = rr_graph.node_pin_num (rt_node.inode );
359
338
360
- ClusterBlockId clb = get_cluster_block_from_rr_node (rt_node.inode );
339
+ auto [_, subtile] = get_sub_tile_from_pin_physical_num (physical_tile, pin_index);
340
+
341
+ ClusterBlockId clb = place_ctx.grid_blocks ().block_at_location ({
342
+ rr_graph.node_xlow (rt_node.inode ),
343
+ rr_graph.node_ylow (rt_node.inode ),
344
+ subtile,
345
+ rr_graph.node_layer (rt_node.inode )
346
+ });
361
347
362
348
if (!is_pin_on_tile (physical_tile, pin_index))
363
349
continue ;
@@ -366,15 +352,15 @@ static void sync_clustered_netlist_to_routing(void){
366
352
* Due to how the route tree is traversed, all nodes until the next OPIN on the tile will
367
353
* be under this OPIN, so this is valid (we don't need to get the branch explicitly) */
368
354
if (node_type == OPIN){
369
- std::string net_name;
370
- net_name = atom_ctx.nlist .net_name (parent_net_id) + " _" + std::to_string (clb_nets_so_far);
355
+ std::string net_name = atom_ctx.nlist .net_name (parent_net_id) + " _" + std::to_string (clb_nets_so_far);
371
356
clb_net_id = clb_netlist.create_net (net_name);
372
357
atom_lookup.add_atom_clb_net (atom_net_id, clb_net_id);
373
358
clb_nets_so_far++;
374
359
}
375
360
376
361
t_pb_graph_pin* pb_graph_pin = get_pb_graph_node_pin_from_block_pin (clb, pin_index);
377
362
363
+ /* Get or create port */
378
364
ClusterPortId port_id = clb_netlist.find_port (clb, pb_graph_pin->port ->name );
379
365
if (!port_id){
380
366
PortType port_type;
@@ -431,6 +417,12 @@ static void fixup_atom_pb_graph_pin_mapping(void){
431
417
432
418
/* Find atom port from pbg pin's model port */
433
419
AtomPortId atom_port = atom_ctx.nlist .find_atom_port (atb, atom_pbg_pin->port ->model_port );
420
+
421
+ /* Not an equivalent port, so no need to do fixup */
422
+ if (atom_pbg_pin->port ->equivalent != PortEquivalence::FULL) {
423
+ continue ;
424
+ }
425
+
434
426
for (AtomPinId atom_pin: atom_ctx.nlist .port_pins (atom_port)){
435
427
/* Match net IDs from pb_route and atom netlist and connect in lookup */
436
428
if (pb_route.atom_net_id == atom_ctx.nlist .pin_net (atom_pin)){
0 commit comments