Skip to content

Commit 464f7da

Browse files
author
Paula
committed
Added another helper file for place.cpp
1 parent 59bf855 commit 464f7da

File tree

4 files changed

+44
-10
lines changed

4 files changed

+44
-10
lines changed

doc/src/vpr/graphics.rst

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,4 +213,30 @@ Button Description Table
213213
| | | | FPGA |
214214
+-------------------+-------------------+------------------------------+------------------------------+
215215

216+
Manual Moves
217+
------------
218+
219+
The manual moves feature allows the user to specify the next move in placement. If the move is legal, blocks are swapped and the new move is shown on the architecture.
220+
221+
.. figure:: https://www.verilogtorouting.org/img/manual_move_toggle_button.png
222+
:align: center
223+
224+
To enable the feature, activate the Manual Move toggle button and press Proceed. Alternatively, the user can active the Manual Move toggle button and click on the block to be moved.
225+
226+
.. figure:: https://www.verilogtorouting.org/img/draw_manual_moves_window.png
227+
:align: center
228+
229+
On the manual move window, the user can specify the Block ID/Block name of the block to move and the To location, with the x position, y position and subtile position. For the manual move to be valid:
230+
231+
- The To location requested by the user should be within the grid's dimensions.
232+
- The block to be moved is found, valid and not fixed.
233+
- The blocks to be swapped are compatible.
234+
- The location choosen by the user is different from the block's current location.
235+
236+
If the manual move is legal, the cost summary window will display the delta cost, delta timing, delta bounding box cost and the placer's annealing decision that would result from this move.
237+
238+
.. figure:: https://www.verilogtorouting.org/img/manual_move_cost_dialog.png
239+
:align: center
240+
241+
The user can Accept or Reject the manual move based on the values provided. If accepted the block's new location is shown.
216242

vpr/src/draw/manual_moves.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -305,4 +305,12 @@ e_move_result pl_do_manual_move(double d_cost, double d_timing, double d_boundin
305305
return move_outcome;
306306
}
307307

308+
e_create_move manual_move_display_and_propose(ManualMoveGenerator& manual_move_generator, t_pl_blocks_to_be_moved& blocks_affected, e_move_type& move_type, float rlim, const t_placer_opts& placer_opts, const PlacerCriticalities* criticalities) {
309+
draw_manual_moves_window("");
310+
update_screen(ScreenUpdatePriority::MAJOR, " ", PLACEMENT, nullptr);
311+
move_type = e_move_type::MANUAL_MOVE;
312+
return manual_move_generator.propose_move(blocks_affected, move_type, rlim, placer_opts, criticalities);
313+
}
314+
315+
308316
#endif /*NO_GRAPHICS*/

vpr/src/draw/manual_moves.h

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* @date 2021-07-19
55
* @brief Contains the function prototypes needed for manual moves feature.
66
*
7-
* Includes the data structures sed and gtk function for manual moves. The Manual Move Generator class is defined manual_move_generator.h/cpp.
7+
* Includes the data structures and gtk function for manual moves. The Manual Move Generator class is defined manual_move_generator.h/cpp.
88
*/
99

1010
#ifndef MANUAL_MOVES_H
@@ -15,6 +15,7 @@
1515

1616
# include "ezgl/application.hpp"
1717
# include "ezgl/graphics.hpp"
18+
# include "manual_move_generator.h"
1819

1920
# include "move_utils.h"
2021
# include <cstdio>
@@ -30,7 +31,7 @@
3031
* Contains information about the block, location, validity of user input, timing variables, and placer outcomes.
3132
*
3233
* GUI writes to:
33-
* blockID: Stores the block ID of the block requested to move by the user.
34+
* blockID: Stores the block ID of the block requested to move by the user. This block is the from block in the move generator.
3435
* x_pos: Stores the x position of the block requested to move by the user.
3536
* y_pos: Stores the y position of the block requested to move by the user.
3637
* subtile: Stores the subtile of the block requested to move by the user.
@@ -89,7 +90,7 @@ bool manual_move_is_selected();
8990
/**
9091
* @brief Draws the manual move window.
9192
*
92-
* Window prompts the user for input: block id/name, s position, y position, and subtile position.
93+
* Window prompts the user for input: block id/name used as the from block in the move generator, x position, y position, and subtile position.
9394
* @param block_id: The block id is passed in if the user decides to highlight the block in the UI. If the user decides to manually input the block ID in the manual move window, the string will be empty and the block ID will later be assigned to ManualMovesState struct.
9495
*/
9596
void draw_manual_moves_window(std::string block_id);
@@ -107,7 +108,7 @@ void calculate_cost_callback(GtkWidget* /*widget*/, GtkWidget* grid);
107108
* @brief In -detail checking of the user's input.
108109
*
109110
* Checks if the user input is between the grid's dimensions, block comptaibility, if the block requested to move is valid, if the block is fixed, and if the curent location of the block is different from the location requested by the user.
110-
* @param block_id: The ID of the block to move.
111+
* @param block_id: The ID of the block to move used as the from block in the move generator).
111112
* @param to: Location of where the user wants to move the block.
112113
*
113114
* @return True if all conditions are met, false otherwise.
@@ -129,7 +130,7 @@ void manual_move_cost_summary_dialog();
129130
void manual_move_highlight_new_block_location();
130131

131132
/**
132-
* @brief Disables the mm_window_is_open boolean and destroys the window
133+
* @brief Disables the manual_move_window_is_open boolean and destroys the window
133134
*/
134135
void close_manual_moves_window();
135136

@@ -152,6 +153,9 @@ bool string_is_a_number(std::string block_id);
152153
*/
153154
e_move_result pl_do_manual_move(double d_cost, double d_timing, double d_bounding_box, e_move_result& move_outcome);
154155

156+
e_create_move manual_move_display_and_propose(ManualMoveGenerator& manual_move_generator, t_pl_blocks_to_be_moved& blocks_affected, e_move_type& move_type, float rlim, const t_placer_opts& placer_opts, const PlacerCriticalities* criticalities);
157+
158+
155159
#endif /*NO_GRAPHICS*/
156160

157161
#endif /* MANUAL_MOVES_H */

vpr/src/place/place.cpp

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1345,11 +1345,7 @@ static e_move_result try_swap(const t_annealing_state* state,
13451345
//When manual move toggle button is active, the manual move window asks the user for input.
13461346
if (manual_move_enabled) {
13471347
#ifndef NO_GRAPHICS
1348-
draw_manual_moves_window("");
1349-
update_screen(ScreenUpdatePriority::MAJOR, " ", PLACEMENT, nullptr);
1350-
1351-
move_type = e_move_type::MANUAL_MOVE;
1352-
create_move_outcome = manual_move_generator.propose_move(blocks_affected, move_type, rlim, placer_opts, criticalities);
1348+
create_move_outcome = manual_move_display_and_propose(manual_move_generator, blocks_affected, move_type, rlim, placer_opts, criticalities);
13531349
#endif //NO_GRAPHICS
13541350
} else {
13551351
//Generate a new move (perturbation) used to explore the space of possible placements

0 commit comments

Comments
 (0)