@@ -32,7 +32,7 @@ RRGraph::segment_range RRGraph::segments() const {
3232}
3333
3434// Node attributes
35- t_rr_type RRGraph::node_type (const RRNodeId& node) const {
35+ e_rr_type RRGraph::node_type (const RRNodeId& node) const {
3636 VTR_ASSERT_SAFE (valid_node_id (node));
3737 return node_types_[node];
3838}
@@ -81,7 +81,7 @@ vtr::Rect<short> RRGraph::node_bounding_box(const RRNodeId& node) const {
8181 ***********************************************************************/
8282vtr::Point<short > RRGraph::node_start_coordinate (const RRNodeId& node) const {
8383 /* Make sure we have CHANX or CHANY */
84- VTR_ASSERT ((CHANX == node_type (node)) || (CHANY == node_type (node)));
84+ VTR_ASSERT ((e_rr_type:: CHANX == node_type (node)) || (e_rr_type:: CHANY == node_type (node)));
8585
8686 vtr::Point<short > start_coordinate (node_xlow (node), node_ylow (node));
8787
@@ -105,7 +105,7 @@ vtr::Point<short> RRGraph::node_start_coordinate(const RRNodeId& node) const {
105105 ***********************************************************************/
106106vtr::Point<short > RRGraph::node_end_coordinate (const RRNodeId& node) const {
107107 /* Make sure we have CHANX or CHANY */
108- VTR_ASSERT ((CHANX == node_type (node)) || (CHANY == node_type (node)));
108+ VTR_ASSERT ((e_rr_type:: CHANX == node_type (node)) || (e_rr_type:: CHANY == node_type (node)));
109109
110110 vtr::Point<short > end_coordinate (node_xhigh (node), node_yhigh (node));
111111
@@ -135,19 +135,19 @@ short RRGraph::node_ptc_num(const RRNodeId& node) const {
135135}
136136
137137short RRGraph::node_pin_num (const RRNodeId& node) const {
138- VTR_ASSERT_MSG (node_type (node) == IPIN || node_type (node) == OPIN,
138+ VTR_ASSERT_MSG (node_type (node) == e_rr_type:: IPIN || node_type (node) == e_rr_type:: OPIN,
139139 " Pin number valid only for IPIN/OPIN RR nodes" );
140140 return node_ptc_num (node);
141141}
142142
143143short RRGraph::node_track_num (const RRNodeId& node) const {
144- VTR_ASSERT_MSG (node_type (node) == CHANX || node_type (node) == CHANY,
144+ VTR_ASSERT_MSG (node_type (node) == e_rr_type:: CHANX || node_type (node) == e_rr_type:: CHANY,
145145 " Track number valid only for CHANX/CHANY RR nodes" );
146146 return node_ptc_num (node);
147147}
148148
149149short RRGraph::node_class_num (const RRNodeId& node) const {
150- VTR_ASSERT_MSG (node_type (node) == SOURCE || node_type (node) == SINK, " Class number valid only for SOURCE/SINK RR nodes" );
150+ VTR_ASSERT_MSG (node_type (node) == e_rr_type:: SOURCE || node_type (node) == e_rr_type:: SINK, " Class number valid only for SOURCE/SINK RR nodes" );
151151 return node_ptc_num (node);
152152}
153153
@@ -158,13 +158,13 @@ RRIndexedDataId RRGraph::node_cost_index(const RRNodeId& node) const {
158158
159159Direction RRGraph::node_direction (const RRNodeId& node) const {
160160 VTR_ASSERT_SAFE (valid_node_id (node));
161- VTR_ASSERT_MSG (node_type (node) == CHANX || node_type (node) == CHANY, " Direction valid only for CHANX/CHANY RR nodes" );
161+ VTR_ASSERT_MSG (node_type (node) == e_rr_type:: CHANX || node_type (node) == e_rr_type:: CHANY, " Direction valid only for CHANX/CHANY RR nodes" );
162162 return node_directions_[node];
163163}
164164
165165e_side RRGraph::node_side (const RRNodeId& node) const {
166166 VTR_ASSERT_SAFE (valid_node_id (node));
167- VTR_ASSERT_MSG (node_type (node) == IPIN || node_type (node) == OPIN, " Side valid only for IPIN/OPIN RR nodes" );
167+ VTR_ASSERT_MSG (node_type (node) == e_rr_type:: IPIN || node_type (node) == e_rr_type:: OPIN, " Side valid only for IPIN/OPIN RR nodes" );
168168 return node_sides_[node];
169169}
170170
@@ -372,11 +372,11 @@ std::vector<RREdgeId> RRGraph::find_edges(const RRNodeId& src_node, const RRNode
372372 return matching_edges;
373373}
374374
375- RRNodeId RRGraph::find_node (const short & x, const short & y, const t_rr_type& type, const int & ptc, const e_side& side) const {
375+ RRNodeId RRGraph::find_node (const short & x, const short & y, const e_rr_type type, const int & ptc, const e_side& side) const {
376376 initialize_fast_node_lookup ();
377377
378- size_t itype = type;
379- size_t iside = side;
378+ const size_t itype = ( size_t ) type;
379+ const size_t iside = side;
380380
381381 /* Check if x, y, type and ptc, side is valid */
382382 if ((x < 0 ) /* See if x is smaller than the index of first element */
@@ -401,14 +401,14 @@ RRNodeId RRGraph::find_node(const short& x, const short& y, const t_rr_type& typ
401401
402402 /* Check if x, y, type and ptc, side is valid */
403403 if ((ptc < 0 ) /* See if ptc is smaller than the index of first element */
404- || (size_t (ptc) > node_lookup_[x][y][type ].size () - 1 )) { /* See if ptc is large than the index of last element */
404+ || (size_t (ptc) > node_lookup_[x][y][itype ].size () - 1 )) { /* See if ptc is large than the index of last element */
405405 /* Return a zero range! */
406406 return RRNodeId::INVALID ();
407407 }
408408
409409 /* Check if x, y, type and ptc, side is valid */
410410 /* iside is always larger than -1, we can skip checking */
411- if (iside > node_lookup_[x][y][type ][ptc].size () - 1 ) { /* See if side is large than the index of last element */
411+ if (iside > node_lookup_[x][y][itype ][ptc].size () - 1 ) { /* See if side is large than the index of last element */
412412 /* Return a zero range! */
413413 return RRNodeId::INVALID ();
414414 }
@@ -417,9 +417,9 @@ RRNodeId RRGraph::find_node(const short& x, const short& y, const t_rr_type& typ
417417}
418418
419419/* Find the channel width (number of tracks) of a channel [x][y] */
420- short RRGraph::chan_num_tracks (const short & x, const short & y, const t_rr_type & type) const {
420+ short RRGraph::chan_num_tracks (const short & x, const short & y, const e_rr_type & type) const {
421421 /* Must be CHANX or CHANY */
422- VTR_ASSERT_MSG (CHANX == type || CHANY == type,
422+ VTR_ASSERT_MSG (e_rr_type:: CHANX == type || e_rr_type:: CHANY == type,
423423 " Required node_type to be CHANX or CHANY!" );
424424 initialize_fast_node_lookup ();
425425
@@ -432,18 +432,18 @@ short RRGraph::chan_num_tracks(const short& x, const short& y, const t_rr_type&
432432
433433 /* Check if x, y, type and ptc is valid */
434434 if ((y < 0 ) /* See if y is smaller than the index of first element */
435- || (size_t (y) > node_lookup_[x].size () - 1 )) { /* See if y is large than the index of last element */
435+ || (size_t (y) > node_lookup_[x].size () - 1 )) { /* See if y is larger than the index of last element */
436436 /* Return a zero range! */
437437 return 0 ;
438438 }
439439
440440 /* Check if x, y, type and ptc is valid */
441- if ((size_t (type) > node_lookup_[x][y].size () - 1 )) { /* See if type is large than the index of last element */
441+ if ((size_t (type) > node_lookup_[x][y].size () - 1 )) { /* See if type is larger than the index of last element */
442442 /* Return a zero range! */
443443 return 0 ;
444444 }
445445
446- const auto & matching_nodes = node_lookup_[x][y][type];
446+ const auto & matching_nodes = node_lookup_[x][y][( size_t ) type];
447447
448448 return vtr::make_range (matching_nodes.begin (), matching_nodes.end ()).size ();
449449}
@@ -465,8 +465,8 @@ void RRGraph::print_node(const RRNodeId& node) const {
465465bool RRGraph::validate_node_segment (const RRNodeId& node) const {
466466 VTR_ASSERT_SAFE (valid_node_id (node));
467467 /* Only CHANX and CHANY requires a valid segment id */
468- if ((CHANX == node_type (node))
469- || (CHANY == node_type (node))) {
468+ if ((e_rr_type:: CHANX == node_type (node))
469+ || (e_rr_type:: CHANY == node_type (node))) {
470470 return valid_segment_id (node_segments_[node]);
471471 } else {
472472 return true ;
@@ -477,7 +477,7 @@ bool RRGraph::validate_node_segment(const RRNodeId& node) const {
477477bool RRGraph::validate_node_segments () const {
478478 bool all_valid = true ;
479479 for (auto node : nodes ()) {
480- if (true == validate_node_segment (node)) {
480+ if (validate_node_segment (node)) {
481481 continue ;
482482 }
483483 /* Reach here it means we find an invalid segment id */
@@ -499,7 +499,7 @@ bool RRGraph::validate_edge_switch(const RREdgeId& edge) const {
499499bool RRGraph::validate_edge_switches () const {
500500 bool all_valid = true ;
501501 for (auto edge : edges ()) {
502- if (true == validate_edge_switch (edge)) {
502+ if (validate_edge_switch (edge)) {
503503 continue ;
504504 }
505505 /* Reach here it means we find an invalid segment id */
@@ -798,7 +798,7 @@ void RRGraph::reserve_segments(const int& num_segments) {
798798}
799799
800800/* Mutators */
801- RRNodeId RRGraph::create_node (const t_rr_type & type) {
801+ RRNodeId RRGraph::create_node (const e_rr_type & type) {
802802 // Allocate an ID
803803 RRNodeId node_id = RRNodeId (node_ids_.size ());
804804
@@ -971,21 +971,24 @@ void RRGraph::set_node_ptc_num(const RRNodeId& node, const short& ptc) {
971971
972972void RRGraph::set_node_pin_num (const RRNodeId& node, const short & pin_id) {
973973 VTR_ASSERT (valid_node_id (node));
974- VTR_ASSERT_MSG (node_type (node) == IPIN || node_type (node) == OPIN, " Pin number valid only for IPIN/OPIN RR nodes" );
974+ VTR_ASSERT_MSG (node_type (node) == e_rr_type::IPIN || node_type (node) == e_rr_type::OPIN,
975+ " Pin number valid only for IPIN/OPIN RR nodes" );
975976
976977 set_node_ptc_num (node, pin_id);
977978}
978979
979980void RRGraph::set_node_track_num (const RRNodeId& node, const short & track_id) {
980981 VTR_ASSERT (valid_node_id (node));
981- VTR_ASSERT_MSG (node_type (node) == CHANX || node_type (node) == CHANY, " Track number valid only for CHANX/CHANY RR nodes" );
982+ VTR_ASSERT_MSG (node_type (node) == e_rr_type::CHANX || node_type (node) == e_rr_type::CHANY,
983+ " Track number valid only for CHANX/CHANY RR nodes" );
982984
983985 set_node_ptc_num (node, track_id);
984986}
985987
986988void RRGraph::set_node_class_num (const RRNodeId& node, const short & class_id) {
987989 VTR_ASSERT (valid_node_id (node));
988- VTR_ASSERT_MSG (node_type (node) == SOURCE || node_type (node) == SINK, " Class number valid only for SOURCE/SINK RR nodes" );
990+ VTR_ASSERT_MSG (node_type (node) == e_rr_type::SOURCE || node_type (node) == e_rr_type::SINK,
991+ " Class number valid only for SOURCE/SINK RR nodes" );
989992
990993 set_node_ptc_num (node, class_id);
991994}
@@ -997,14 +1000,14 @@ void RRGraph::set_node_cost_index(const RRNodeId& node, const RRIndexedDataId& c
9971000
9981001void RRGraph::set_node_direction (const RRNodeId& node, const Direction& direction) {
9991002 VTR_ASSERT (valid_node_id (node));
1000- VTR_ASSERT_MSG (node_type (node) == CHANX || node_type (node) == CHANY, " Direct can only be specified on CHANX/CNAY rr nodes" );
1003+ VTR_ASSERT_MSG (node_type (node) == e_rr_type:: CHANX || node_type (node) == e_rr_type:: CHANY, " Direct can only be specified on CHANX/CNAY rr nodes" );
10011004
10021005 node_directions_[node] = direction;
10031006}
10041007
10051008void RRGraph::set_node_side (const RRNodeId& node, const e_side& side) {
10061009 VTR_ASSERT (valid_node_id (node));
1007- VTR_ASSERT_MSG (node_type (node) == IPIN || node_type (node) == OPIN, " Side can only be specified on IPIN/OPIN rr nodes" );
1010+ VTR_ASSERT_MSG (node_type (node) == e_rr_type:: IPIN || node_type (node) == e_rr_type:: OPIN, " Side can only be specified on IPIN/OPIN rr nodes" );
10081011
10091012 node_sides_[node] = side;
10101013}
@@ -1028,8 +1031,8 @@ void RRGraph::set_node_segment(const RRNodeId& node, const RRSegmentId& segment_
10281031 VTR_ASSERT (valid_node_id (node));
10291032
10301033 /* Only CHANX and CHANY requires a valid segment id */
1031- if ((CHANX == node_type (node))
1032- || (CHANY == node_type (node))) {
1034+ if ((e_rr_type:: CHANX == node_type (node))
1035+ || (e_rr_type:: CHANY == node_type (node))) {
10331036 VTR_ASSERT (valid_segment_id (segment_id));
10341037 }
10351038
@@ -1119,7 +1122,7 @@ void RRGraph::build_fast_node_lookup() const {
11191122 node_lookup_[x].resize (y + 1 );
11201123 }
11211124
1122- size_t itype = node_type (node);
1125+ size_t itype = ( size_t ) node_type (node);
11231126 if (itype >= node_lookup_[x][y].size ()) {
11241127 node_lookup_[x][y].resize (itype + 1 );
11251128 }
@@ -1130,7 +1133,7 @@ void RRGraph::build_fast_node_lookup() const {
11301133 }
11311134
11321135 size_t iside = -1 ;
1133- if (node_type (node) == OPIN || node_type (node) == IPIN) {
1136+ if (node_type (node) == e_rr_type:: OPIN || node_type (node) == e_rr_type:: IPIN) {
11341137 iside = node_side (node);
11351138 } else {
11361139 iside = NUM_2D_SIDES;
0 commit comments