Skip to content

Commit af8895e

Browse files
authored
Merge branch 'master' into openfpga
2 parents 42829ed + 49de5fb commit af8895e

8 files changed

+41
-12
lines changed

vpr/src/base/SetupVPR.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -656,6 +656,8 @@ static void SetupPlacerOpts(const t_options& Options, t_placer_opts* PlacerOpts)
656656

657657
PlacerOpts->write_initial_place_file = Options.write_initial_place_file;
658658

659+
PlacerOpts->read_initial_place_file = Options.read_initial_place_file;
660+
659661
PlacerOpts->pad_loc_type = Options.pad_loc_type;
660662

661663
PlacerOpts->place_chan_width = Options.PlaceChanWidth;

vpr/src/base/read_options.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1632,6 +1632,11 @@ argparse::ArgumentParser create_arg_parser(const std::string& prog_name, t_optio
16321632
.metavar("INITIAL_PLACE_FILE")
16331633
.show_in(argparse::ShowIn::HELP_ONLY);
16341634

1635+
file_grp.add_argument(args.read_initial_place_file, "--read_initial_place_file")
1636+
.help("Reads the initial placement and continues the rest of the placement process from there.")
1637+
.metavar("INITIAL_PLACE_FILE")
1638+
.show_in(argparse::ShowIn::HELP_ONLY);
1639+
16351640
file_grp.add_argument(args.read_vpr_constraints_file, "--read_vpr_constraints")
16361641
.help("Reads the floorplanning constraints that packing and placement must respect from the specified XML file.")
16371642
.show_in(argparse::ShowIn::HELP_ONLY);

vpr/src/base/read_options.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ struct t_options {
2929
argparse::ArgValue<std::string> write_rr_graph_file;
3030
argparse::ArgValue<std::string> read_rr_graph_file;
3131
argparse::ArgValue<std::string> write_initial_place_file;
32+
argparse::ArgValue<std::string> read_initial_place_file;
3233
argparse::ArgValue<std::string> read_vpr_constraints_file;
3334
argparse::ArgValue<std::string> write_vpr_constraints_file;
3435
argparse::ArgValue<std::string> write_constraints_file;

vpr/src/base/read_place.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -305,6 +305,14 @@ void read_place_body(std::ifstream& placement_file,
305305
loc.layer = block_layer;
306306

307307
if (seen_blocks[blk_id] == 0) {
308+
if (is_place_file && place_ctx.block_locs[blk_id].is_fixed) {
309+
const auto& contraint_loc = place_ctx.block_locs[blk_id].loc;
310+
if (loc != contraint_loc) {
311+
VPR_THROW(VPR_ERROR_PLACE,
312+
"The new location assigned to cluster #%d is (%d,%d,%d,%d), which is inconsistent with the location specified in the constraint file (%d,%d,%d,%d).",
313+
blk_id, loc.x, loc.y, loc.layer, loc.sub_tile, contraint_loc.x, contraint_loc.y, contraint_loc.layer, contraint_loc.sub_tile);
314+
}
315+
}
308316
set_block_location(blk_id, loc);
309317
}
310318

vpr/src/base/vpr_types.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1236,6 +1236,7 @@ struct t_placer_opts {
12361236
enum e_pad_loc_type pad_loc_type;
12371237
std::string constraints_file;
12381238
std::string write_initial_place_file;
1239+
std::string read_initial_place_file;
12391240
enum pfreq place_freq;
12401241
int recompute_crit_iter;
12411242
int inner_loop_recompute_divider;

vpr/src/pack/cluster_placement.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,9 +140,15 @@ bool get_next_primitive_list(t_cluster_placement_stats* cluster_placement_stats,
140140
continue;
141141
}
142142

143-
144143
/* check for force site match, if applicable */
145144
if (force_site > -1) {
145+
/* check that the forced site index is within the available range */
146+
int max_site = it->second->pb_graph_node->total_primitive_count - 1;
147+
if (force_site > max_site) {
148+
VTR_LOG("The specified primitive site (%d) is out of range (max %d)\n",
149+
force_site, max_site);
150+
break;
151+
}
146152
if (force_site == it->second->pb_graph_node->flat_site_index) {
147153
cost = try_place_molecule(molecule, it->second->pb_graph_node, primitives_list);
148154
if (cost < HUGE_POSITIVE_FLOAT) {

vpr/src/place/initial_placement.cpp

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1192,7 +1192,8 @@ void initial_placement(const t_placer_opts& placer_opts,
11921192
propagate_place_constraints();
11931193

11941194
/*Mark the blocks that have already been locked to one spot via floorplan constraints
1195-
* as fixed, so they do not get moved during initial placement or later during the simulated annealing stage of placement*/
1195+
* as fixed, so they do not get moved during initial placement or later during the simulated annealing stage of placement
1196+
*/
11961197
mark_fixed_blocks();
11971198

11981199
// Compute and store compressed floorplanning constraints
@@ -1204,17 +1205,22 @@ void initial_placement(const t_placer_opts& placer_opts,
12041205
read_constraints(constraints_file);
12051206
}
12061207

1207-
if (noc_opts.noc) {
1208-
// NoC routers are placed before other blocks
1209-
initial_noc_placement(noc_opts, placer_opts);
1210-
propagate_place_constraints();
1211-
}
1208+
if(!placer_opts.read_initial_place_file.empty()) {
1209+
const auto& grid = g_vpr_ctx.device().grid;
1210+
read_place(nullptr, placer_opts.read_initial_place_file.c_str(), false, grid);
1211+
} else {
1212+
if (noc_opts.noc) {
1213+
// NoC routers are placed before other blocks
1214+
initial_noc_placement(noc_opts, placer_opts);
1215+
propagate_place_constraints();
1216+
}
12121217

1213-
//Assign scores to blocks and placement macros according to how difficult they are to place
1214-
vtr::vector<ClusterBlockId, t_block_score> block_scores = assign_block_scores();
1218+
//Assign scores to blocks and placement macros according to how difficult they are to place
1219+
vtr::vector<ClusterBlockId, t_block_score> block_scores = assign_block_scores();
12151220

1216-
//Place all blocks
1217-
place_all_blocks(placer_opts, block_scores, placer_opts.pad_loc_type, constraints_file);
1221+
//Place all blocks
1222+
place_all_blocks(placer_opts, block_scores, placer_opts.pad_loc_type, constraints_file);
1223+
}
12181224

12191225
alloc_and_load_movable_blocks();
12201226

vpr/src/place/place.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -462,7 +462,7 @@ void try_place(const Netlist<>& net_list,
462462
if (!placer_opts.write_initial_place_file.empty()) {
463463
print_place(nullptr,
464464
nullptr,
465-
(placer_opts.write_initial_place_file + ".init.place").c_str());
465+
placer_opts.write_initial_place_file.c_str());
466466
}
467467

468468
#ifdef ENABLE_ANALYTIC_PLACE

0 commit comments

Comments
 (0)