Skip to content

Commit 837d2f9

Browse files
committed
use segment length set and sort it in an ascending order
1 parent f2a0cf9 commit 837d2f9

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

vpr/src/route/segment_stats.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ void get_segment_usage_stats(std::vector<t_segment_inf>& segment_inf) {
3838
{X_AXIS, std::map<int, int>()},
3939
{Y_AXIS, std::map<int, int>()}};
4040

41-
std::set<int> segment_lengths;
41+
std::set<int, std::less<int>> segment_lengths;
4242
for (const auto& seg_inf: segment_inf) {
4343
int seg_length = seg_inf.longline ? LONGLINE : seg_inf.length;
4444

@@ -83,7 +83,7 @@ void get_segment_usage_stats(std::vector<t_segment_inf>& segment_inf) {
8383
VTR_LOG("\n");
8484
VTR_LOG("Total Number of Wiring Segments by Direction: direction length number\n");
8585
VTR_LOG(" --------- ------ -------\n");
86-
for (int length = 0; length <= max_segment_length; length++) {
86+
for (auto length : segment_lengths) {
8787
for (auto ax : {X_AXIS, Y_AXIS}) {
8888
std::string ax_name = (ax == X_AXIS) ? "X" : "Y";
8989
if (directed_cap_by_length[ax][length] != 0) {
@@ -103,7 +103,7 @@ void get_segment_usage_stats(std::vector<t_segment_inf>& segment_inf) {
103103
VTR_LOG("\n");
104104
VTR_LOG("%s - Directed Wiring Segment usage by length: length utilization\n", ax_name.c_str());
105105
VTR_LOG(" ------ -----------\n");
106-
for (int length = 0; length <= max_segment_length; length++) {
106+
for (auto length : segment_lengths) {
107107
if (directed_cap_by_length[ax][length] != 0) {
108108
std::string length_str = (length == LONGLINE) ? "longline" : std::to_string(length);
109109
utilization = (float)directed_occ_by_length[ax][length] / (float)directed_cap_by_length[ax][length];

0 commit comments

Comments
 (0)