Skip to content

Commit b6c7dee

Browse files
committed
Fix swapped parameters during read_place() error checking
1 parent 6b4af26 commit b6c7dee

File tree

2 files changed

+14
-12
lines changed

2 files changed

+14
-12
lines changed

vpr/SRC/base/place_and_route.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ bool place_and_route(struct s_placer_opts placer_opts, char *place_file, char *n
7979

8080
if (!placer_opts.doPlacement || placer_opts.place_freq == PLACE_NEVER) {
8181
/* Read the placement from a file */
82-
read_place(place_file, net_file, arch_file, nx, ny, num_blocks, block);
82+
read_place(place_file, arch_file, net_file, nx, ny, num_blocks, block);
8383
sync_grid_to_blocks(num_blocks, nx, ny, grid);
8484
} else {
8585
VTR_ASSERT((PLACE_ONCE == placer_opts.place_freq) || (PLACE_ALWAYS == placer_opts.place_freq));

vpr/SRC/base/read_place.cpp

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -52,19 +52,21 @@ void read_place(const char *place_file, const char *arch_file,
5252
};
5353
}
5454
if (error) {
55-
vpr_throw(VPR_ERROR_PLACE_F, __FILE__, __LINE__,
56-
"'%s' - Bad filename specification line in placement file.\n",
57-
place_file);
55+
vpr_throw(VPR_ERROR_PLACE_F, place_file, line,
56+
"Bad filename specification line in placement file.");
5857
}
59-
if (tokens[2] != arch_file) {
60-
vpr_throw(VPR_ERROR_PLACE_F, __FILE__, __LINE__,
61-
"'%s' - Architecture file that generated placement (%s) does not match current architecture file (%s).\n",
62-
place_file, tokens[2].c_str(), arch_file);
58+
59+
//TODO: a more robust approach would be to save the hash (e.g. SHA256) of the net/arch files and compare those, rather than
60+
//the filepaths
61+
if (tokens[2] != net_file) {
62+
vpr_throw(VPR_ERROR_PLACE_F, place_file, line,
63+
"Netlist file that generated placement (%s) does not match current netlist file (%s).\n",
64+
tokens[2].c_str(), net_file);
6365
}
64-
if (tokens[5] != net_file) {
65-
vpr_throw(VPR_ERROR_PLACE_F, __FILE__, __LINE__,
66-
"'%s' - Netlist file that generated placement (%s) does not match current netlist file (%s).\n",
67-
place_file, tokens[5].c_str(), net_file);
66+
if (tokens[5] != arch_file) {
67+
vpr_throw(VPR_ERROR_PLACE_F, place_file, line,
68+
"Architecture file that generated placement (%s) does not match current architecture file (%s).\n",
69+
tokens[5].c_str(), arch_file);
6870
}
6971

7072
/* Check array size in second line matches */

0 commit comments

Comments
 (0)