@@ -42,11 +42,12 @@ void get_segment_usage_stats(std::vector<t_segment_inf>& segment_inf) {
42
42
for (const auto & seg_inf: segment_inf) {
43
43
int seg_length = seg_inf.longline ? LONGLINE : seg_inf.length ;
44
44
45
- directed_cap_by_length[X_AXIS].insert ({seg_length, 0 });
46
- directed_cap_by_length[Y_AXIS].insert ({seg_length, 0 });
45
+ for (auto ax : {X_AXIS, Y_AXIS}) {
46
+ directed_cap_by_length[ax].insert ({seg_length, 0 });
47
+ directed_occ_by_length[ax].insert ({seg_length, 0 });
48
+ }
49
+
47
50
48
- directed_occ_by_length[X_AXIS].insert ({seg_length, 0 });
49
- directed_occ_by_length[Y_AXIS].insert ({seg_length, 0 });
50
51
segment_lengths.insert (seg_length);
51
52
52
53
max_segment_name_length = std::max (max_segment_name_length, static_cast <int >(seg_inf.name .size ()));
@@ -65,14 +66,12 @@ void get_segment_usage_stats(std::vector<t_segment_inf>& segment_inf) {
65
66
if (node_type == CHANX || node_type == CHANY) {
66
67
cost_index = rr_graph.node_cost_index (inode);
67
68
size_t seg_type = device_ctx.rr_indexed_data [cost_index].seg_index ;
68
- int length = -1 ;
69
- if (!segment_inf[seg_type].longline )
70
- length = segment_inf[seg_type].length ;
71
- else
72
- length = LONGLINE;
69
+ int length = segment_inf[seg_type].longline ? LONGLINE : segment_inf[seg_type].length ;
70
+
73
71
const short & inode_capacity = rr_graph.node_capacity (inode);
74
72
int occ = route_ctx.rr_node_route_inf [inode].occ ();
75
73
auto ax = (node_type == CHANX) ? X_AXIS : Y_AXIS;
74
+
76
75
directed_occ_by_length[ax][length] += occ;
77
76
directed_cap_by_length[ax][length] += inode_capacity;
78
77
@@ -119,14 +118,7 @@ void get_segment_usage_stats(std::vector<t_segment_inf>& segment_inf) {
119
118
VTR_LOG (" \n " );
120
119
VTR_LOG (" Segment occupancy by length: Length utilization\n " );
121
120
VTR_LOG (" ------ -----------\n " );
122
- std::set<int > seen_lengths;
123
- for (size_t seg_type = 0 ; seg_type < segment_inf.size (); seg_type++) {
124
- int seg_length = segment_inf[seg_type].length ;
125
- if (seen_lengths.count (seg_length) == 0 ) {
126
- seen_lengths.insert (seg_length);
127
- } else {
128
- continue ;
129
- }
121
+ for (const auto & seg_length : segment_lengths) {
130
122
if (directed_cap_by_length[X_AXIS][seg_length] != 0 || directed_cap_by_length[Y_AXIS][seg_length] != 0 ) {
131
123
std::string seg_name = " L" + std::to_string (seg_length);
132
124
0 commit comments