@@ -146,6 +146,7 @@ void read_user_pad_loc(const char* pad_loc_file) {
146
146
int xtmp, ytmp;
147
147
FILE* fp;
148
148
char buf[vtr::bufsize], bname[vtr::bufsize], *ptr;
149
+ std::unordered_set<ClusterBlockId> constrained_blocks;
149
150
150
151
auto & cluster_ctx = g_vpr_ctx.clustering ();
151
152
auto & device_ctx = g_vpr_ctx.device ();
@@ -160,17 +161,14 @@ void read_user_pad_loc(const char* pad_loc_file) {
160
161
161
162
hash_table = alloc_hash_table ();
162
163
for (auto blk_id : cluster_ctx.clb_nlist .blocks ()) {
163
- auto logical_block = cluster_ctx.clb_nlist .block_type (blk_id);
164
- if (is_io_type (pick_best_physical_type (logical_block))) {
165
- insert_in_hash_table (hash_table, cluster_ctx.clb_nlist .block_name (blk_id).c_str (), size_t (blk_id));
166
- place_ctx.block_locs [blk_id].loc .x = OPEN; /* Mark as not seen yet. */
167
- }
164
+ insert_in_hash_table (hash_table, cluster_ctx.clb_nlist .block_name (blk_id).c_str (), size_t (blk_id));
165
+ place_ctx.block_locs [blk_id].loc .x = OPEN; /* Mark as not seen yet. */
168
166
}
169
167
170
168
for (size_t i = 0 ; i < device_ctx.grid .width (); i++) {
171
169
for (size_t j = 0 ; j < device_ctx.grid .height (); j++) {
172
170
auto type = device_ctx.grid [i][j].type ;
173
- if (is_io_type (type)) {
171
+ if (! is_empty_type (type)) {
174
172
for (int k = 0 ; k < type->capacity ; k++) {
175
173
if (place_ctx.grid_blocks [i][j].blocks [k] != INVALID_BLOCK_ID) {
176
174
place_ctx.grid_blocks [i][j].blocks [k] = EMPTY_BLOCK_ID; /* Flag for err. check */
@@ -236,12 +234,12 @@ void read_user_pad_loc(const char* pad_loc_file) {
236
234
int j = ytmp;
237
235
238
236
if (place_ctx.block_locs [bnum].loc .x != OPEN) {
239
- vpr_throw (VPR_ERROR_PLACE_F, pad_loc_file, vtr::get_file_line_number_of_last_opened_file (),
237
+ VPR_THROW (VPR_ERROR_PLACE_F, pad_loc_file, vtr::get_file_line_number_of_last_opened_file (),
240
238
" Block %s is listed twice in pad file.\n " , bname);
241
239
}
242
240
243
241
if (i < 0 || i > int (device_ctx.grid .width () - 1 ) || j < 0 || j > int (device_ctx.grid .height () - 1 )) {
244
- vpr_throw (VPR_ERROR_PLACE_F, pad_loc_file, 0 ,
242
+ VPR_THROW (VPR_ERROR_PLACE_F, pad_loc_file, 0 ,
245
243
" Block #%zu (%s) location, (%d,%d) is out of range.\n " , size_t (bnum), bname, i, j);
246
244
}
247
245
@@ -250,27 +248,33 @@ void read_user_pad_loc(const char* pad_loc_file) {
250
248
place_ctx.block_locs [bnum].loc .z = k;
251
249
place_ctx.block_locs [bnum].is_fixed = true ;
252
250
253
- auto type = device_ctx.grid [i][j].type ;
254
- if (!is_io_type (type)) {
255
- vpr_throw (VPR_ERROR_PLACE_F, pad_loc_file, 0 ,
256
- " Attempt to place IO block %s at illegal location (%d, %d).\n " , bname, i, j);
251
+ auto physical_tile = device_ctx.grid [i][j].type ;
252
+ auto logical_block = cluster_ctx.clb_nlist .block_type (bnum);
253
+ if (!is_tile_compatible (physical_tile, logical_block)) {
254
+ VPR_THROW (VPR_ERROR_PLACE_F, pad_loc_file, 0 ,
255
+ " Attempt to place block %s at illegal location (%d, %d).\n " , bname, i, j);
257
256
}
258
257
259
- if (k >= type ->capacity || k < 0 ) {
260
- vpr_throw (VPR_ERROR_PLACE_F, pad_loc_file, vtr::get_file_line_number_of_last_opened_file (),
258
+ if (k >= physical_tile ->capacity || k < 0 ) {
259
+ VPR_THROW (VPR_ERROR_PLACE_F, pad_loc_file, vtr::get_file_line_number_of_last_opened_file (),
261
260
" Block %s subblock number (%d) is out of range.\n " , bname, k);
262
261
}
263
262
place_ctx.grid_blocks [i][j].blocks [k] = bnum;
264
263
place_ctx.grid_blocks [i][j].usage ++;
265
264
265
+ constrained_blocks.insert (bnum);
266
+
266
267
ptr = vtr::fgets (buf, vtr::bufsize, fp);
267
268
}
268
269
269
270
for (auto blk_id : cluster_ctx.clb_nlist .blocks ()) {
270
- auto logical_block = cluster_ctx.clb_nlist .block_type (blk_id);
271
- auto type = pick_best_physical_type (logical_block);
272
- if (is_io_type (type) && place_ctx.block_locs [blk_id].loc .x == OPEN) {
273
- vpr_throw (VPR_ERROR_PLACE_F, pad_loc_file, 0 ,
271
+ auto result = constrained_blocks.find (blk_id);
272
+ if (result == constrained_blocks.end ()) {
273
+ continue ;
274
+ }
275
+
276
+ if (place_ctx.block_locs [blk_id].loc .x == OPEN) {
277
+ VPR_THROW (VPR_ERROR_PLACE_F, pad_loc_file, 0 ,
274
278
" IO block %s location was not specified in the pad file.\n " , cluster_ctx.clb_nlist .block_name (blk_id).c_str ());
275
279
}
276
280
}
0 commit comments