Skip to content

Commit c3ff424

Browse files
committed
[vpr] add get_parallel_segs.cpp to librrgraph
1 parent bfcb7ec commit c3ff424

File tree

4 files changed

+19
-18
lines changed

4 files changed

+19
-18
lines changed
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#include "get_parallel_segs.h"
2+
3+
/*Gets t_segment_inf for parallel segments as defined by the user.
4+
*Segments that have BOTH_AXIS attribute value are always included in the returned vector.*/
5+
std::vector<t_segment_inf> get_parallel_segs(const std::vector<t_segment_inf>& segment_inf,
6+
t_unified_to_parallel_seg_index& seg_index_map,
7+
enum e_parallel_axis parallel_axis) {
8+
std::vector<t_segment_inf> result;
9+
for (size_t i = 0; i < segment_inf.size(); ++i) {
10+
if (segment_inf[i].parallel_axis == parallel_axis || segment_inf[i].parallel_axis == BOTH_AXIS) {
11+
result.push_back(segment_inf[i]);
12+
result[result.size() - 1].seg_index = i;
13+
seg_index_map.insert(std::make_pair(i, std::make_pair(result.size() - 1, parallel_axis)));
14+
}
15+
}
16+
return result;
17+
}

vpr/src/draw/draw.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -759,8 +759,6 @@ void act_on_mouse_press(ezgl::application* app, GdkEventButton* event, double x,
759759
void act_on_mouse_move(ezgl::application* app, GdkEventButton* event, double x, double y) {
760760
// std::cout << "Mouse move at coordinates (" << x << "," << y << ") "<< std::endl;
761761

762-
const auto& device_ctx = g_vpr_ctx.device();
763-
764762
// user has clicked the window button, in window mode
765763
if (window_point_1_collected) {
766764
// draw a grey, dashed-line box to indicate the zoom-in region
@@ -782,6 +780,7 @@ void act_on_mouse_move(ezgl::application* app, GdkEventButton* event, double x,
782780
if (hit_node != OPEN) {
783781
//Update message
784782

783+
const auto& device_ctx = g_vpr_ctx.device();
785784
std::string info = describe_rr_node(device_ctx.rr_graph, device_ctx.grid, device_ctx.rr_indexed_data, hit_node);
786785
std::string msg = vtr::string_fmt("Moused over %s", info.c_str());
787786
app->update_message(msg.c_str());

vpr/src/draw/search_bar.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,12 +136,12 @@ void search_and_highlight(GtkWidget* /*widget*/, ezgl::application* app) {
136136
}
137137

138138
bool highlight_rr_nodes(int hit_node) {
139-
const auto& device_ctx = g_vpr_ctx.device();
140139
t_draw_state* draw_state = get_draw_state_vars();
141140

142141
char message[250] = "";
143142

144143
if (hit_node != OPEN) {
144+
const auto& device_ctx = g_vpr_ctx.device();
145145
auto nodes = draw_expand_non_configurable_rr_nodes(hit_node);
146146
for (auto node : nodes) {
147147
if (draw_state->draw_rr_node[node].color != ezgl::MAGENTA) {

vpr/src/route/rr_graph2.cpp

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -203,21 +203,6 @@ std::unique_ptr<int[]> get_seg_track_counts(const int num_sets,
203203
/* This must be freed by caller */
204204
return result;
205205
}
206-
/*Gets t_segment_inf for parallel segments as defined by the user.
207-
*Segments that have BOTH_AXIS attribute value are always included in the returned vector.*/
208-
std::vector<t_segment_inf> get_parallel_segs(const std::vector<t_segment_inf>& segment_inf,
209-
t_unified_to_parallel_seg_index& seg_index_map,
210-
enum e_parallel_axis parallel_axis) {
211-
std::vector<t_segment_inf> result;
212-
for (size_t i = 0; i < segment_inf.size(); ++i) {
213-
if (segment_inf[i].parallel_axis == parallel_axis || segment_inf[i].parallel_axis == BOTH_AXIS) {
214-
result.push_back(segment_inf[i]);
215-
result[result.size() - 1].seg_index = i;
216-
seg_index_map.insert(std::make_pair(i, std::make_pair(result.size() - 1, parallel_axis)));
217-
}
218-
}
219-
return result;
220-
}
221206

222207
int get_parallel_seg_index(const int abs_index,
223208
const t_unified_to_parallel_seg_index& index_map,

0 commit comments

Comments
 (0)