Skip to content

Commit ded64a7

Browse files
author
Nathan Shreve
committed
Slight refactor
1 parent 23c581f commit ded64a7

File tree

7 files changed

+16
-16
lines changed

7 files changed

+16
-16
lines changed

libs/libarchfpga/src/device_grid.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ class DeviceGrid {
7575
}
7676

7777
///@brief Returns a rectangle which represents the bounding box of the tile at the given location.
78-
inline vtr::Rect<int> get_tile_bb(t_physical_tile_loc tile_loc) const {
78+
inline vtr::Rect<int> get_tile_bb(const t_physical_tile_loc& tile_loc) const {
7979
t_physical_tile_type_ptr tile_type = get_physical_type(tile_loc);
8080

8181
int tile_xlow = tile_loc.x - get_width_offset(tile_loc);

libs/librrgraph/src/base/check_rr_graph.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -406,7 +406,7 @@ void check_rr_node(const RRGraphView& rr_graph,
406406
"in check_rr_node: node %d (type %d) is at an illegal clb location (%d, %d).\n", inode, rr_type, xlow, ylow);
407407
}
408408

409-
auto tile_bb = grid.get_tile_bb({xlow, ylow, layer_num});
409+
vtr::Rect<int> tile_bb = grid.get_tile_bb({xlow, ylow, layer_num});
410410
if (xlow < tile_bb.xmin() || ylow < tile_bb.ymin() || xhigh > tile_bb.xmax() || yhigh > tile_bb.ymax()) {
411411
VPR_FATAL_ERROR(VPR_ERROR_ROUTE,
412412
"in check_rr_node: node %d (type %d) has endpoints (%d,%d) and (%d,%d)\n", inode, rr_type, xlow, ylow, xhigh, yhigh);

libs/librrgraph/src/base/rr_graph_utils.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ static void walk_cluster_recursive(const RRGraphView& rr_graph,
2121
VTR_ASSERT_SAFE(rr_graph.node_type(origin) == e_rr_type::SINK);
2222

2323
// We want to go "backward" to the cluster IPINs connected to the origin node
24-
auto incoming_edges = fanins[curr];
24+
const std::vector<RREdgeId>& incoming_edges = fanins[curr];
2525
for (RREdgeId edge : incoming_edges) {
2626
RRNodeId parent = rr_graph.edge_src_node(edge);
2727
VTR_ASSERT_SAFE(parent != RRNodeId::INVALID());
@@ -133,7 +133,7 @@ vtr::vector<RRNodeId, std::vector<RREdgeId>> get_fan_in_list(const RRGraphView&
133133
}
134134

135135
void rr_set_sink_locs(const RRGraphView& rr_graph, RRGraphBuilder& rr_graph_builder, const DeviceGrid& grid) {
136-
auto node_fanins = get_fan_in_list(rr_graph);
136+
const vtr::vector<RRNodeId, std::vector<RREdgeId>> node_fanins = get_fan_in_list(rr_graph);
137137

138138
// Keep track of offsets for SINKs for each tile type, to avoid repeated calculations
139139
std::unordered_map<t_physical_tile_type_ptr, std::unordered_map<int, vtr::Point<int>>> physical_type_offsets;
@@ -160,7 +160,7 @@ void rr_set_sink_locs(const RRGraphView& rr_graph, RRGraphBuilder& rr_graph_buil
160160

161161
t_physical_tile_loc tile_loc = {node_xlow, node_ylow, node_layer};
162162
t_physical_tile_type_ptr tile_type = grid.get_physical_type(tile_loc);
163-
auto tile_bb = grid.get_tile_bb(tile_loc);
163+
vtr::Rect<int> tile_bb = grid.get_tile_bb(tile_loc);
164164

165165
// See if we have encountered this tile type/ptc combo before, and used saved offset if so
166166
vtr::Point<int> new_loc(-1, -1);

libs/librrgraph/src/base/rr_spatial_lookup.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@ void RRSpatialLookup::add_node(RRNodeId node,
260260
t_rr_type type,
261261
int ptc,
262262
e_side side) {
263-
VTR_ASSERT(node); /* Must have a valid node id to be added */
263+
VTR_ASSERT(node.is_valid()); /* Must have a valid node id to be added */
264264
VTR_ASSERT_SAFE(4 == rr_node_indices_[type].ndims());
265265

266266
/* For non-IPIN/OPIN nodes, the side should always be the TOP side which follows the convention in find_node() API! */
@@ -286,7 +286,7 @@ bool RRSpatialLookup::remove_node(RRNodeId node,
286286
t_rr_type type,
287287
int ptc,
288288
e_side side) {
289-
VTR_ASSERT(node);
289+
VTR_ASSERT(node.is_valid());
290290
VTR_ASSERT_SAFE(4 == rr_node_indices_[type].ndims());
291291
VTR_ASSERT_SAFE(layer >= 0);
292292
VTR_ASSERT_SAFE(x >= 0);

vpr/src/route/check_route.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,7 @@ static bool check_adjacent(RRNodeId from_node, RRNodeId to_node, bool is_flat) {
303303

304304
// If to_node is SINK, use its tile coordinates
305305
if (to_type == SINK) {
306-
auto tile_bb = device_ctx.grid.get_tile_bb({to_xlow, to_ylow, to_layer});
306+
vtr::Rect<int> tile_bb = device_ctx.grid.get_tile_bb({to_xlow, to_ylow, to_layer});
307307

308308
to_xlow = tile_bb.xmin();
309309
to_ylow = tile_bb.ymin();

vpr/src/route/connection_router.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -382,8 +382,8 @@ void ConnectionRouter<Heap>::timing_driven_expand_neighbours(t_heap* current,
382382
t_bb target_bb;
383383
if (target_node != RRNodeId::INVALID()) {
384384
if (rr_graph_->node_type(target_node) == SINK) { // We need to get a bounding box for the sink's entire tile
385-
auto tile_bb = grid_.get_tile_bb({rr_graph_->node_xlow(target_node),
386-
rr_graph_->node_ylow(target_node),
385+
vtr::Rect<int> tile_bb = grid_.get_tile_bb({rr_graph_->node_xlow(target_node),
386+
rr_graph_->node_ylow(target_node),
387387
rr_graph_->node_layer(target_node)});
388388

389389
target_bb.xmin = tile_bb.xmin();

vpr/src/route/route_common.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -459,9 +459,9 @@ static vtr::vector<ParentNetId, std::vector<RRNodeId>> load_net_rr_terminals(con
459459
SOURCE,
460460
iclass);
461461
} else {
462-
auto tile_bb = grid.get_tile_bb({blk_loc.loc.x,
463-
blk_loc.loc.y,
464-
blk_loc.loc.layer});
462+
vtr::Rect<int> tile_bb = grid.get_tile_bb({blk_loc.loc.x,
463+
blk_loc.loc.y,
464+
blk_loc.loc.layer});
465465
std::vector<RRNodeId> sink_nodes = rr_graph.node_lookup().find_nodes_in_range(blk_loc.loc.layer,
466466
tile_bb.xmin(),
467467
tile_bb.ymin(),
@@ -721,9 +721,9 @@ t_bb load_net_route_bb(const Netlist<>& net_list,
721721
VTR_ASSERT(rr_graph.node_layer(sink_rr) >= 0);
722722
VTR_ASSERT(rr_graph.node_layer(sink_rr) <= device_ctx.grid.get_num_layers() - 1);
723723

724-
auto tile_bb = device_ctx.grid.get_tile_bb({rr_graph.node_xlow(sink_rr),
725-
rr_graph.node_ylow(sink_rr),
726-
rr_graph.node_layer(sink_rr)});
724+
vtr::Rect<int> tile_bb = device_ctx.grid.get_tile_bb({rr_graph.node_xlow(sink_rr),
725+
rr_graph.node_ylow(sink_rr),
726+
rr_graph.node_layer(sink_rr)});
727727

728728
xmin = std::min<int>(xmin, tile_bb.xmin());
729729
xmax = std::max<int>(xmax, tile_bb.xmax());

0 commit comments

Comments
 (0)