@@ -113,6 +113,8 @@ e_block_move_result record_single_block_swap(t_pl_blocks_to_be_moved& blocks_aff
113
113
114
114
ClusterBlockId b_to = place_ctx.grid_blocks [to.x ][to.y ].blocks [to.z ];
115
115
116
+ t_pl_loc curr_from = place_ctx.block_locs [b_from].loc ;
117
+
116
118
e_block_move_result outcome = e_block_move_result::VALID;
117
119
118
120
// Check whether the to_location is empty
@@ -121,6 +123,13 @@ e_block_move_result record_single_block_swap(t_pl_blocks_to_be_moved& blocks_aff
121
123
outcome = record_block_move (blocks_affected, b_from, to);
122
124
123
125
} else if (b_to != INVALID_BLOCK_ID) {
126
+ // Check whether block to is compatible with from location
127
+ if (b_to != EMPTY_BLOCK_ID && b_to != INVALID_BLOCK_ID) {
128
+ if (!(is_legal_swap_to_location (b_to, curr_from))) {
129
+ return e_block_move_result::ABORT;
130
+ }
131
+ }
132
+
124
133
// Sets up the blocks moved
125
134
outcome = record_block_move (blocks_affected, b_from, to);
126
135
@@ -253,10 +262,18 @@ e_block_move_result record_macro_macro_swaps(t_pl_blocks_to_be_moved& blocks_aff
253
262
ClusterBlockId b_from = place_ctx.pl_macros [imacro_from].members [imember_from].blk_index ;
254
263
255
264
t_pl_loc curr_to = place_ctx.block_locs [b_from].loc + swap_offset;
265
+ t_pl_loc curr_from = place_ctx.block_locs [b_from].loc ;
256
266
257
267
ClusterBlockId b_to = place_ctx.pl_macros [imacro_to].members [imember_to].blk_index ;
258
268
VTR_ASSERT_SAFE (curr_to == place_ctx.block_locs [b_to].loc );
259
269
270
+ // Check whether block to is compatible with from location
271
+ if (b_to != EMPTY_BLOCK_ID && b_to != INVALID_BLOCK_ID) {
272
+ if (!(is_legal_swap_to_location (b_to, curr_from))) {
273
+ return e_block_move_result::ABORT;
274
+ }
275
+ }
276
+
260
277
if (!is_legal_swap_to_location (b_from, curr_to)) {
261
278
log_move_abort (" macro_from swap to location illegal" );
262
279
return e_block_move_result::ABORT;
0 commit comments