@@ -58,13 +58,13 @@ void check_rr_graph(const RRGraphView& rr_graph,
58
58
route_type = e_route_type::GLOBAL;
59
59
}
60
60
61
- auto total_edges_to_node = std::vector<int >(rr_graph.num_nodes ());
62
- auto switch_types_from_current_to_node = std::vector<unsigned char >(rr_graph.num_nodes ());
61
+ std::vector<int > total_edges_to_node (rr_graph.num_nodes ());
62
+ std::vector<unsigned char > switch_types_from_current_to_node (rr_graph.num_nodes ());
63
63
const int num_rr_switches = rr_graph.num_rr_switches ();
64
64
65
65
std::vector<std::pair<int , int >> edges;
66
66
67
- for (const RRNodeId& rr_node : rr_graph.nodes ()) {
67
+ for (const RRNodeId rr_node : rr_graph.nodes ()) {
68
68
size_t inode = (size_t )rr_node;
69
69
rr_graph.validate_node (rr_node);
70
70
@@ -83,7 +83,7 @@ void check_rr_graph(const RRGraphView& rr_graph,
83
83
84
84
check_rr_node (rr_graph, rr_indexed_data, grid, chan_width, route_type, inode, is_flat);
85
85
86
- /* Check all the connectivity (edges, etc.) information. */
86
+ // Check all the connectivity (edges, etc.) information.
87
87
edges.resize (0 );
88
88
edges.reserve (num_edges);
89
89
@@ -329,16 +329,15 @@ void check_rr_node(const RRGraphView& rr_graph,
329
329
const enum e_route_type route_type,
330
330
const int inode,
331
331
bool is_flat) {
332
- /* This routine checks that the rr_node is inside the grid and has a valid
333
- * pin number, etc.
334
- */
335
-
336
332
// Make sure over-flow doesn't happen
337
333
VTR_ASSERT (inode >= 0 );
338
- int nodes_per_chan, tracks_per_node;
339
- float C, R;
334
+ int tracks_per_node;
340
335
RRNodeId rr_node = RRNodeId (inode);
341
336
337
+ const int grid_width = grid.width ();
338
+ const int grid_height = grid.height ();
339
+ const int grid_layers = grid.get_num_layers ();
340
+
342
341
e_rr_type rr_type = rr_graph.node_type (rr_node);
343
342
int xlow = rr_graph.node_xlow (rr_node);
344
343
int xhigh = rr_graph.node_xhigh (rr_node);
@@ -348,19 +347,18 @@ void check_rr_node(const RRGraphView& rr_graph,
348
347
int ptc_num = rr_graph.node_ptc_num (rr_node);
349
348
int capacity = rr_graph.node_capacity (rr_node);
350
349
RRIndexedDataId cost_index = rr_graph.node_cost_index (rr_node);
351
- t_physical_tile_type_ptr type = nullptr ;
352
350
353
351
if (xlow > xhigh || ylow > yhigh) {
354
352
VPR_ERROR (VPR_ERROR_ROUTE,
355
353
" in check_rr_node: rr endpoints are (%d,%d) and (%d,%d).\n " , xlow, ylow, xhigh, yhigh);
356
354
}
357
355
358
- if (xlow < 0 || xhigh > int (grid. width ()) - 1 || ylow < 0 || yhigh > int (grid. height ()) - 1 ) {
356
+ if (xlow < 0 || xhigh > grid_width - 1 || ylow < 0 || yhigh > grid_height - 1 ) {
359
357
VPR_FATAL_ERROR (VPR_ERROR_ROUTE,
360
358
" in check_rr_node: rr endpoints (%d,%d) and (%d,%d) are out of range.\n " , xlow, ylow, xhigh, yhigh);
361
359
}
362
360
363
- if (layer_num < 0 || layer_num > int (grid. get_num_layers ()) - 1 ) {
361
+ if (layer_num < 0 || layer_num > grid_layers - 1 ) {
364
362
VPR_FATAL_ERROR (VPR_ERROR_ROUTE,
365
363
" in check_rr_node: rr endpoints layer_num (%d) is out of range.\n " , layer_num);
366
364
}
@@ -375,8 +373,8 @@ void check_rr_node(const RRGraphView& rr_graph,
375
373
" in check_rr_node: node %d cost index (%d) is out of range.\n " , inode, cost_index);
376
374
}
377
375
378
- /* Check that the segment is within the array and such. */
379
- type = grid.get_physical_type ({xlow, ylow, layer_num});
376
+ // Check that the segment is within the array and such.
377
+ t_physical_tile_type_ptr type = grid.get_physical_type ({xlow, ylow, layer_num});
380
378
381
379
switch (rr_type) {
382
380
case e_rr_type::SOURCE:
@@ -416,7 +414,7 @@ void check_rr_node(const RRGraphView& rr_graph,
416
414
break ;
417
415
418
416
case e_rr_type::CHANX:
419
- if (xlow < 1 || xhigh > int (grid. width ()) - 2 || yhigh > int (grid. height ()) - 2 || yhigh != ylow) {
417
+ if (xlow < 1 || xhigh > grid_width - 1 || yhigh > grid_height - 1 || yhigh != ylow) {
420
418
VPR_FATAL_ERROR (VPR_ERROR_ROUTE,
421
419
" in check_rr_node: CHANX out of range for endpoints (%d,%d) and (%d,%d)\n " , xlow, ylow, xhigh, yhigh);
422
420
}
@@ -427,7 +425,7 @@ void check_rr_node(const RRGraphView& rr_graph,
427
425
break ;
428
426
429
427
case e_rr_type::CHANY:
430
- if (xhigh > int (grid. width ()) - 2 || ylow < 1 || yhigh > int (grid. height ()) - 2 || xlow != xhigh) {
428
+ if (xhigh > grid_width - 1 || ylow < 1 || yhigh > grid_height - 1 || xlow != xhigh) {
431
429
VPR_FATAL_ERROR (VPR_ERROR_ROUTE,
432
430
" Error in check_rr_node: CHANY out of range for endpoints (%d,%d) and (%d,%d)\n " , xlow, ylow, xhigh, yhigh);
433
431
}
@@ -437,12 +435,20 @@ void check_rr_node(const RRGraphView& rr_graph,
437
435
}
438
436
break ;
439
437
438
+ case e_rr_type::CHANZ:
439
+ if (xhigh != xlow || yhigh != ylow || xhigh > grid_width - 1 || ylow < 1 || yhigh > grid_height - 1 ) {
440
+ VPR_FATAL_ERROR (VPR_ERROR_ROUTE,
441
+ " Error in check_rr_node: CHANZ out of range for endpoints (%d,%d) and (%d,%d)\n " , xlow, ylow, xhigh, yhigh);
442
+ }
443
+ // TODO: handle global routing case
444
+ break ;
445
+
440
446
default :
441
447
VPR_FATAL_ERROR (VPR_ERROR_ROUTE,
442
448
" in check_rr_node: Unexpected segment type: %d\n " , rr_type);
443
449
}
444
450
445
- /* Check that it's capacities and such make sense. */
451
+ // Check that its capacities and such make sense.
446
452
447
453
int class_max_ptc = get_tile_class_max_ptc (type, is_flat);
448
454
int pin_max_ptc = get_tile_pin_max_ptc (type, is_flat);
@@ -481,20 +487,9 @@ void check_rr_node(const RRGraphView& rr_graph,
481
487
case e_rr_type::CHANX:
482
488
case e_rr_type::CHANY:
483
489
if (route_type == e_route_type::DETAILED) {
484
- nodes_per_chan = chan_width.max ;
485
490
tracks_per_node = 1 ;
486
491
} else {
487
- nodes_per_chan = 1 ;
488
- tracks_per_node = ((rr_type == e_rr_type::CHANX) ? chan_width.x_list [ylow] : chan_width.y_list [xlow]);
489
- }
490
-
491
- // if a chanx/chany has length 0, it means it is used to connect different dice together
492
- // hence, the ptc number can be larger than nodes_per_chan
493
- if (xlow != xhigh || ylow != yhigh) {
494
- if (ptc_num >= nodes_per_chan) {
495
- VPR_ERROR (VPR_ERROR_ROUTE,
496
- " in check_rr_node: inode %d (type %d) has a ptc_num of %d.\n " , inode, rr_type, ptc_num);
497
- }
492
+ tracks_per_node = (rr_type == e_rr_type::CHANX) ? chan_width.x_list [ylow] : chan_width.y_list [xlow];
498
493
}
499
494
500
495
if (capacity != tracks_per_node) {
@@ -503,14 +498,26 @@ void check_rr_node(const RRGraphView& rr_graph,
503
498
}
504
499
break ;
505
500
501
+ case e_rr_type::CHANZ:
502
+ if (route_type == e_route_type::DETAILED) {
503
+ tracks_per_node = 1 ;
504
+ } else {
505
+ // TODO: do checks for CHANZ type when global routing is enabled
506
+ // This can be done once we have a way to specify how many chanz
507
+ // nodes per switch block exist.
508
+ VPR_FATAL_ERROR (VPR_ERROR_ROUTE,
509
+ " in check_rr_node: Global routing is not supported in 3D architectures.\n " );
510
+ }
511
+ break ;
512
+
506
513
default :
507
514
VPR_FATAL_ERROR (VPR_ERROR_ROUTE,
508
515
" in check_rr_node: Unexpected segment type: %d\n " , rr_type);
509
516
}
510
517
511
- /* Check that the capacitance and resistance are reasonable. */
512
- C = rr_graph.node_C (rr_node);
513
- R = rr_graph.node_R (rr_node);
518
+ // Check that the capacitance and resistance are reasonable.
519
+ float C = rr_graph.node_C (rr_node);
520
+ float R = rr_graph.node_R (rr_node);
514
521
515
522
if (rr_type == e_rr_type::CHANX || rr_type == e_rr_type::CHANY) {
516
523
if (C < 0 . || R < 0 .) {
0 commit comments