@@ -32,15 +32,16 @@ void read_place(
32
32
const char * net_file,
33
33
const char * place_file,
34
34
bool verify_file_digests,
35
- const DeviceGrid& grid,
36
- bool is_place_file) {
35
+ const DeviceGrid& grid) {
37
36
std::ifstream fstream (place_file);
38
37
if (!fstream) {
39
38
VPR_FATAL_ERROR (VPR_ERROR_PLACE_F,
40
39
" '%s' - Cannot open place file.\n " ,
41
40
place_file);
42
41
}
43
42
43
+ bool is_place_file = true ;
44
+
44
45
VTR_LOG (" Reading %s.\n " , place_file);
45
46
VTR_LOG (" \n " );
46
47
@@ -51,15 +52,16 @@ void read_place(
51
52
VTR_LOG (" \n " );
52
53
}
53
54
54
- void read_constraints (const char * constraints_file,
55
- bool is_place_file) {
55
+ void read_constraints (const char * constraints_file) {
56
56
std::ifstream fstream (constraints_file);
57
57
if (!fstream) {
58
58
VPR_FATAL_ERROR (VPR_ERROR_PLACE_F,
59
59
" '%s' - Cannot open constraints file.\n " ,
60
60
constraints_file);
61
61
}
62
62
63
+ bool is_place_file = false ;
64
+
63
65
VTR_LOG (" Reading %s.\n " , constraints_file);
64
66
VTR_LOG (" \n " );
65
67
@@ -226,13 +228,16 @@ void read_place_body(std::ifstream& placement_file,
226
228
if (atom_blk_id == AtomBlockId::INVALID ()) {
227
229
VPR_THROW (VPR_ERROR_PLACE, " Block %s has an invalid name.\n " , c_block_name);
228
230
} else {
229
- blk_id = atom_ctx.lookup .atom_clb (atom_blk_id);
231
+ blk_id = atom_ctx.lookup .atom_clb (atom_blk_id); // getting the ClusterBlockId of the cluster that the atom is in
230
232
}
231
233
}
232
234
233
- // Check if block is listed twice in constraints file
234
- if (seen_blocks[blk_id] != 0 ) {
235
- VPR_THROW (VPR_ERROR_PLACE, " Block %s with ID %d is listed twice in the constraints file.\n " , c_block_name, blk_id);
235
+ // Check if block is listed multiple times with conflicting locations in constraints file
236
+ if (seen_blocks[blk_id] > 0 ) {
237
+ if (block_x != place_ctx.block_locs [blk_id].loc .x || block_y != place_ctx.block_locs [blk_id].loc .y || sub_tile_index != place_ctx.block_locs [blk_id].loc .sub_tile ) {
238
+ VPR_THROW (VPR_ERROR_PLACE, " The location of cluster %d is specified %d times in the constraints file with conflicting locations. \n "
239
+ " Its location was last specified with block %s. \n " , blk_id, seen_blocks[blk_id] + 1 , c_block_name);
240
+ }
236
241
}
237
242
238
243
// Check if block location is out of range of grid dimensions
@@ -260,14 +265,17 @@ void read_place_body(std::ifstream& placement_file,
260
265
}
261
266
262
267
// need to lock down blocks and mark grid block usage if it is a constraints file
268
+ // for a place file, grid usage is marked during initial placement instead
263
269
if (!is_place_file) {
264
270
place_ctx.block_locs [blk_id].is_fixed = true ;
265
271
place_ctx.grid_blocks [block_x][block_y].blocks [sub_tile_index] = blk_id;
266
- place_ctx.grid_blocks [block_x][block_y].usage ++;
272
+ if (seen_blocks[blk_id] == 0 ) {
273
+ place_ctx.grid_blocks [block_x][block_y].usage ++;
274
+ }
267
275
}
268
276
269
277
// mark the block as seen
270
- seen_blocks[blk_id] = 1 ;
278
+ seen_blocks[blk_id]++ ;
271
279
272
280
} else {
273
281
// Unrecognized
@@ -278,6 +286,7 @@ void read_place_body(std::ifstream& placement_file,
278
286
}
279
287
280
288
// For place files, check that all blocks have been read
289
+ // For constraints files, not all blocks need to be read
281
290
if (is_place_file) {
282
291
for (auto block_id : cluster_ctx.clb_nlist .blocks ()) {
283
292
if (seen_blocks[block_id] == 0 ) {
@@ -286,6 +295,7 @@ void read_place_body(std::ifstream& placement_file,
286
295
}
287
296
}
288
297
298
+ // Want to make a hash for place file to be used during routing for error checking
289
299
if (is_place_file) {
290
300
place_ctx.placement_id = vtr::secure_digest_file (place_file);
291
301
}
0 commit comments