Skip to content

Commit c6802d6

Browse files
authored
Merge pull request #2941 from verilog-to-routing/rr_node_indices
[RR Graph] RR Node Indices Value Type
2 parents 0af49af + 1a17be2 commit c6802d6

File tree

4 files changed

+11
-34
lines changed

4 files changed

+11
-34
lines changed

libs/librrgraph/src/base/rr_node_types.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
#include <cstdint>
1111
#include "vtr_range.h"
1212
#include "vtr_ndmatrix.h"
13+
#include "rr_graph_fwd.h"
1314

1415
/**
1516
* @brief Type of a routing resource node.
@@ -123,6 +124,6 @@ struct t_rr_rc_data {
123124

124125
// This is the data type of fast lookups of an rr-node given an (rr_type, layer, x, y, and the side)
125126
//[0..num_rr_types-1][0..num_layer-1][0..grid_width-1][0..grid_height-1][0..NUM_2D_SIDES-1][0..max_ptc-1]
126-
typedef std::array<vtr::NdMatrix<std::vector<int>, 4>, NUM_RR_TYPES> t_rr_node_indices;
127+
typedef std::array<vtr::NdMatrix<std::vector<RRNodeId>, 4>, NUM_RR_TYPES> t_rr_node_indices;
127128

128129
#endif

libs/librrgraph/src/base/rr_spatial_lookup.cpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ RRNodeId RRSpatialLookup::find_node(int layer,
7575
return RRNodeId::INVALID();
7676
}
7777

78-
return RRNodeId(rr_node_indices_[type][layer][node_x][node_y][node_side][ptc]);
78+
return rr_node_indices_[type][layer][node_x][node_y][node_side][ptc];
7979
}
8080

8181
std::vector<RRNodeId> RRSpatialLookup::find_nodes_in_range(int layer,
@@ -155,14 +155,14 @@ std::vector<RRNodeId> RRSpatialLookup::find_nodes(int layer,
155155
/* Reserve space to avoid memory fragmentation */
156156
size_t num_nodes = 0;
157157
for (const auto& node : rr_node_indices_[type][layer][node_x][node_y][side]) {
158-
if (RRNodeId(node)) {
158+
if (node.is_valid()) {
159159
num_nodes++;
160160
}
161161
}
162162

163163
nodes.reserve(num_nodes);
164164
for (const auto& node : rr_node_indices_[type][layer][node_x][node_y][side]) {
165-
if (RRNodeId(node)) {
165+
if (node.is_valid()) {
166166
nodes.emplace_back(node);
167167
}
168168
}
@@ -272,11 +272,11 @@ void RRSpatialLookup::add_node(RRNodeId node,
272272

273273
if (size_t(ptc) >= rr_node_indices_[type][layer][x][y][side].size()) {
274274
/* Deposit invalid ids to newly allocated elements while original elements are untouched */
275-
rr_node_indices_[type][layer][x][y][side].resize(ptc + 1, int(RRNodeId::INVALID()));
275+
rr_node_indices_[type][layer][x][y][side].resize(ptc + 1, RRNodeId::INVALID());
276276
}
277277

278278
/* Resize on demand finished; Register the node */
279-
rr_node_indices_[type][layer][x][y][side][ptc] = int(node);
279+
rr_node_indices_[type][layer][x][y][side][ptc] = node;
280280
}
281281

282282
bool RRSpatialLookup::remove_node(RRNodeId node,
@@ -302,11 +302,11 @@ bool RRSpatialLookup::remove_node(RRNodeId node,
302302
if ((size_t)y >= rr_node_indices_[type].dim_size(2)) return false;
303303
if (side >= rr_node_indices_[type].dim_size(3)) return false;
304304
if ((size_t)ptc >= rr_node_indices_[type][layer][x][y][side].size()) return false;
305-
if (rr_node_indices_[type][layer][x][y][side][ptc] != int(node)) return false;
305+
if (rr_node_indices_[type][layer][x][y][side][ptc] != node) return false;
306306

307307
// The node was in the spatial lookup; remove it. -1 corresponds to an invalid node id,
308308
// and so is treated as absent in the spatial lookup
309-
rr_node_indices_[type][layer][x][y][side][ptc] = -1;
309+
rr_node_indices_[type][layer][x][y][side][ptc] = RRNodeId::INVALID();
310310
return true;
311311
}
312312

@@ -353,8 +353,8 @@ void RRSpatialLookup::reorder(const vtr::vector<RRNodeId, RRNodeId> dest_order)
353353
for (size_t y = 0; y < grid.dim_size(2); y++) {
354354
for (size_t s = 0; s < grid.dim_size(3); s++) {
355355
for (auto &node: grid[l][x][y][s]) {
356-
if (node != OPEN) {
357-
node = size_t(dest_order[RRNodeId(node)]);
356+
if (node.is_valid()) {
357+
node = dest_order[node];
358358
}
359359
}
360360
}

vpr/src/route/rr_graph2.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1870,7 +1870,6 @@ int get_track_to_pins(RRGraphBuilder& rr_graph_builder,
18701870
}
18711871

18721872
/* Check there is a connection and Fc map isn't wrong */
1873-
/*int to_node = get_rr_node_index(L_rr_node_indices, x + width_offset, y + height_offset, IPIN, ipin, side);*/
18741873
RRNodeId to_node = rr_graph_builder.node_lookup().find_node(layer_index, x, y, IPIN, ipin, side);
18751874
int switch_type = (layer_index == layer) ? wire_to_ipin_switch : wire_to_pin_between_dice_switch;
18761875
if (to_node) {

vpr/src/route/rr_graph2.h

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -63,21 +63,6 @@ bool verify_rr_node_indices(const DeviceGrid& grid,
6363
const vtr::vector<RRIndexedDataId, t_rr_indexed_data>& rr_indexed_data,
6464
const t_rr_graph_storage& rr_nodes,
6565
bool is_flat);
66-
67-
//Returns all x-channel or y-channel wires at the specified location
68-
std::vector<int> get_rr_node_chan_wires_at_location(const t_rr_node_indices& L_rr_node_indices,
69-
t_rr_type rr_type,
70-
int x,
71-
int y);
72-
73-
//Return the first rr node of the specified type and coordinates
74-
// For non-IPIN/OPIN types 'side' is ignored
75-
int get_rr_node_index(const t_rr_node_indices& L_rr_node_indices,
76-
int x,
77-
int y,
78-
t_rr_type rr_type,
79-
int ptc,
80-
e_side side = NUM_2D_SIDES);
8166
/**
8267
* @brief goes through 3D custom switch blocks and counts how many connections are crossing dice for each switch block.
8368
*
@@ -90,12 +75,6 @@ vtr::NdMatrix<int, 2> get_number_track_to_track_inter_die_conn(t_sb_connection_m
9075
const int custom_3d_sb_fanin_fanout,
9176
RRGraphBuilder& rr_graph_builder);
9277

93-
int find_average_rr_node_index(int device_width,
94-
int device_height,
95-
t_rr_type rr_type,
96-
int ptc,
97-
const t_rr_node_indices& L_rr_node_indices);
98-
9978
t_seg_details* alloc_and_load_seg_details(int* max_chan_width,
10079
const int max_len,
10180
const std::vector<t_segment_inf>& segment_inf,
@@ -270,8 +249,6 @@ void dump_track_to_pin_map(t_track_to_pin_lookup& track_to_pin_map,
270249
int max_chan_width,
271250
FILE* fp);
272251

273-
void add_to_rr_node_indices(t_rr_node_indices& rr_node_indices, const t_rr_graph_storage& rr_nodes, int inode);
274-
275252
void insert_at_ptc_index(std::vector<int>& rr_indices, int ptc, int inode);
276253

277254
inline int get_chan_width(enum e_side side, const t_chan_width* nodes_per_channel);

0 commit comments

Comments
 (0)