Skip to content

Commit 490740e

Browse files
replace calls to is_io_type() with t_physical_tile_type::is_io()
1 parent c12350d commit 490740e

File tree

11 files changed

+42
-51
lines changed

11 files changed

+42
-51
lines changed

libs/libarchfpga/src/physical_types.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ bool t_physical_tile_type::is_empty() const {
172172
return name == std::string(EMPTY_BLOCK_NAME);
173173
}
174174

175-
bool t_physical_tile_type::is_io_type() const {
175+
bool t_physical_tile_type::is_io() const {
176176
return is_input_type || is_output_type;
177177
}
178178

libs/libarchfpga/src/physical_types.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -726,7 +726,7 @@ struct t_physical_tile_type {
726726
bool is_empty() const;
727727

728728
///@brief Returns true if the physical tile type can implement either a .input or .output block type
729-
bool is_io_type() const;
729+
bool is_io() const;
730730

731731
///@brief Returns the relative pin index within a sub tile that corresponds to the pin within the given port and its index in the port
732732
int find_pin(std::string_view port_name, int pin_index_in_port) const;

vpr/src/base/ShowSetup.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ ClusteredNetlistStats::ClusteredNetlistStats() {
135135
auto logical_block = cluster_ctx.clb_nlist.block_type(blk_id);
136136
auto physical_tile = pick_physical_type(logical_block);
137137
num_blocks_type[logical_block->index]++;
138-
if (is_io_type(physical_tile)) {
138+
if (physical_tile->is_io()) {
139139
for (int j = 0; j < logical_block->pb_type->num_pins; j++) {
140140
int physical_pin = get_physical_pin(physical_tile, logical_block, j);
141141

vpr/src/base/check_netlist.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,8 +110,7 @@ static int check_connections_to_global_clb_pins(ClusterNetId net_id, int verbosi
110110
int log_index = cluster_ctx.clb_nlist.pin_logical_index(pin_id);
111111
int pin_index = get_physical_pin(physical_type, logical_type, log_index);
112112

113-
if (physical_type->is_ignored_pin[pin_index] != net_is_ignored
114-
&& !is_io_type(physical_type)) {
113+
if (physical_type->is_ignored_pin[pin_index] != net_is_ignored && !physical_type->is_io()) {
115114
VTR_LOGV_WARN(verbosity > 2,
116115
"Global net '%s' connects to non-global architecture pin '%s' (netlist pin '%s')\n",
117116
cluster_ctx.clb_nlist.net_name(net_id).c_str(),

vpr/src/base/read_route.cpp

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,7 @@ static void process_nodes(const Netlist<>& net_list, std::ifstream& fp, ClusterN
296296
/* Verify types and ptc*/
297297
if (tokens[2] == "SOURCE" || tokens[2] == "SINK" || tokens[2] == "OPIN" || tokens[2] == "IPIN") {
298298
const auto& type = device_ctx.grid.get_physical_type({x, y, layer_num});
299-
if (tokens[4 + offset] == "Pad:" && !is_io_type(type)) {
299+
if (tokens[4 + offset] == "Pad:" && !type->is_io()) {
300300
vpr_throw(VPR_ERROR_ROUTE, filename, lineno,
301301
"Node %d is of the wrong type", inode);
302302
}
@@ -319,7 +319,7 @@ static void process_nodes(const Netlist<>& net_list, std::ifstream& fp, ClusterN
319319
if (tokens[6 + offset] != "Switch:") {
320320
/*This is an opin or ipin, process its pin nums*/
321321
auto type = device_ctx.grid.get_physical_type({x, y, layer_num});
322-
if (!is_io_type(type) && (tokens[2] == "IPIN" || tokens[2] == "OPIN")) {
322+
if (!type->is_io() && (tokens[2] == "IPIN" || tokens[2] == "OPIN")) {
323323
int pin_num = rr_graph.node_pin_num(RRNodeId(inode));
324324
int width_offset = device_ctx.grid.get_width_offset({x, y, layer_num});
325325
int height_offset = device_ctx.grid.get_height_offset({x, y, layer_num});
@@ -592,10 +592,13 @@ void print_route(const Netlist<>& net_list,
592592
fprintf(fp, "to (%d,%d,%d) ", rr_graph.node_xhigh(inode),
593593
rr_graph.node_yhigh(inode), layer_num);
594594

595+
t_physical_tile_type_ptr physical_tile = device_ctx.grid.get_physical_type({ilow, jlow, layer_num});
596+
595597
switch (rr_type) {
596598
case e_rr_type::IPIN:
597599
case e_rr_type::OPIN:
598-
if (is_io_type(device_ctx.grid.get_physical_type({ilow, jlow, layer_num}))) {
600+
601+
if (physical_tile->is_io()) {
599602
fprintf(fp, " Pad: ");
600603
} else { /* IO Pad. */
601604
fprintf(fp, " Pin: ");
@@ -609,7 +612,7 @@ void print_route(const Netlist<>& net_list,
609612

610613
case e_rr_type::SOURCE:
611614
case e_rr_type::SINK:
612-
if (is_io_type(device_ctx.grid.get_physical_type({ilow, jlow, layer_num}))) {
615+
if (physical_tile->is_io()) {
613616
fprintf(fp, " Pad: ");
614617
} else { /* IO Pad. */
615618
fprintf(fp, " Class: ");
@@ -625,8 +628,8 @@ void print_route(const Netlist<>& net_list,
625628

626629
fprintf(fp, "%d ", rr_graph.node_ptc_num(inode));
627630

628-
auto physical_tile = device_ctx.grid.get_physical_type({ilow, jlow, layer_num});
629-
if (!is_io_type(physical_tile) && (rr_type == e_rr_type::IPIN || rr_type == e_rr_type::OPIN)) {
631+
632+
if (!physical_tile->is_io() && (rr_type == e_rr_type::IPIN || rr_type == e_rr_type::OPIN)) {
630633
int pin_num = rr_graph.node_pin_num(inode);
631634
int xoffset = device_ctx.grid.get_width_offset({ilow, jlow, layer_num});
632635
int yoffset = device_ctx.grid.get_height_offset({ilow, jlow, layer_num});

vpr/src/base/stats.cpp

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -91,10 +91,7 @@ void routing_stats(const Netlist<>& net_list,
9191
auto type = device_ctx.grid.get_physical_type({i, j, layer_num});
9292
int width_offset = device_ctx.grid.get_width_offset({i, j, layer_num});
9393
int height_offset = device_ctx.grid.get_height_offset({i, j, layer_num});
94-
if (width_offset == 0
95-
&& height_offset == 0
96-
&& !is_io_type(type)
97-
&& type != device_ctx.EMPTY_PHYSICAL_TILE_TYPE) {
94+
if (width_offset == 0 && height_offset == 0 && !type->is_io() && !type->is_empty()) {
9895
if (type->area == UNDEFINED) {
9996
area += grid_logic_tile_area * type->width * type->height;
10097
} else {
@@ -111,7 +108,7 @@ void routing_stats(const Netlist<>& net_list,
111108
for (ClusterBlockId blk_id : cluster_ctx.clb_nlist.blocks()) {
112109
t_pl_loc block_loc = block_locs[blk_id].loc;
113110
auto type = physical_tile_type(block_loc);
114-
if (!is_io_type(type)) {
111+
if (!type->is_io()) {
115112
if (type->area == UNDEFINED) {
116113
used_area += grid_logic_tile_area * type->width * type->height;
117114
} else {
@@ -473,7 +470,7 @@ void print_lambda() {
473470
t_pl_loc block_loc = block_locs[blk_id].loc;
474471
auto type = physical_tile_type(block_loc);
475472
VTR_ASSERT(type != nullptr);
476-
if (!is_io_type(type)) {
473+
if (!type->is_io()) {
477474
for (int ipin = 0; ipin < type->num_pins; ipin++) {
478475
if (get_pin_type_from_pin_physical_num(type, ipin) == RECEIVER) {
479476
ClusterNetId net_id = cluster_ctx.clb_nlist.block_net(blk_id, ipin);

vpr/src/pack/appack_max_dist_th_manager.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ void APPackMaxDistThManager::auto_set_max_distance_thresholds(const std::vector<
100100
// Find which type(s) this logical block type looks like.
101101
bool has_memory = has_memory_pbs(lb_ty.pb_type);
102102
bool is_logic_block_type = (lb_ty.index == logic_block_type->index);
103-
bool is_io_block = is_io_type(pick_physical_type(&lb_ty));
103+
bool is_io_block = pick_physical_type(&lb_ty)->is_io();
104104

105105
// Update the max distance threshold based on the type. If the logical
106106
// block type looks like many block types at the same time (for example

vpr/src/place/initial_placement.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1012,10 +1012,10 @@ static inline void fix_IO_block_types(const t_pl_macro& pl_macro,
10121012
vtr::vector_map<ClusterBlockId, t_block_loc>& block_locs) {
10131013
const auto& device_ctx = g_vpr_ctx.device();
10141014

1015-
//If the user marked the IO block pad_loc_type as RANDOM, that means it should be randomly
1016-
//placed and then stay fixed to that location, which is why the macro members are marked as fixed.
1017-
const auto& type = device_ctx.grid.get_physical_type({loc.x, loc.y, loc.layer});
1018-
if (is_io_type(type) && pad_loc_type == e_pad_loc_type::RANDOM) {
1015+
// If the user marked the IO block pad_loc_type as RANDOM, that means it should be randomly
1016+
// placed and then stay fixed to that location, which is why the macro members are marked as fixed.
1017+
const t_physical_tile_type_ptr type = device_ctx.grid.get_physical_type({loc.x, loc.y, loc.layer});
1018+
if (type->is_io() && pad_loc_type == e_pad_loc_type::RANDOM) {
10191019
for (const t_pl_macro_member& pl_macro_member : pl_macro.members) {
10201020
block_locs[pl_macro_member.blk_index].is_fixed = true;
10211021
}

vpr/src/route/route_common.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -358,7 +358,7 @@ static t_clb_opins_used alloc_and_load_clb_opins_used_locally() {
358358

359359
clb_opins_used_locally[blk_id].resize((int)type->class_inf.size());
360360

361-
if (is_io_type(type)) continue;
361+
if (type->is_io()) continue;
362362

363363
const auto [pin_low, pin_high] = get_pin_range_for_block(blk_id);
364364

vpr/src/route/rr_graph_generation/rr_node_indices.cpp

Lines changed: 20 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
#include "describe_rr_node.h"
55
#include "globals.h"
66
#include "physical_types_util.h"
7+
#include "vpr_utils.h"
78

89
/**
910
* @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,
7071
static void load_block_rr_indices(RRGraphBuilder& rr_graph_builder,
7172
const DeviceGrid& grid,
7273
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
7475
for (int layer = 0; layer < grid.get_num_layers(); layer++) {
7576
for (int x = 0; x < (int)grid.width(); x++) {
7677
for (int y = 0; y < (int)grid.height(); y++) {
7778
//Process each block from its root location
7879
if (grid.is_root_location({x, y, layer})) {
7980
t_physical_tile_type_ptr physical_type = grid.get_physical_type({x, y, layer});
8081

81-
//Assign indices for SINKs and SOURCEs
82+
// Assign indices for SINKs and SOURCEs
8283
// Note that SINKS/SOURCES have no side, so we always use side 0
8384
std::vector<int> class_num_vec = get_tile_root_classes(physical_type);
8485
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,
124125
* for the same input pin on multiple sides, and thus avoid multiple driver problems
125126
*/
126127
std::vector<e_side> wanted_sides;
127-
if ((int)grid.height() - 1 == y) { /* TOP side */
128+
if ((int)grid.height() - 1 == y) { // TOP side
128129
wanted_sides.push_back(BOTTOM);
129130
}
130-
if ((int)grid.width() - 1 == x) { /* RIGHT side */
131+
if ((int)grid.width() - 1 == x) { // RIGHT side
131132
wanted_sides.push_back(LEFT);
132133
}
133-
if (0 == y) { /* BOTTOM side */
134+
if (0 == y) { // BOTTOM side
134135
wanted_sides.push_back(TOP);
135136
}
136-
if (0 == x) { /* LEFT side */
137+
if (0 == x) { // LEFT side
137138
wanted_sides.push_back(RIGHT);
138139
}
139140

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
143142
if (wanted_sides.empty()) {
144143
for (e_side side : TOTAL_2D_SIDES) {
145144
wanted_sides.push_back(side);
@@ -262,7 +261,7 @@ static void add_pins_spatial_lookup(RRGraphBuilder& rr_graph_builder,
262261
int x_tile = root_x + width_offset;
263262
for (int height_offset = 0; height_offset < physical_type_ptr->height; ++height_offset) {
264263
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
266265
rr_graph_builder.node_lookup().reserve_nodes(layer, x_tile, y_tile, e_rr_type::OPIN, physical_type_ptr->num_pins, side);
267266
rr_graph_builder.node_lookup().reserve_nodes(layer, x_tile, y_tile, e_rr_type::IPIN, physical_type_ptr->num_pins, side);
268267
}
@@ -309,15 +308,15 @@ void alloc_and_load_rr_node_indices(RRGraphBuilder& rr_graph_builder,
309308
int* index,
310309
const t_chan_details& chan_details_x,
311310
const t_chan_details& chan_details_y) {
312-
/* Alloc the lookup table */
311+
// Alloc the lookup table
313312
for (e_rr_type rr_type : RR_TYPES) {
314313
rr_graph_builder.node_lookup().resize_nodes(grid.get_num_layers(), grid.width(), grid.height(), rr_type, NUM_2D_SIDES);
315314
}
316315

317-
/* Assign indices for block nodes */
316+
// Assign indices for block nodes
318317
load_block_rr_indices(rr_graph_builder, grid, index);
319318

320-
/* Load the data for x and y channels */
319+
// Load the data for x and y channels
321320
load_chan_rr_indices(nodes_per_chan.x_max, grid, grid.width(), grid.height(),
322321
e_rr_type::CHANX, chan_details_x, rr_graph_builder.node_lookup(), index);
323322
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,
341340
const auto& device_ctx = g_vpr_ctx.device();
342341

343342
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
345344
if (!device_ctx.inter_cluster_prog_routing_resources.at(layer)) {
346345
continue;
347346
}
@@ -412,10 +411,10 @@ void alloc_and_load_intra_cluster_rr_node_indices(RRGraphBuilder& rr_graph_build
412411
for (int layer = 0; layer < grid.get_num_layers(); layer++) {
413412
for (int x = 0; x < (int)grid.width(); x++) {
414413
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
416415
if (grid.is_root_location({x, y, layer})) {
417416
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
419418
// Note that SINKS/SOURCES have no side, so we always use side 0
420419
std::vector<int> class_num_vec;
421420
std::vector<int> pin_num_vec;
@@ -467,7 +466,7 @@ bool verify_rr_node_indices(const DeviceGrid& grid,
467466
for (int x = 0; x < width; ++x) {
468467
for (int y = 0; y < height; ++y) {
469468
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)
471470
std::vector<RRNodeId> nodes_from_lookup;
472471
if (rr_type == e_rr_type::CHANX || rr_type == e_rr_type::CHANY) {
473472
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,
584583
RRNodeId inode = kv.first;
585584
int count = kv.second;
586585

587-
auto& rr_node = rr_nodes[size_t(inode)];
586+
const t_rr_node& rr_node = rr_nodes[size_t(inode)];
588587

589588
if (rr_graph.node_type(inode) == e_rr_type::SOURCE || rr_graph.node_type(inode) == e_rr_type::SINK) {
590589
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,
597596
count,
598597
describe_rr_node(rr_graph, grid, rr_indexed_data, inode, is_flat).c_str());
599598
}
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+
603602
} else if ((e_rr_type::OPIN != rr_graph.node_type(inode)) && (e_rr_type::IPIN != rr_graph.node_type(inode))) {
604603
if (count != rr_node.length() + 1) {
605604
VPR_ERROR(VPR_ERROR_ROUTE, "Mismatch between RR node length (%d) and count within rr_node_indices (%d, should be length + 1): %s",

vpr/src/util/vpr_utils.h

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -286,13 +286,6 @@ std::vector<int> get_cluster_netlist_intra_tile_classes_at_loc(int layer,
286286

287287
/**
288288
* @brief Returns the list of pins inside the tile located at (layer, i, j), except for the ones which are on a chain
289-
* @param layer
290-
* @param i
291-
* @param j
292-
* @param pin_chains
293-
* @param pin_chains_num
294-
* @param physical_type
295-
* @return
296289
*/
297290
std::vector<int> get_cluster_netlist_intra_tile_pins_at_loc(const int layer,
298291
const int i,

0 commit comments

Comments
 (0)