Skip to content

Commit 2107cb1

Browse files
committed
[VPR] use constant reference to node_lookup to avoid long lines
1 parent a658a76 commit 2107cb1

File tree

4 files changed

+13
-9
lines changed

4 files changed

+13
-9
lines changed

vpr/src/pack/post_routing_pb_pin_fixup.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ static void update_cluster_pin_with_post_routing_results(const DeviceContext& de
5555
const int& sub_tile_z,
5656
size_t& num_mismatches,
5757
const bool& verbose) {
58+
const auto& node_lookup = device_ctx.rr_graph.node_lookup();
5859
/* Handle each pin */
5960
auto logical_block = clustering_ctx.clb_nlist.block_type(blk_id);
6061
auto physical_tile = device_ctx.grid[grid_coord.x()][grid_coord.y()].type;
@@ -152,7 +153,7 @@ static void update_cluster_pin_with_post_routing_results(const DeviceContext& de
152153
short valid_routing_net_cnt = 0;
153154
for (const e_side& pin_side : pin_sides) {
154155
/* Find the net mapped to this pin in routing results */
155-
RRNodeId rr_node = device_ctx.rr_graph.node_lookup().find_node(grid_coord.x(), grid_coord.y(), rr_node_type, physical_pin, pin_side);
156+
RRNodeId rr_node = node_lookup.find_node(grid_coord.x(), grid_coord.y(), rr_node_type, physical_pin, pin_side);
156157

157158
/* Bypass invalid nodes, after that we must have a valid rr_node id */
158159
if (!rr_node) {

vpr/src/place/timing_place_lookup.cpp

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -962,6 +962,7 @@ static bool find_direct_connect_sample_locations(const t_direct_inf* direct,
962962

963963
auto& device_ctx = g_vpr_ctx.device();
964964
auto& grid = device_ctx.grid;
965+
const auto& node_lookup = device_ctx.rr_graph.node_lookup();
965966

966967
//Search the grid for an instance of from/to blocks which satisfy this direct connect offsets,
967968
//and which has the appropriate pins
@@ -979,10 +980,10 @@ static bool find_direct_connect_sample_locations(const t_direct_inf* direct,
979980
//(with multi-width/height blocks pins may not exist at all locations)
980981
bool from_pin_found = false;
981982
if (direct->from_side != NUM_SIDES) {
982-
RRNodeId from_pin_rr = device_ctx.rr_graph.node_lookup().find_node(from_x, from_y, OPIN, from_pin, direct->from_side);
983+
RRNodeId from_pin_rr = node_lookup.find_node(from_x, from_y, OPIN, from_pin, direct->from_side);
983984
from_pin_found = (from_pin_rr != RRNodeId::INVALID());
984985
} else {
985-
(*scratch) = device_ctx.rr_graph.node_lookup().find_nodes_at_all_sides(from_x, from_y, OPIN, from_pin);
986+
(*scratch) = node_lookup.find_nodes_at_all_sides(from_x, from_y, OPIN, from_pin);
986987
from_pin_found = !(*scratch).empty();
987988
}
988989
if (!from_pin_found) continue;
@@ -996,10 +997,10 @@ static bool find_direct_connect_sample_locations(const t_direct_inf* direct,
996997
//(with multi-width/height blocks pins may not exist at all locations)
997998
bool to_pin_found = false;
998999
if (direct->to_side != NUM_SIDES) {
999-
RRNodeId to_pin_rr = device_ctx.rr_graph.node_lookup().find_node(to_x, to_y, IPIN, to_pin, direct->to_side);
1000+
RRNodeId to_pin_rr = node_lookup.find_node(to_x, to_y, IPIN, to_pin, direct->to_side);
10001001
to_pin_found = (to_pin_rr != RRNodeId::INVALID());
10011002
} else {
1002-
(*scratch) = device_ctx.rr_graph.node_lookup().find_nodes_at_all_sides(to_x, to_y, IPIN, to_pin);
1003+
(*scratch) = node_lookup.find_nodes_at_all_sides(to_x, to_y, IPIN, to_pin);
10031004
to_pin_found = !(*scratch).empty();
10041005
}
10051006
if (!to_pin_found) continue;
@@ -1037,13 +1038,13 @@ static bool find_direct_connect_sample_locations(const t_direct_inf* direct,
10371038
//
10381039

10391040
{
1040-
(*scratch) = device_ctx.rr_graph.node_lookup().find_nodes_at_all_sides(from_x, from_y, SOURCE, from_pin_class);
1041+
(*scratch) = node_lookup.find_nodes_at_all_sides(from_x, from_y, SOURCE, from_pin_class);
10411042
VTR_ASSERT((*scratch).size() > 0);
10421043
*src_rr = size_t((*scratch)[0]);
10431044
}
10441045

10451046
{
1046-
(*scratch) = device_ctx.rr_graph.node_lookup().find_nodes_at_all_sides(to_x, to_y, SINK, to_pin_class);
1047+
(*scratch) = node_lookup.find_nodes_at_all_sides(to_x, to_y, SINK, to_pin_class);
10471048
VTR_ASSERT((*scratch).size() > 0);
10481049
*sink_rr = size_t((*scratch)[0]);
10491050
}

vpr/src/route/router_lookahead_map.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -546,6 +546,7 @@ static RRNodeId get_start_node(int start_x, int start_y, int target_x, int targe
546546
auto& device_ctx = g_vpr_ctx.device();
547547
const auto& temp_rr_graph = device_ctx.rr_graph; //TODO rename to rr_graph once the rr_graph below is unneeded
548548
auto& rr_graph = device_ctx.rr_nodes;
549+
const auto& node_lookup = device_ctx.rr_graph.node_lookup();
549550

550551
RRNodeId result = RRNodeId::INVALID();
551552

@@ -563,7 +564,7 @@ static RRNodeId get_start_node(int start_x, int start_y, int target_x, int targe
563564
int start_lookup_y = start_y;
564565

565566
/* find first node in channel that has specified segment index and goes in the desired direction */
566-
for (const RRNodeId& node_id : device_ctx.rr_graph.node_lookup().find_channel_nodes(start_lookup_x, start_lookup_y, rr_type)) {
567+
for (const RRNodeId& node_id : node_lookup.find_channel_nodes(start_lookup_x, start_lookup_y, rr_type)) {
567568
VTR_ASSERT(temp_rr_graph.node_type(node_id) == rr_type);
568569

569570
e_direction node_direction = rr_graph.node_direction(node_id);

vpr/src/route/router_lookahead_map_utils.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -377,6 +377,7 @@ t_src_opin_delays compute_router_src_opin_lookahead() {
377377
t_chan_ipins_delays compute_router_chan_ipin_lookahead() {
378378
vtr::ScopedStartFinishTimer timer("Computing chan/ipin lookahead");
379379
auto& device_ctx = g_vpr_ctx.device();
380+
const auto& node_lookup = device_ctx.rr_graph.node_lookup();
380381

381382
t_chan_ipins_delays chan_ipins_delays;
382383

@@ -404,7 +405,7 @@ t_chan_ipins_delays compute_router_chan_ipin_lookahead() {
404405
for (int ix = min_x; ix < max_x; ix++) {
405406
for (int iy = min_y; iy < max_y; iy++) {
406407
for (auto rr_type : {CHANX, CHANY}) {
407-
for (const RRNodeId& node_id : device_ctx.rr_graph.node_lookup().find_channel_nodes(ix, iy, rr_type)) {
408+
for (const RRNodeId& node_id : node_lookup.find_channel_nodes(ix, iy, rr_type)) {
408409
//Find the IPINs which are reachable from the wires within the bounding box
409410
//around the selected tile location
410411
dijkstra_flood_to_ipins(node_id, chan_ipins_delays);

0 commit comments

Comments
 (0)