@@ -32,7 +32,7 @@ RRGraph::segment_range RRGraph::segments() const {
32
32
}
33
33
34
34
// Node attributes
35
- t_rr_type RRGraph::node_type (const RRNodeId& node) const {
35
+ e_rr_type RRGraph::node_type (const RRNodeId& node) const {
36
36
VTR_ASSERT_SAFE (valid_node_id (node));
37
37
return node_types_[node];
38
38
}
@@ -81,7 +81,7 @@ vtr::Rect<short> RRGraph::node_bounding_box(const RRNodeId& node) const {
81
81
***********************************************************************/
82
82
vtr::Point <short > RRGraph::node_start_coordinate (const RRNodeId& node) const {
83
83
/* 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)));
85
85
86
86
vtr::Point <short > start_coordinate (node_xlow (node), node_ylow (node));
87
87
@@ -105,7 +105,7 @@ vtr::Point<short> RRGraph::node_start_coordinate(const RRNodeId& node) const {
105
105
***********************************************************************/
106
106
vtr::Point <short > RRGraph::node_end_coordinate (const RRNodeId& node) const {
107
107
/* 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)));
109
109
110
110
vtr::Point <short > end_coordinate (node_xhigh (node), node_yhigh (node));
111
111
@@ -135,19 +135,19 @@ short RRGraph::node_ptc_num(const RRNodeId& node) const {
135
135
}
136
136
137
137
short 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,
139
139
" Pin number valid only for IPIN/OPIN RR nodes" );
140
140
return node_ptc_num (node);
141
141
}
142
142
143
143
short 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,
145
145
" Track number valid only for CHANX/CHANY RR nodes" );
146
146
return node_ptc_num (node);
147
147
}
148
148
149
149
short 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" );
151
151
return node_ptc_num (node);
152
152
}
153
153
@@ -158,13 +158,13 @@ RRIndexedDataId RRGraph::node_cost_index(const RRNodeId& node) const {
158
158
159
159
Direction RRGraph::node_direction (const RRNodeId& node) const {
160
160
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" );
162
162
return node_directions_[node];
163
163
}
164
164
165
165
e_side RRGraph::node_side (const RRNodeId& node) const {
166
166
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" );
168
168
return node_sides_[node];
169
169
}
170
170
@@ -372,11 +372,11 @@ std::vector<RREdgeId> RRGraph::find_edges(const RRNodeId& src_node, const RRNode
372
372
return matching_edges;
373
373
}
374
374
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 {
376
376
initialize_fast_node_lookup ();
377
377
378
- size_t itype = type;
379
- size_t iside = side;
378
+ const size_t itype = ( size_t ) type;
379
+ const size_t iside = side;
380
380
381
381
/* Check if x, y, type and ptc, side is valid */
382
382
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
401
401
402
402
/* Check if x, y, type and ptc, side is valid */
403
403
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 */
405
405
/* Return a zero range! */
406
406
return RRNodeId::INVALID ();
407
407
}
408
408
409
409
/* Check if x, y, type and ptc, side is valid */
410
410
/* 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 */
412
412
/* Return a zero range! */
413
413
return RRNodeId::INVALID ();
414
414
}
@@ -417,9 +417,9 @@ RRNodeId RRGraph::find_node(const short& x, const short& y, const t_rr_type& typ
417
417
}
418
418
419
419
/* 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 {
421
421
/* 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,
423
423
" Required node_type to be CHANX or CHANY!" );
424
424
initialize_fast_node_lookup ();
425
425
@@ -432,18 +432,18 @@ short RRGraph::chan_num_tracks(const short& x, const short& y, const t_rr_type&
432
432
433
433
/* Check if x, y, type and ptc is valid */
434
434
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 */
436
436
/* Return a zero range! */
437
437
return 0 ;
438
438
}
439
439
440
440
/* 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 */
442
442
/* Return a zero range! */
443
443
return 0 ;
444
444
}
445
445
446
- const auto & matching_nodes = node_lookup_[x][y][type];
446
+ const auto & matching_nodes = node_lookup_[x][y][( size_t ) type];
447
447
448
448
return vtr::make_range (matching_nodes.begin (), matching_nodes.end ()).size ();
449
449
}
@@ -465,8 +465,8 @@ void RRGraph::print_node(const RRNodeId& node) const {
465
465
bool RRGraph::validate_node_segment (const RRNodeId& node) const {
466
466
VTR_ASSERT_SAFE (valid_node_id (node));
467
467
/* 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))) {
470
470
return valid_segment_id (node_segments_[node]);
471
471
} else {
472
472
return true ;
@@ -477,7 +477,7 @@ bool RRGraph::validate_node_segment(const RRNodeId& node) const {
477
477
bool RRGraph::validate_node_segments () const {
478
478
bool all_valid = true ;
479
479
for (auto node : nodes ()) {
480
- if (true == validate_node_segment (node)) {
480
+ if (validate_node_segment (node)) {
481
481
continue ;
482
482
}
483
483
/* Reach here it means we find an invalid segment id */
@@ -499,7 +499,7 @@ bool RRGraph::validate_edge_switch(const RREdgeId& edge) const {
499
499
bool RRGraph::validate_edge_switches () const {
500
500
bool all_valid = true ;
501
501
for (auto edge : edges ()) {
502
- if (true == validate_edge_switch (edge)) {
502
+ if (validate_edge_switch (edge)) {
503
503
continue ;
504
504
}
505
505
/* Reach here it means we find an invalid segment id */
@@ -798,7 +798,7 @@ void RRGraph::reserve_segments(const int& num_segments) {
798
798
}
799
799
800
800
/* Mutators */
801
- RRNodeId RRGraph::create_node (const t_rr_type & type) {
801
+ RRNodeId RRGraph::create_node (const e_rr_type & type) {
802
802
// Allocate an ID
803
803
RRNodeId node_id = RRNodeId (node_ids_.size ());
804
804
@@ -971,21 +971,24 @@ void RRGraph::set_node_ptc_num(const RRNodeId& node, const short& ptc) {
971
971
972
972
void RRGraph::set_node_pin_num (const RRNodeId& node, const short & pin_id) {
973
973
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" );
975
976
976
977
set_node_ptc_num (node, pin_id);
977
978
}
978
979
979
980
void RRGraph::set_node_track_num (const RRNodeId& node, const short & track_id) {
980
981
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" );
982
984
983
985
set_node_ptc_num (node, track_id);
984
986
}
985
987
986
988
void RRGraph::set_node_class_num (const RRNodeId& node, const short & class_id) {
987
989
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" );
989
992
990
993
set_node_ptc_num (node, class_id);
991
994
}
@@ -997,14 +1000,14 @@ void RRGraph::set_node_cost_index(const RRNodeId& node, const RRIndexedDataId& c
997
1000
998
1001
void RRGraph::set_node_direction (const RRNodeId& node, const Direction& direction) {
999
1002
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" );
1001
1004
1002
1005
node_directions_[node] = direction;
1003
1006
}
1004
1007
1005
1008
void RRGraph::set_node_side (const RRNodeId& node, const e_side& side) {
1006
1009
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" );
1008
1011
1009
1012
node_sides_[node] = side;
1010
1013
}
@@ -1028,8 +1031,8 @@ void RRGraph::set_node_segment(const RRNodeId& node, const RRSegmentId& segment_
1028
1031
VTR_ASSERT (valid_node_id (node));
1029
1032
1030
1033
/* 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))) {
1033
1036
VTR_ASSERT (valid_segment_id (segment_id));
1034
1037
}
1035
1038
@@ -1119,7 +1122,7 @@ void RRGraph::build_fast_node_lookup() const {
1119
1122
node_lookup_[x].resize (y + 1 );
1120
1123
}
1121
1124
1122
- size_t itype = node_type (node);
1125
+ size_t itype = ( size_t ) node_type (node);
1123
1126
if (itype >= node_lookup_[x][y].size ()) {
1124
1127
node_lookup_[x][y].resize (itype + 1 );
1125
1128
}
@@ -1130,7 +1133,7 @@ void RRGraph::build_fast_node_lookup() const {
1130
1133
}
1131
1134
1132
1135
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) {
1134
1137
iside = node_side (node);
1135
1138
} else {
1136
1139
iside = NUM_2D_SIDES;
0 commit comments