4
4
#include " describe_rr_node.h"
5
5
#include " globals.h"
6
6
#include " physical_types_util.h"
7
+ #include " vpr_utils.h"
7
8
8
9
/* *
9
10
* @brief Assigns and loads rr_node indices for block-level routing resources (SOURCE, SINK, IPIN, OPIN).
@@ -70,15 +71,15 @@ static void add_pins_spatial_lookup(RRGraphBuilder& rr_graph_builder,
70
71
static void load_block_rr_indices (RRGraphBuilder& rr_graph_builder,
71
72
const DeviceGrid& grid,
72
73
int * index) {
73
- // Walk through the grid assigning indices to SOURCE/SINK IPIN/OPIN
74
+ // Walk through the grid assigning indices to SOURCE/SINK IPIN/OPIN
74
75
for (int layer = 0 ; layer < grid.get_num_layers (); layer++) {
75
76
for (int x = 0 ; x < (int )grid.width (); x++) {
76
77
for (int y = 0 ; y < (int )grid.height (); y++) {
77
78
// Process each block from its root location
78
79
if (grid.is_root_location ({x, y, layer})) {
79
80
t_physical_tile_type_ptr physical_type = grid.get_physical_type ({x, y, layer});
80
81
81
- // Assign indices for SINKs and SOURCEs
82
+ // Assign indices for SINKs and SOURCEs
82
83
// Note that SINKS/SOURCES have no side, so we always use side 0
83
84
std::vector<int > class_num_vec = get_tile_root_classes (physical_type);
84
85
std::vector<int > pin_num_vec = get_tile_root_pins (physical_type);
@@ -124,22 +125,20 @@ static void load_block_rr_indices(RRGraphBuilder& rr_graph_builder,
124
125
* for the same input pin on multiple sides, and thus avoid multiple driver problems
125
126
*/
126
127
std::vector<e_side> wanted_sides;
127
- if ((int )grid.height () - 1 == y) { /* TOP side */
128
+ if ((int )grid.height () - 1 == y) { // TOP side
128
129
wanted_sides.push_back (BOTTOM);
129
130
}
130
- if ((int )grid.width () - 1 == x) { /* RIGHT side */
131
+ if ((int )grid.width () - 1 == x) { // RIGHT side
131
132
wanted_sides.push_back (LEFT);
132
133
}
133
- if (0 == y) { /* BOTTOM side */
134
+ if (0 == y) { // BOTTOM side
134
135
wanted_sides.push_back (TOP);
135
136
}
136
- if (0 == x) { /* LEFT side */
137
+ if (0 == x) { // LEFT side
137
138
wanted_sides.push_back (RIGHT);
138
139
}
139
140
140
- /* If wanted sides is empty still, this block does not have specific wanted sides,
141
- * Deposit all the sides
142
- */
141
+ // If wanted sides is empty still, this block does not have specific wanted sides, Deposit all the sides
143
142
if (wanted_sides.empty ()) {
144
143
for (e_side side : TOTAL_2D_SIDES) {
145
144
wanted_sides.push_back (side);
@@ -262,7 +261,7 @@ static void add_pins_spatial_lookup(RRGraphBuilder& rr_graph_builder,
262
261
int x_tile = root_x + width_offset;
263
262
for (int height_offset = 0 ; height_offset < physical_type_ptr->height ; ++height_offset) {
264
263
int y_tile = root_y + height_offset;
265
- // only nodes on the tile may be located in a location other than the root-location
264
+ // only nodes on the tile may be located in a location other than the root-location
266
265
rr_graph_builder.node_lookup ().reserve_nodes (layer, x_tile, y_tile, e_rr_type::OPIN, physical_type_ptr->num_pins , side);
267
266
rr_graph_builder.node_lookup ().reserve_nodes (layer, x_tile, y_tile, e_rr_type::IPIN, physical_type_ptr->num_pins , side);
268
267
}
@@ -309,15 +308,15 @@ void alloc_and_load_rr_node_indices(RRGraphBuilder& rr_graph_builder,
309
308
int * index,
310
309
const t_chan_details& chan_details_x,
311
310
const t_chan_details& chan_details_y) {
312
- /* Alloc the lookup table */
311
+ // Alloc the lookup table
313
312
for (e_rr_type rr_type : RR_TYPES) {
314
313
rr_graph_builder.node_lookup ().resize_nodes (grid.get_num_layers (), grid.width (), grid.height (), rr_type, NUM_2D_SIDES);
315
314
}
316
315
317
- /* Assign indices for block nodes */
316
+ // Assign indices for block nodes
318
317
load_block_rr_indices (rr_graph_builder, grid, index );
319
318
320
- /* Load the data for x and y channels */
319
+ // Load the data for x and y channels
321
320
load_chan_rr_indices (nodes_per_chan.x_max , grid, grid.width (), grid.height (),
322
321
e_rr_type::CHANX, chan_details_x, rr_graph_builder.node_lookup (), index );
323
322
load_chan_rr_indices (nodes_per_chan.y_max , grid, grid.height (), grid.width (),
@@ -341,7 +340,7 @@ void alloc_and_load_inter_die_rr_node_indices(RRGraphBuilder& rr_graph_builder,
341
340
const auto & device_ctx = g_vpr_ctx.device ();
342
341
343
342
for (int layer = 0 ; layer < grid.get_num_layers (); layer++) {
344
- /* Skip the current die if architecture file specifies that it doesn't have global resource routing */
343
+ // Skip the current die if architecture file specifies that it doesn't have global resource routing
345
344
if (!device_ctx.inter_cluster_prog_routing_resources .at (layer)) {
346
345
continue ;
347
346
}
@@ -412,10 +411,10 @@ void alloc_and_load_intra_cluster_rr_node_indices(RRGraphBuilder& rr_graph_build
412
411
for (int layer = 0 ; layer < grid.get_num_layers (); layer++) {
413
412
for (int x = 0 ; x < (int )grid.width (); x++) {
414
413
for (int y = 0 ; y < (int )grid.height (); y++) {
415
- // Process each block from its root location
414
+ // Process each block from its root location
416
415
if (grid.is_root_location ({x, y, layer})) {
417
416
t_physical_tile_type_ptr physical_type = grid.get_physical_type ({x, y, layer});
418
- // Assign indices for SINKs and SOURCEs
417
+ // Assign indices for SINKs and SOURCEs
419
418
// Note that SINKS/SOURCES have no side, so we always use side 0
420
419
std::vector<int > class_num_vec;
421
420
std::vector<int > pin_num_vec;
@@ -467,7 +466,7 @@ bool verify_rr_node_indices(const DeviceGrid& grid,
467
466
for (int x = 0 ; x < width; ++x) {
468
467
for (int y = 0 ; y < height; ++y) {
469
468
for (e_rr_type rr_type : RR_TYPES) {
470
- /* Get the list of nodes at a specific location (x, y) */
469
+ // Get the list of nodes at a specific location (x, y)
471
470
std::vector<RRNodeId> nodes_from_lookup;
472
471
if (rr_type == e_rr_type::CHANX || rr_type == e_rr_type::CHANY) {
473
472
nodes_from_lookup = rr_graph.node_lookup ().find_channel_nodes (l, x, y, rr_type);
@@ -584,7 +583,7 @@ bool verify_rr_node_indices(const DeviceGrid& grid,
584
583
RRNodeId inode = kv.first ;
585
584
int count = kv.second ;
586
585
587
- auto & rr_node = rr_nodes[size_t (inode)];
586
+ const t_rr_node & rr_node = rr_nodes[size_t (inode)];
588
587
589
588
if (rr_graph.node_type (inode) == e_rr_type::SOURCE || rr_graph.node_type (inode) == e_rr_type::SINK) {
590
589
int rr_width = (rr_graph.node_xhigh (rr_node.id ()) - rr_graph.node_xlow (rr_node.id ()) + 1 );
@@ -597,9 +596,9 @@ bool verify_rr_node_indices(const DeviceGrid& grid,
597
596
count,
598
597
describe_rr_node (rr_graph, grid, rr_indexed_data, inode, is_flat).c_str ());
599
598
}
600
- /* As we allow a pin to be indexable on multiple sides,
601
- * This check code should not be applied to input and output pins
602
- */
599
+ // As we allow a pin to be indexable on multiple sides,
600
+ // This check code should not be applied to input and output pins
601
+
603
602
} else if ((e_rr_type::OPIN != rr_graph.node_type (inode)) && (e_rr_type::IPIN != rr_graph.node_type (inode))) {
604
603
if (count != rr_node.length () + 1 ) {
605
604
VPR_ERROR (VPR_ERROR_ROUTE, " Mismatch between RR node length (%d) and count within rr_node_indices (%d, should be length + 1): %s" ,
0 commit comments