Skip to content

Commit 8609cfb

Browse files
committed
Adjusted some of the instances of node_ptc_num() to node_class_num(), node_track_num(), node_pin_num()
Signed-off-by: Ethan Rogers <[email protected]>
1 parent 6cc0ec3 commit 8609cfb

File tree

10 files changed

+36
-24
lines changed

10 files changed

+36
-24
lines changed

utils/fasm/test/test_fasm.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ static std::string get_pin_feature (size_t inode) {
192192
int ilow = rr_graph.node_xlow(RRNodeId(inode));
193193
int jlow = rr_graph.node_ylow(RRNodeId(inode));
194194
auto physical_tile = device_ctx.grid[ilow][jlow].type;
195-
int pin_num = rr_graph.node_ptc_num(RRNodeId(inode));
195+
int pin_num = rr_graph.node_pin_num(RRNodeId(inode));
196196

197197
// Get the sub tile (type, not instance) and index of its pin that matches
198198
// the node index.

vpr/src/base/read_route.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -317,7 +317,7 @@ static void process_nodes(std::ifstream& fp, ClusterNetId inet, const char* file
317317
if (tokens[6 + offset] != "Switch:") {
318318
/*This is an opin or ipin, process its pin nums*/
319319
if (!is_io_type(device_ctx.grid[x][y].type) && (tokens[2] == "IPIN" || tokens[2] == "OPIN")) {
320-
int pin_num = rr_graph.node_ptc_num(RRNodeId(inode));
320+
int pin_num = rr_graph.node_pin_num(RRNodeId(inode));
321321

322322
auto type = device_ctx.grid[x][y].type;
323323
int height_offset = device_ctx.grid[x][y].height_offset;

vpr/src/device/rr_graph_view.h

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -248,23 +248,35 @@ class RRGraphView {
248248
inline const char* node_side_string(RRNodeId node) const {
249249
return node_storage_.node_side_string(node);
250250
}
251+
252+
/** @brief The ptc_num carries different meanings for different node types
253+
* (true in VPR RRG that is currently supported, may not be true in customized RRG)
254+
* CHANX or CHANY: the track id in routing channels
255+
* OPIN or IPIN: the index of pins in the logic block data structure
256+
* SOURCE and SINK: the class id of a pin (indicating logic equivalence of pins) in the logic block data structure
257+
* @note
258+
* This API is very powerful and developers should not use it unless it is necessary,
259+
* e.g the node type is unknown. If the node type is known, the more specific routines, `node_pin_num()`,
260+
* `node_track_num()`and `node_class_num()`, for different types of nodes should be used.*/
251261

252-
/** @brief Get the ptc num of a routing resource node. This function is inlined for runtime optimization. */
253262
inline short node_ptc_num(RRNodeId node) const {
254263
return node_storage_.node_ptc_num(node);
255264
}
256265

257-
/** @brief Get the pin num of a routing resource node. This function is inlined for runtime optimization. */
266+
/** @brief Get the pin num of a routing resource node. This is designed for logic blocks,
267+
* which are IPIN and OPIN nodes. This function is inlined for runtime optimization. */
258268
inline short node_pin_num(RRNodeId node) const {
259269
return node_storage_.node_pin_num(node);
260270
}
261271

262-
/** @brief Get the track num of a routing resource node. This function is inlined for runtime optimization. */
272+
/** @brief Get the track num of a routing resource node. This is designed for routing tracks,
273+
* which are CHANX and CHANY nodes. This function is inlined for runtime optimization. */
263274
inline short node_track_num(RRNodeId node) const {
264275
return node_storage_.node_track_num(node);
265276
}
266-
267-
/** @brief Get the class num of a routing resource node. This function is inlined for runtime optimization. */
277+
278+
/** @brief Get the class num of a routing resource node. This is designed for routing source and sinks,
279+
* which are SOURCE and SINK nodes. This function is inlined for runtime optimization. */
268280
inline short node_class_num(RRNodeId node) const {
269281
return node_storage_.node_class_num(node);
270282
}

vpr/src/draw/draw.cpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2193,18 +2193,18 @@ ezgl::rectangle draw_get_rr_chan_bbox(int inode) {
21932193
+ draw_coords->get_tile_width();
21942194
bottom = draw_coords->tile_y[rr_graph.node_ylow(rr_node)]
21952195
+ draw_coords->get_tile_width()
2196-
+ (1. + rr_graph.node_ptc_num(rr_node));
2196+
+ (1. + rr_graph.node_track_num(rr_node));
21972197
top = draw_coords->tile_y[rr_graph.node_ylow(rr_node)]
21982198
+ draw_coords->get_tile_width()
2199-
+ (1. + rr_graph.node_ptc_num(rr_node));
2199+
+ (1. + rr_graph.node_track_num(rr_node));
22002200
break;
22012201
case CHANY:
22022202
left = draw_coords->tile_x[rr_graph.node_xlow(rr_node)]
22032203
+ draw_coords->get_tile_width()
2204-
+ (1. + rr_graph.node_ptc_num(rr_node));
2204+
+ (1. + rr_graph.node_track_num(rr_node));
22052205
right = draw_coords->tile_x[rr_graph.node_xlow(rr_node)]
22062206
+ draw_coords->get_tile_width()
2207-
+ (1. + rr_graph.node_ptc_num(rr_node));
2207+
+ (1. + rr_graph.node_track_num(rr_node));
22082208
bottom = draw_coords->tile_y[rr_graph.node_ylow(rr_node)];
22092209
top = draw_coords->tile_y[rr_graph.node_yhigh(rr_node)]
22102210
+ draw_coords->get_tile_width();
@@ -2257,7 +2257,7 @@ static void draw_rr_pin(int inode, const ezgl::color& color, ezgl::renderer* g)
22572257
auto& device_ctx = g_vpr_ctx.device();
22582258
const auto& rr_graph = device_ctx.rr_graph;
22592259

2260-
int ipin = rr_graph.node_ptc_num(RRNodeId(inode));
2260+
int ipin = rr_graph.node_pin_num(RRNodeId(inode));
22612261

22622262
g->set_color(color);
22632263

@@ -2305,7 +2305,7 @@ void draw_get_rr_pin_coords(const t_rr_node& node, float* xcen, float* ycen, con
23052305
xc = draw_coords->tile_x[i];
23062306
yc = draw_coords->tile_y[j];
23072307

2308-
ipin = rr_graph.node_ptc_num(rr_node);
2308+
ipin = rr_graph.node_pin_num(rr_node);
23092309
type = device_ctx.grid[i][j].type;
23102310
pins_per_sub_tile = type->num_pins / type->capacity;
23112311
k = ipin / pins_per_sub_tile;
@@ -2364,7 +2364,7 @@ static void draw_rr_src_sink(int inode, ezgl::color color, ezgl::renderer* g) {
23642364
{xcen + draw_coords->pin_size, ycen + draw_coords->pin_size});
23652365

23662366
std::string str = vtr::string_fmt("%d",
2367-
rr_graph.node_ptc_num(RRNodeId(inode)));
2367+
rr_graph.node_class_num(RRNodeId(inode)));
23682368
g->set_color(ezgl::BLACK);
23692369
g->draw_text({xcen, ycen}, str.c_str(), 2 * draw_coords->pin_size,
23702370
2 * draw_coords->pin_size);
@@ -2620,7 +2620,7 @@ static int get_track_num(int inode, const vtr::OffsetMatrix<int>& chanx_track, c
26202620
RRNodeId rr_node = RRNodeId(inode);
26212621

26222622
if (get_draw_state_vars()->draw_route_type == DETAILED)
2623-
return (rr_graph.node_ptc_num(rr_node));
2623+
return (rr_graph.node_track_num(rr_node));
26242624

26252625
/* GLOBAL route stuff below. */
26262626

@@ -2766,7 +2766,7 @@ static int draw_check_rr_node_hit(float click_x, float click_y) {
27662766
t_physical_tile_type_ptr type = device_ctx.grid[i][j].type;
27672767
int width_offset = device_ctx.grid[i][j].width_offset;
27682768
int height_offset = device_ctx.grid[i][j].height_offset;
2769-
int ipin = rr_graph.node_ptc_num(rr_node);
2769+
int ipin = rr_graph.node_pin_num(rr_node);
27702770
float xcen, ycen;
27712771
for (const e_side& iside : SIDES) {
27722772
// If pin exists on this side of the block, then get pin coordinates

vpr/src/route/check_route.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ static void check_source(RRNodeId inode, ClusterNetId net_id) {
214214
int i = rr_graph.node_xlow(inode);
215215
int j = rr_graph.node_ylow(inode);
216216
/* for sinks and sources, ptc_num is class */
217-
int ptc_num = rr_graph.node_ptc_num(inode);
217+
int ptc_num = rr_graph.node_class_num(inode);
218218
/* First node_block for net is the source */
219219
ClusterBlockId blk_id = cluster_ctx.clb_nlist.net_driver_block(net_id);
220220
auto type = device_ctx.grid[i][j].type;
@@ -574,7 +574,7 @@ static void check_locally_used_clb_opins(const t_clb_opins_used& clb_opins_used_
574574
size_t(blk_id), cluster_ctx.clb_nlist.block_name(blk_id).c_str(), iclass, inode, rr_type);
575575
}
576576

577-
ipin = rr_graph.node_ptc_num(RRNodeId(inode));
577+
ipin = rr_graph.node_pin_num(RRNodeId(inode));
578578
if (physical_tile_type(blk_id)->pin_class[ipin] != iclass) {
579579
VPR_FATAL_ERROR(VPR_ERROR_ROUTE,
580580
"in check_locally_used_opins: block #%lu (%s):\n"

vpr/src/route/check_rr_graph.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,7 @@ static bool rr_node_is_global_clb_ipin(RRNodeId inode) {
282282
if (rr_graph.node_type(inode) != IPIN)
283283
return (false);
284284

285-
ipin = rr_graph.node_ptc_num(inode);
285+
ipin = rr_graph.node_pin_num(inode);
286286

287287
return type->is_ignored_pin[ipin];
288288
}

vpr/src/route/clock_connection_builders.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ RRNodeId RoutingToClockConnection::create_virtual_clock_network_sink_node(int x,
103103

104104
int max_ptc = 0;
105105
for (RRNodeId inode : nodes_at_loc) {
106-
max_ptc = std::max<int>(max_ptc, temp_rr_graph.node_ptc_num(inode));
106+
max_ptc = std::max<int>(max_ptc, temp_rr_graph.node_class_num(inode));
107107
}
108108
int ptc = max_ptc + 1;
109109

vpr/src/route/clock_network_builders.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,7 @@ int ClockRib::create_chanx_wire(int x_start,
350350
for (int ix = rr_graph.node_xlow(chanx_node); ix <= rr_graph.node_xhigh(chanx_node); ++ix) {
351351
for (int iy = rr_graph.node_ylow(chanx_node); iy <= rr_graph.node_yhigh(chanx_node); ++iy) {
352352
//TODO: CHANX uses odd swapped x/y indices here. Will rework once rr_node_indices is shadowed
353-
rr_graph_builder.node_lookup().add_node(chanx_node, iy, ix, rr_graph.node_type(chanx_node), rr_graph.node_ptc_num(chanx_node));
353+
rr_graph_builder.node_lookup().add_node(chanx_node, iy, ix, rr_graph.node_type(chanx_node), rr_graph.node_track_num(chanx_node));
354354
}
355355
}
356356

vpr/src/route/route_common.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1283,7 +1283,7 @@ void print_route(FILE* fp, const vtr::vector<ClusterNetId, t_traceback>& traceba
12831283

12841284
auto physical_tile = device_ctx.grid[ilow][jlow].type;
12851285
if (!is_io_type(physical_tile) && (rr_type == IPIN || rr_type == OPIN)) {
1286-
int pin_num = rr_graph.node_ptc_num(rr_node);
1286+
int pin_num = rr_graph.node_pin_num(rr_node);
12871287
int xoffset = device_ctx.grid[ilow][jlow].width_offset;
12881288
int yoffset = device_ctx.grid[ilow][jlow].height_offset;
12891289
int sub_tile_offset = physical_tile->get_sub_tile_loc_from_pin(pin_num);

vpr/src/util/vpr_utils.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -199,11 +199,11 @@ std::string rr_node_arch_name(int inode) {
199199
if (rr_graph.node_type(RRNodeId(inode)) == OPIN || rr_graph.node_type(RRNodeId(inode)) == IPIN) {
200200
//Pin names
201201
auto type = device_ctx.grid[rr_graph.node_xlow(rr_node)][rr_graph.node_ylow(rr_node)].type;
202-
rr_node_arch_name += block_type_pin_index_to_name(type, rr_graph.node_ptc_num(rr_node));
202+
rr_node_arch_name += block_type_pin_index_to_name(type, rr_graph.node_pin_num(rr_node));
203203
} else if (rr_graph.node_type(RRNodeId(inode)) == SOURCE || rr_graph.node_type(RRNodeId(inode)) == SINK) {
204204
//Set of pins associated with SOURCE/SINK
205205
auto type = device_ctx.grid[rr_graph.node_xlow(rr_node)][rr_graph.node_ylow(rr_node)].type;
206-
auto pin_names = block_type_class_index_to_pin_names(type, rr_graph.node_ptc_num(rr_node));
206+
auto pin_names = block_type_class_index_to_pin_names(type, rr_graph.node_class_num(rr_node));
207207
if (pin_names.size() > 1) {
208208
rr_node_arch_name += rr_graph.node_type_string(RRNodeId(inode));
209209
rr_node_arch_name += " connected to ";

0 commit comments

Comments
 (0)