Skip to content

Commit 86cc753

Browse files
author
Paula
committed
Changed the manual move toggle button in layout
1 parent 591c477 commit 86cc753

File tree

3 files changed

+22
-21
lines changed

3 files changed

+22
-21
lines changed

vpr/main.ui

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@
192192
<property name="height">1</property>
193193
</packing>
194194
</child>
195-
<child>
195+
<child>
196196
<object class="GtkGrid" id="checkboxes">
197197
<property name="visible">True</property>
198198
<property name="can_focus">False</property>
@@ -247,7 +247,6 @@
247247
<property name="height">1</property>
248248
</packing>
249249
</child>
250-
<!-- Newly added code for manual moves -->
251250
<child>
252251
<object class="GtkCheckButton" id="manualMove">
253252
<property name="label" translatable="yes">Manual Move</property>
@@ -263,7 +262,7 @@
263262
<property name="width">1</property>
264263
<property name="height">1</property>
265264
</packing>
266-
</child>
265+
</child>
267266

268267
</object>
269268
<packing>

vpr/src/draw/manual_moves.cpp

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ void draw_manual_moves_window(std::string block_id) {
2020
manual_moves_global.manual_move_window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
2121
gtk_window_set_position((GtkWindow*) manual_moves_global.manual_move_window, GTK_WIN_POS_CENTER);
2222
gtk_window_set_title((GtkWindow*) manual_moves_global.manual_move_window, "Manual Moves Generator");
23+
gtk_widget_set_name(manual_moves_global.manual_move_window, "manual_move_window");
2324

2425
GtkWidget *grid = gtk_grid_new();
2526
GtkWidget *block_entry = gtk_entry_new();
@@ -29,16 +30,16 @@ void draw_manual_moves_window(std::string block_id) {
2930
manual_moves_global.user_highlighted_block = false;
3031
}
3132

32-
GtkWidget *x_position_entry = gtk_entry_new();
33-
GtkWidget *y_position_entry = gtk_entry_new();
34-
GtkWidget *subtile_position_entry = gtk_entry_new();
35-
GtkWidget *block_label = gtk_label_new("Block ID/Block Name:");
36-
GtkWidget *to_label = gtk_label_new("To Location:");
37-
GtkWidget *x = gtk_label_new("x:");
38-
GtkWidget *y = gtk_label_new("y:");
39-
GtkWidget *subtile = gtk_label_new("Subtile:");
33+
GtkWidget* x_position_entry = gtk_entry_new();
34+
GtkWidget* y_position_entry = gtk_entry_new();
35+
GtkWidget* subtile_position_entry = gtk_entry_new();
36+
GtkWidget* block_label = gtk_label_new("Block ID/Block Name:");
37+
GtkWidget* to_label = gtk_label_new("To Location:");
38+
GtkWidget* x = gtk_label_new("x:");
39+
GtkWidget* y = gtk_label_new("y:");
40+
GtkWidget* subtile = gtk_label_new("Subtile:");
4041

41-
GtkWidget *calculate_cost_button = gtk_button_new_with_label("Calculate Costs");
42+
GtkWidget* calculate_cost_button = gtk_button_new_with_label("Calculate Costs");
4243

4344
//Add all to grid
4445
gtk_grid_attach((GtkGrid*)grid, block_label, 0, 0, 1, 1);
@@ -65,8 +66,9 @@ void draw_manual_moves_window(std::string block_id) {
6566
gtk_widget_set_halign(calculate_cost_button, GTK_ALIGN_CENTER);
6667

6768
//connect signals
68-
g_signal_connect(G_OBJECT(manual_moves_global.manual_move_window), "destroy", G_CALLBACK(close_manual_moves_window), NULL);
6969
g_signal_connect(calculate_cost_button, "clicked", G_CALLBACK(calculate_cost_callback), grid);
70+
g_signal_connect(G_OBJECT(manual_moves_global.manual_move_window), "destroy", G_CALLBACK(close_manual_moves_window), NULL);
71+
7072

7173
gtk_container_add(GTK_CONTAINER(manual_moves_global.manual_move_window), grid);
7274
gtk_widget_show_all(manual_moves_global.manual_move_window);
@@ -202,12 +204,6 @@ e_create_move ManualMoveGenerator::propose_move(
202204
return e_create_move::ABORT;
203205
}
204206

205-
/*std::cout << "The to subtile: " << to.sub_tile << std::endl;
206-
for(auto itr = compatible_subtiles.begin(); itr != compatible_subtiles.end(); itr++) {
207-
std::cout << *itr << std::endl;
208-
}*/
209-
210-
211207
e_create_move create_move = ::create_move(blocks_affected, b_from, to);
212208
return create_move;
213209

vpr/src/place/move_utils.cpp

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -450,12 +450,15 @@ bool is_legal_swap_to_location(ClusterBlockId blk, t_pl_loc to) {
450450
auto& device_ctx = g_vpr_ctx.device();
451451
auto& cluster_ctx = g_vpr_ctx.clustering();
452452
auto& place_ctx = g_vpr_ctx.placement();
453+
454+
//For manual moves feature
453455
GObject* manual_move_toggle = application.get_object("manualMove");
456+
bool activated = gtk_toggle_button_get_active((GtkToggleButton*)manual_move_toggle);
454457

455458

456459
if (to.x < 0 || to.x >= int(device_ctx.grid.width())
457460
|| to.y < 0 || to.y >= int(device_ctx.grid.height())) {
458-
if(gtk_toggle_button_get_active((GtkToggleButton*)manual_move_toggle)) {
461+
if(activated) {
459462
invalid_breakpoint_entry_window("Dimensions are out of bounds");
460463
}
461464
return false;
@@ -466,7 +469,7 @@ bool is_legal_swap_to_location(ClusterBlockId blk, t_pl_loc to) {
466469

467470
if (to.sub_tile < 0 || to.sub_tile >= physical_tile->capacity
468471
|| !is_sub_tile_compatible(physical_tile, logical_block, to.sub_tile)) {
469-
if(gtk_toggle_button_get_active((GtkToggleButton*)manual_move_toggle)) {
472+
if(activated) {
470473
invalid_breakpoint_entry_window("Blocks are not compatible");
471474
}
472475
return false;
@@ -475,6 +478,9 @@ bool is_legal_swap_to_location(ClusterBlockId blk, t_pl_loc to) {
475478
auto b_to = place_ctx.grid_blocks[to.x][to.y].blocks[to.sub_tile];
476479
if (b_to != INVALID_BLOCK_ID && b_to != EMPTY_BLOCK_ID) {
477480
if (place_ctx.block_locs[b_to].is_fixed) {
481+
if(activated) {
482+
invalid_breakpoint_entry_window("Block is fixed");
483+
}
478484
return false;
479485
}
480486
}

0 commit comments

Comments
 (0)