Skip to content

Commit eb54502

Browse files
make format
enum class e_rr_type a few remaining t_rr_type vals CHANY ---> t_rr_type::CHANY CHANX ---> t_rr_type::CHANX OPIN ---> t_rr_type::OPIN IPIN ---> t_rr_type::IPIN SINK ---> t_rr_type::SINK SOURCE ---> t_rr_type::SOURCE
1 parent d5dc5f7 commit eb54502

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

62 files changed

+701
-720
lines changed

libs/librrgraph/src/base/check_rr_graph.cpp

+36-36
Original file line numberDiff line numberDiff line change
@@ -154,22 +154,22 @@ void check_rr_graph(const RRGraphView& rr_graph,
154154
* - CHAN -> IPIN connections (unique rr_node for IPIN nodes on multiple sides)
155155
* - OPIN -> CHAN connections (unique rr_node for OPIN nodes on multiple sides)
156156
*/
157-
bool is_chan_to_chan = (rr_type == CHANX || rr_type == CHANY) && (to_rr_type == CHANY || to_rr_type == CHANX);
158-
bool is_chan_to_ipin = (rr_type == CHANX || rr_type == CHANY) && to_rr_type == IPIN;
159-
bool is_opin_to_chan = rr_type == OPIN && (to_rr_type == CHANX || to_rr_type == CHANY);
157+
bool is_chan_to_chan = (rr_type == t_rr_type::CHANX || rr_type == t_rr_type::CHANY) && (to_rr_type == t_rr_type::CHANY || to_rr_type == t_rr_type::CHANX);
158+
bool is_chan_to_ipin = (rr_type == t_rr_type::CHANX || rr_type == t_rr_type::CHANY) && to_rr_type == t_rr_type::IPIN;
159+
bool is_opin_to_chan = rr_type == t_rr_type::OPIN && (to_rr_type == t_rr_type::CHANX || to_rr_type == t_rr_type::CHANY);
160160
bool is_internal_edge = false;
161161
if (is_flat) {
162-
is_internal_edge = (rr_type == IPIN && to_rr_type == IPIN) || (rr_type == OPIN && to_rr_type == OPIN);
162+
is_internal_edge = (rr_type == t_rr_type::IPIN && to_rr_type == t_rr_type::IPIN) || (rr_type == t_rr_type::OPIN && to_rr_type == t_rr_type::OPIN);
163163
}
164164
if (!(is_chan_to_chan || is_chan_to_ipin || is_opin_to_chan || is_internal_edge)) {
165165
VPR_ERROR(VPR_ERROR_ROUTE,
166166
"in check_rr_graph: node %d (%s) connects to node %d (%s) %zu times - multi-connections only expected for CHAN<->CHAN, CHAN->IPIN, OPIN->CHAN.\n",
167-
inode, rr_node_typename[rr_type], to_node, rr_node_typename[to_rr_type], num_edges_to_node);
167+
inode, rr_node_typename[(size_t)rr_type], to_node, rr_node_typename[(size_t)to_rr_type], num_edges_to_node);
168168
}
169169

170170
//Between two wire segments
171-
VTR_ASSERT_MSG(to_rr_type == CHANX || to_rr_type == CHANY || to_rr_type == IPIN, "Expect channel type or input pin type");
172-
VTR_ASSERT_MSG(rr_type == CHANX || rr_type == CHANY || rr_type == OPIN, "Expect channel type or output pin type");
171+
VTR_ASSERT_MSG(to_rr_type == t_rr_type::CHANX || to_rr_type == t_rr_type::CHANY || to_rr_type == t_rr_type::IPIN, "Expect channel type or input pin type");
172+
VTR_ASSERT_MSG(rr_type == t_rr_type::CHANX || rr_type == t_rr_type::CHANY || rr_type == t_rr_type::OPIN, "Expect channel type or output pin type");
173173

174174
//While multiple connections between the same wires can be electrically legal,
175175
//they are redundant if they are of the same switch type.
@@ -190,8 +190,8 @@ void check_rr_graph(const RRGraphView& rr_graph,
190190
/* Redundant edges are not allowed for chan <-> chan connections
191191
* but allowed for input pin <-> chan or output pin <-> chan connections
192192
*/
193-
if ((to_rr_type == CHANX || to_rr_type == CHANY)
194-
&& (rr_type == CHANX || rr_type == CHANY)) {
193+
if ((to_rr_type == t_rr_type::CHANX || to_rr_type == t_rr_type::CHANY)
194+
&& (rr_type == t_rr_type::CHANX || rr_type == t_rr_type::CHANY)) {
195195
auto switch_type = rr_graph.rr_switch_inf(RRSwitchId(kv.first)).type();
196196

197197
VPR_ERROR(VPR_ERROR_ROUTE, "in check_rr_graph: node %d has %d redundant connections to node %d of switch type %d (%s)",
@@ -240,22 +240,22 @@ void check_rr_graph(const RRGraphView& rr_graph,
240240

241241
t_physical_tile_type_ptr type = grid.get_physical_type({xlow, ylow, layer_num});
242242

243-
if (rr_type == IPIN || rr_type == OPIN) {
243+
if (rr_type == t_rr_type::IPIN || rr_type == t_rr_type::OPIN) {
244244
// #TODO: No edges are added for internal pins. However, they need to be checked somehow!
245245
if (ptc_num >= type->num_pins) {
246246
VTR_LOG_ERROR("in check_rr_graph: node %d (%s) type: %s is internal node.\n",
247-
inode, rr_graph.node_type_string(rr_node), rr_node_typename[rr_type]);
247+
inode, rr_graph.node_type_string(rr_node), rr_node_typename[(size_t)rr_type]);
248248
}
249249
}
250250

251-
if (rr_type != SOURCE) {
251+
if (rr_type != t_rr_type::SOURCE) {
252252
if (total_edges_to_node[inode] < 1 && !rr_node_is_global_clb_ipin(rr_graph, grid, rr_node)) {
253253
/* A global CLB input pin will not have any edges, and neither will *
254254
* a SOURCE or the start of a carry-chain. Anything else is an error.
255255
* For simplicity, carry-chain input pin are entirely ignored in this test
256256
*/
257257
bool is_chain = false;
258-
if (rr_type == IPIN) {
258+
if (rr_type == t_rr_type::IPIN) {
259259
for (const t_fc_specification& fc_spec : types[type->index].fc_specs) {
260260
if (fc_spec.fc_value == 0 && fc_spec.seg_index == 0) {
261261
is_chain = true;
@@ -269,11 +269,11 @@ void check_rr_graph(const RRGraphView& rr_graph,
269269
|| (rr_graph.node_ylow(rr_node) == 1)
270270
|| (rr_graph.node_xhigh(rr_node) == int(grid.width()) - 2)
271271
|| (rr_graph.node_yhigh(rr_node) == int(grid.height()) - 2));
272-
bool is_wire = (rr_graph.node_type(rr_node) == CHANX
273-
|| rr_graph.node_type(rr_node) == CHANY);
272+
bool is_wire = (rr_graph.node_type(rr_node) == t_rr_type::CHANX
273+
|| rr_graph.node_type(rr_node) == t_rr_type::CHANY);
274274

275275
if (!is_chain && !is_fringe && !is_wire) {
276-
if (rr_graph.node_type(rr_node) == IPIN || rr_graph.node_type(rr_node) == OPIN) {
276+
if (rr_graph.node_type(rr_node) == t_rr_type::IPIN || rr_graph.node_type(rr_node) == t_rr_type::OPIN) {
277277
if (has_adjacent_channel(rr_graph, grid, node)) {
278278
auto block_type = grid.get_physical_type({rr_graph.node_xlow(rr_node),
279279
rr_graph.node_ylow(rr_node),
@@ -320,7 +320,7 @@ static bool rr_node_is_global_clb_ipin(const RRGraphView& rr_graph, const Device
320320
rr_graph.node_ylow(inode),
321321
rr_graph.node_layer(inode)});
322322

323-
if (rr_graph.node_type(inode) != IPIN)
323+
if (rr_graph.node_type(inode) != t_rr_type::IPIN)
324324
return (false);
325325

326326
ipin = rr_graph.node_pin_num(inode);
@@ -389,7 +389,7 @@ void check_rr_node(const RRGraphView& rr_graph,
389389
type = grid.get_physical_type({xlow, ylow, layer_num});
390390

391391
switch (rr_type) {
392-
case SOURCE:
392+
case t_rr_type::SOURCE:
393393
if (type == nullptr) {
394394
VPR_FATAL_ERROR(VPR_ERROR_ROUTE,
395395
"in check_rr_node: node %d (type %d) is at an illegal clb location (%d, %d).\n", inode, rr_type, xlow, ylow);
@@ -400,7 +400,7 @@ void check_rr_node(const RRGraphView& rr_graph,
400400
"in check_rr_node: node %d (type %d) has endpoints (%d,%d) and (%d,%d)\n", inode, rr_type, xlow, ylow, xhigh, yhigh);
401401
}
402402
break;
403-
case SINK: {
403+
case t_rr_type::SINK: {
404404
if (type == nullptr) {
405405
VPR_FATAL_ERROR(VPR_ERROR_ROUTE,
406406
"in check_rr_node: node %d (type %d) is at an illegal clb location (%d, %d).\n", inode, rr_type, xlow, ylow);
@@ -413,8 +413,8 @@ void check_rr_node(const RRGraphView& rr_graph,
413413
}
414414
break;
415415
}
416-
case IPIN:
417-
case OPIN:
416+
case t_rr_type::IPIN:
417+
case t_rr_type::OPIN:
418418
if (type == nullptr) {
419419
VPR_FATAL_ERROR(VPR_ERROR_ROUTE,
420420
"in check_rr_node: node %d (type %d) is at an illegal clb location (%d, %d).\n", inode, rr_type, xlow, ylow);
@@ -425,7 +425,7 @@ void check_rr_node(const RRGraphView& rr_graph,
425425
}
426426
break;
427427

428-
case CHANX:
428+
case t_rr_type::CHANX:
429429
if (xlow < 1 || xhigh > int(grid.width()) - 2 || yhigh > int(grid.height()) - 2 || yhigh != ylow) {
430430
VPR_FATAL_ERROR(VPR_ERROR_ROUTE,
431431
"in check_rr_node: CHANX out of range for endpoints (%d,%d) and (%d,%d)\n", xlow, ylow, xhigh, yhigh);
@@ -436,7 +436,7 @@ void check_rr_node(const RRGraphView& rr_graph,
436436
}
437437
break;
438438

439-
case CHANY:
439+
case t_rr_type::CHANY:
440440
if (xhigh > int(grid.width()) - 2 || ylow < 1 || yhigh > int(grid.height()) - 2 || xlow != xhigh) {
441441
VPR_FATAL_ERROR(VPR_ERROR_ROUTE,
442442
"Error in check_rr_node: CHANY out of range for endpoints (%d,%d) and (%d,%d)\n", xlow, ylow, xhigh, yhigh);
@@ -459,12 +459,12 @@ void check_rr_node(const RRGraphView& rr_graph,
459459
e_pin_type class_type = OPEN;
460460
int class_num_pins = -1;
461461
switch (rr_type) {
462-
case SOURCE:
463-
case SINK:
462+
case t_rr_type::SOURCE:
463+
case t_rr_type::SINK:
464464
class_type = get_class_type_from_class_physical_num(type, ptc_num);
465465
class_num_pins = get_class_num_pins_from_class_physical_num(type, ptc_num);
466466
if (ptc_num >= class_max_ptc
467-
|| class_type != ((rr_type == SOURCE) ? DRIVER : RECEIVER)) {
467+
|| class_type != ((rr_type == t_rr_type::SOURCE) ? DRIVER : RECEIVER)) {
468468
VPR_ERROR(VPR_ERROR_ROUTE,
469469
"in check_rr_node: inode %d (type %d) had a ptc_num of %d.\n", inode, rr_type, ptc_num);
470470
}
@@ -474,11 +474,11 @@ void check_rr_node(const RRGraphView& rr_graph,
474474
}
475475
break;
476476

477-
case OPIN:
478-
case IPIN:
477+
case t_rr_type::OPIN:
478+
case t_rr_type::IPIN:
479479
class_type = get_pin_type_from_pin_physical_num(type, ptc_num);
480480
if (ptc_num >= pin_max_ptc
481-
|| class_type != ((rr_type == OPIN) ? DRIVER : RECEIVER)) {
481+
|| class_type != ((rr_type == t_rr_type::OPIN) ? DRIVER : RECEIVER)) {
482482
VPR_ERROR(VPR_ERROR_ROUTE,
483483
"in check_rr_node: inode %d (type %d) had a ptc_num of %d.\n", inode, rr_type, ptc_num);
484484
}
@@ -488,14 +488,14 @@ void check_rr_node(const RRGraphView& rr_graph,
488488
}
489489
break;
490490

491-
case CHANX:
492-
case CHANY:
491+
case t_rr_type::CHANX:
492+
case t_rr_type::CHANY:
493493
if (route_type == DETAILED) {
494494
nodes_per_chan = chan_width.max;
495495
tracks_per_node = 1;
496496
} else {
497497
nodes_per_chan = 1;
498-
tracks_per_node = ((rr_type == CHANX) ? chan_width.x_list[ylow] : chan_width.y_list[xlow]);
498+
tracks_per_node = ((rr_type == t_rr_type::CHANX) ? chan_width.x_list[ylow] : chan_width.y_list[xlow]);
499499
}
500500

501501
//if a chanx/chany has length 0, it means it is used to connect different dice together
@@ -522,7 +522,7 @@ void check_rr_node(const RRGraphView& rr_graph,
522522
C = rr_graph.node_C(rr_node);
523523
R = rr_graph.node_R(rr_node);
524524

525-
if (rr_type == CHANX || rr_type == CHANY) {
525+
if (rr_type == t_rr_type::CHANX || rr_type == t_rr_type::CHANY) {
526526
if (C < 0. || R < 0.) {
527527
VPR_ERROR(VPR_ERROR_ROUTE,
528528
"in check_rr_node: node %d of type %d has R = %g and C = %g.\n", inode, rr_type, R, C);
@@ -545,7 +545,7 @@ static void check_unbuffered_edges(const RRGraphView& rr_graph, int from_node) {
545545
bool trans_matched;
546546

547547
from_rr_type = rr_graph.node_type(RRNodeId(from_node));
548-
if (from_rr_type != CHANX && from_rr_type != CHANY)
548+
if (from_rr_type != t_rr_type::CHANX && from_rr_type != t_rr_type::CHANY)
549549
return;
550550

551551
from_num_edges = rr_graph.num_edges(RRNodeId(from_node));
@@ -554,7 +554,7 @@ static void check_unbuffered_edges(const RRGraphView& rr_graph, int from_node) {
554554
to_node = size_t(rr_graph.edge_sink_node(RRNodeId(from_node), from_edge));
555555
to_rr_type = rr_graph.node_type(RRNodeId(to_node));
556556

557-
if (to_rr_type != CHANX && to_rr_type != CHANY)
557+
if (to_rr_type != t_rr_type::CHANX && to_rr_type != t_rr_type::CHANY)
558558
continue;
559559

560560
from_switch_type = rr_graph.edge_switch(RRNodeId(from_node), from_edge);
@@ -592,7 +592,7 @@ static bool has_adjacent_channel(const RRGraphView& rr_graph, const DeviceGrid&
592592
/* TODO: this function should be reworked later to adapt RRGraphView interface
593593
* once xlow(), ylow(), side() APIs are implemented
594594
*/
595-
VTR_ASSERT(rr_graph.node_type(node.id()) == IPIN || rr_graph.node_type(node.id()) == OPIN);
595+
VTR_ASSERT(rr_graph.node_type(node.id()) == t_rr_type::IPIN || rr_graph.node_type(node.id()) == e_rr_type::OPIN);
596596

597597
if ((rr_graph.node_xlow(node.id()) == 0 && !rr_graph.is_node_on_specific_side(node.id(), RIGHT)) //left device edge connects only along block's right side
598598
|| (rr_graph.node_ylow(node.id()) == int(grid.height() - 1) && !rr_graph.is_node_on_specific_side(node.id(), BOTTOM)) //top device edge connects only along block's bottom side

libs/librrgraph/src/base/check_rr_graph_obj.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ static bool check_rr_graph_source_nodes(const RRGraph& rr_graph) {
9494
*/
9595
for (auto node : rr_graph.nodes()) {
9696
/* Pass nodes whose types are not SOURCE */
97-
if (SOURCE != rr_graph.node_type(node)) {
97+
if (t_rr_type::SOURCE != rr_graph.node_type(node)) {
9898
continue;
9999
}
100100
if ((0 != rr_graph.node_fan_in(node))
@@ -123,7 +123,7 @@ static bool check_rr_graph_sink_nodes(const RRGraph& rr_graph) {
123123
*/
124124
for (auto node : rr_graph.nodes()) {
125125
/* Pass nodes whose types are not SINK */
126-
if (SINK != rr_graph.node_type(node)) {
126+
if (t_rr_type::SINK != rr_graph.node_type(node)) {
127127
continue;
128128
}
129129
if ((0 == rr_graph.node_fan_in(node))

libs/librrgraph/src/base/rr_graph_builder.cpp

+6-6
Original file line numberDiff line numberDiff line change
@@ -36,20 +36,20 @@ void RRGraphBuilder::add_node_to_all_locs(RRNodeId node) {
3636
node_ptc_num += node_twist * node_offset;
3737
node_offset++;
3838
switch (node_type) {
39-
case SOURCE:
40-
case SINK:
41-
case CHANY:
39+
case t_rr_type::SOURCE:
40+
case t_rr_type::SINK:
41+
case t_rr_type::CHANY:
4242
node_lookup_.add_node(node, node_layer, ix, iy, node_type, node_ptc_num, TOTAL_2D_SIDES[0]);
4343
break;
44-
case CHANX:
44+
case t_rr_type::CHANX:
4545
/* Currently need to swap x and y for CHANX because of chan, seg convention
4646
* TODO: Once the builders is reworked for use consistent (x, y) convention,
4747
* the following swapping can be removed
4848
*/
4949
node_lookup_.add_node(node, node_layer, iy, ix, node_type, node_ptc_num, TOTAL_2D_SIDES[0]);
5050
break;
51-
case OPIN:
52-
case IPIN:
51+
case t_rr_type::OPIN:
52+
case t_rr_type::IPIN:
5353
for (const e_side& side : TOTAL_2D_SIDES) {
5454
if (node_storage_.is_node_on_specific_side(node, side)) {
5555
node_lookup_.add_node(node,node_layer, ix, iy, node_type, node_ptc_num, side);

0 commit comments

Comments
 (0)