From 53ba2f0c295eef7ed15f8215bafe2cccb0bbae76 Mon Sep 17 00:00:00 2001 From: tangxifan Date: Thu, 27 Jun 2024 15:53:17 -0700 Subject: [PATCH] [core] fixed a critical bug where some switching points are missing --- openfpga/src/annotation/route_clock_rr_graph.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/openfpga/src/annotation/route_clock_rr_graph.cpp b/openfpga/src/annotation/route_clock_rr_graph.cpp index d401e3e90..ad80d520a 100644 --- a/openfpga/src/annotation/route_clock_rr_graph.cpp +++ b/openfpga/src/annotation/route_clock_rr_graph.cpp @@ -299,7 +299,8 @@ static int rec_expand_and_route_clock_spine( * As such, it is easy to turn off spines by any stop. * The spine should go in a straight line, connect all the stops on the line */ bool prev_stop_usage = false; - for (size_t icoord = spine_coords.size() - 1; icoord >= 0; --icoord) { + std::reverse(spine_coords.begin(), spine_coords.end()); + for (size_t icoord = 0; icoord < spine_coords.size(); ++icoord) { vtr::Point switch_point_coord = spine_coords[icoord]; bool curr_stop_usage = false; /* Expand on the switching point here */ @@ -332,12 +333,14 @@ static int rec_expand_and_route_clock_spine( continue; } /* Skip the first stop */ - if (icoord == 0) { + if (icoord == spine_coords.size() - 1) { continue; } /* Connect only when next stop is used */ - vtr::Point src_coord = spine_coords[icoord - 1]; + vtr::Point src_coord = spine_coords[icoord + 1]; vtr::Point des_coord = spine_coords[icoord]; + VTR_LOGV(verbose, "(icoord=%lu) Expanding on backbone of spine '%s' from (x=%lu, y=%lu) to (x=%lu, y=%lu)...\n", + icoord, clk_ntwk.spine_name(curr_spine).c_str(), src_coord.x(), src_coord.y(), des_coord.x(), des_coord.y()); Direction src_spine_direction = clk_ntwk.spine_direction(curr_spine); Direction des_spine_direction = clk_ntwk.spine_direction(curr_spine); ClockLevelId src_spine_level = clk_ntwk.spine_level(curr_spine);