aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Shah <davey1576@gmail.com>2018-06-23 12:18:44 +0200
committerDavid Shah <davey1576@gmail.com>2018-06-23 12:18:44 +0200
commitd72fe0c230f79248a56e47c2f31f14b15c7f13fe (patch)
tree0c7bf06cdcc59ba644452fa62be99b1363d0e284
parent289fca0976071eabaeccedb7caf9125f70740ef8 (diff)
downloadnextpnr-d72fe0c230f79248a56e47c2f31f14b15c7f13fe.tar.gz
nextpnr-d72fe0c230f79248a56e47c2f31f14b15c7f13fe.tar.bz2
nextpnr-d72fe0c230f79248a56e47c2f31f14b15c7f13fe.zip
place_sa: Add option to disable timing-driven placement
Signed-off-by: David Shah <davey1576@gmail.com>
-rw-r--r--common/place_sa.cc37
-rw-r--r--common/place_sa.h2
-rw-r--r--ice40/main.cc7
3 files changed, 29 insertions, 17 deletions
diff --git a/common/place_sa.cc b/common/place_sa.cc
index 7a876256..6743e0ce 100644
--- a/common/place_sa.cc
+++ b/common/place_sa.cc
@@ -46,7 +46,7 @@ typedef int64_t wirelen_t;
class SAPlacer
{
public:
- SAPlacer(Context *ctx) : ctx(ctx)
+ SAPlacer(Context *ctx, bool timing_driven) : ctx(ctx), timing_driven(timing_driven)
{
checker = new PlaceValidityChecker(ctx);
int num_bel_types = 0;
@@ -334,15 +334,17 @@ class SAPlacer
CellInfo *load_cell = load.cell;
if (load_cell->bel == BelId())
continue;
+ if (timing_driven) {
+ WireId user_wire = ctx->getWireBelPin(
+ load_cell->bel, ctx->portPinFromId(load.port));
+ delay_t raw_wl = ctx->estimateDelay(drv_wire, user_wire);
+ float slack =
+ ctx->getDelayNS(load.budget) - ctx->getDelayNS(raw_wl);
+ if (slack < 0)
+ tns += slack;
+ worst_slack = std::min(slack, worst_slack);
+ }
- WireId user_wire = ctx->getWireBelPin(
- load_cell->bel, ctx->portPinFromId(load.port));
- delay_t raw_wl = ctx->estimateDelay(drv_wire, user_wire);
- float slack =
- ctx->getDelayNS(load.budget) - ctx->getDelayNS(raw_wl);
- if (slack < 0)
- tns += slack;
- worst_slack = std::min(slack, worst_slack);
int load_x, load_y;
bool load_gb;
ctx->estimatePosition(load_cell->bel, load_x, load_y, load_gb);
@@ -353,9 +355,15 @@ class SAPlacer
xmax = std::max(xmax, load_x);
ymax = std::max(ymax, load_y);
}
- wirelength =
- wirelen_t((((ymax - ymin) + (xmax - xmin)) *
- std::min(5.0, (1.0 + std::exp(-worst_slack / 5)))));
+ if (timing_driven) {
+ wirelength =
+ wirelen_t((((ymax - ymin) + (xmax - xmin)) *
+ std::min(5.0, (1.0 + std::exp(-worst_slack / 5)))));
+ } else {
+ wirelength =
+ wirelen_t((ymax - ymin) + (xmax - xmin));
+ }
+
return wirelength;
}
@@ -475,6 +483,7 @@ class SAPlacer
float curr_tns = 0;
float temp = 1000;
bool improved = false;
+ bool timing_driven = true;
int n_move, n_accept;
int diameter = 35, max_x = 1, max_y = 1;
std::unordered_map<BelType, int> bel_types;
@@ -483,10 +492,10 @@ class SAPlacer
PlaceValidityChecker *checker;
};
-bool place_design_sa(Context *ctx)
+bool place_design_sa(Context *ctx, bool timing_driven)
{
try {
- SAPlacer placer(ctx);
+ SAPlacer placer(ctx, timing_driven);
placer.place();
log_info("Checksum: 0x%08x\n", ctx->checksum());
return true;
diff --git a/common/place_sa.h b/common/place_sa.h
index 1fd8c712..e61d9375 100644
--- a/common/place_sa.h
+++ b/common/place_sa.h
@@ -23,7 +23,7 @@
NEXTPNR_NAMESPACE_BEGIN
-extern bool place_design_sa(Context *ctx);
+extern bool place_design_sa(Context *ctx, bool timing_driven = true);
NEXTPNR_NAMESPACE_END
diff --git a/ice40/main.cc b/ice40/main.cc
index ae8c7705..e60ce442 100644
--- a/ice40/main.cc
+++ b/ice40/main.cc
@@ -101,6 +101,7 @@ int main(int argc, char *argv[])
options.add_options()("up5k", "set device type to iCE40UP5K");
options.add_options()("freq", po::value<double>(),
"set target frequency for design in MHz");
+ options.add_options()("no-tmdriv", "disable timing-driven placement");
options.add_options()("package", po::value<std::string>(),
"set device package");
po::positional_options_description pos;
@@ -308,9 +309,11 @@ int main(int argc, char *argv[])
freq = vm["freq"].as<double>() * 1e6;
assign_budget(&ctx, freq);
print_utilisation(&ctx);
-
+ bool timing_driven = true;
+ if (vm.count("no-tmdriv"))
+ timing_driven = false;
if (!vm.count("pack-only")) {
- if (!place_design_sa(&ctx) && !ctx.force)
+ if (!place_design_sa(&ctx, timing_driven) && !ctx.force)
log_error("Placing design failed.\n");
if (!route_design(&ctx) && !ctx.force)
log_error("Routing design failed.\n");