From 7daa8524c8ab8c9ff5400d5074b80573b0d39a14 Mon Sep 17 00:00:00 2001 From: Clifford Wolf Date: Wed, 11 Jul 2018 18:15:08 +0200 Subject: [PATCH] Add ctx->place() API Signed-off-by: Clifford Wolf --- common/{place_sa.cc => placer1.cc} | 4 ++-- common/{place_sa.h => placer1.h} | 2 +- ecp5/arch.cc | 6 ++++++ ecp5/arch.h | 1 + ecp5/main.cc | 3 +-- generic/arch.cc | 6 ++++++ generic/arch.h | 1 + gui/ice40/mainwindow.cc | 1 - gui/ice40/worker.cc | 3 +-- ice40/arch.cc | 6 ++++++ ice40/arch.h | 1 + ice40/main.cc | 3 +-- 12 files changed, 27 insertions(+), 10 deletions(-) rename common/{place_sa.cc => placer1.cc} (99%) rename common/{place_sa.h => placer1.h} (95%) diff --git a/common/place_sa.cc b/common/placer1.cc similarity index 99% rename from common/place_sa.cc rename to common/placer1.cc index ab161c57..53295a91 100644 --- a/common/place_sa.cc +++ b/common/placer1.cc @@ -21,7 +21,7 @@ * */ -#include "place_sa.h" +#include "placer1.h" #include #include #include @@ -429,7 +429,7 @@ class SAPlacer const float post_legalise_dia_scale = 2; }; -bool place_design_sa(Context *ctx) +bool placer1(Context *ctx) { try { SAPlacer placer(ctx); diff --git a/common/place_sa.h b/common/placer1.h similarity index 95% rename from common/place_sa.h rename to common/placer1.h index 1fd8c712..477fae56 100644 --- a/common/place_sa.h +++ b/common/placer1.h @@ -23,7 +23,7 @@ NEXTPNR_NAMESPACE_BEGIN -extern bool place_design_sa(Context *ctx); +extern bool placer1(Context *ctx); NEXTPNR_NAMESPACE_END diff --git a/ecp5/arch.cc b/ecp5/arch.cc index 74548391..7383e0e7 100644 --- a/ecp5/arch.cc +++ b/ecp5/arch.cc @@ -23,6 +23,7 @@ #include #include "log.h" #include "nextpnr.h" +#include "placer1.h" #include "router1.h" #include "util.h" @@ -289,6 +290,11 @@ delay_t Arch::estimateDelay(WireId src, WireId dst) const // ----------------------------------------------------------------------- +bool Arch::place() +{ + return placer1(getCtx()); +} + bool Arch::route() { return router1(getCtx()); diff --git a/ecp5/arch.h b/ecp5/arch.h index c9c5a6a1..5f01c8c8 100644 --- a/ecp5/arch.h +++ b/ecp5/arch.h @@ -720,6 +720,7 @@ struct Arch : BaseCtx // ------------------------------------------------- + bool place(); bool route(); // ------------------------------------------------- diff --git a/ecp5/main.cc b/ecp5/main.cc index a6128d0f..45774431 100644 --- a/ecp5/main.cc +++ b/ecp5/main.cc @@ -44,7 +44,6 @@ #include "design_utils.h" #include "jsonparse.h" #include "pack.h" -#include "place_sa.h" #include "timing.h" USING_NEXTPNR_NAMESPACE @@ -146,7 +145,7 @@ int main(int argc, char *argv[]) if (vm.count("no-tmdriv")) ctx.timing_driven = false; - if (!place_design_sa(&ctx) && !ctx.force) + if (!ctx.place() && !ctx.force) log_error("Placing design failed.\n"); ctx.check(); if (!ctx.route() && !ctx.force) diff --git a/generic/arch.cc b/generic/arch.cc index b82d8ce6..2282b2b8 100644 --- a/generic/arch.cc +++ b/generic/arch.cc @@ -19,6 +19,7 @@ #include #include "nextpnr.h" +#include "placer1.h" #include "router1.h" NEXTPNR_NAMESPACE_BEGIN @@ -316,6 +317,11 @@ delay_t Arch::estimateDelay(WireId src, WireId dst) const // --------------------------------------------------------------- +bool Arch::place() +{ + return placer1(getCtx()); +} + bool Arch::route() { return router1(getCtx()); diff --git a/generic/arch.h b/generic/arch.h index 60ac9435..85f469f9 100644 --- a/generic/arch.h +++ b/generic/arch.h @@ -158,6 +158,7 @@ struct Arch : BaseCtx float getDelayNS(delay_t v) const { return v; } uint32_t getDelayChecksum(delay_t v) const { return 0; } + bool place(); bool route(); const std::vector &getDecalGraphics(DecalId decal) const; diff --git a/gui/ice40/mainwindow.cc b/gui/ice40/mainwindow.cc index ea7e0667..6f0a9b97 100644 --- a/gui/ice40/mainwindow.cc +++ b/gui/ice40/mainwindow.cc @@ -29,7 +29,6 @@ #include "log.h" #include "pack.h" #include "pcf.h" -#include "place_sa.h" static void initMainResource() { Q_INIT_RESOURCE(nextpnr); } diff --git a/gui/ice40/worker.cc b/gui/ice40/worker.cc index fc21ed34..16f5fb89 100644 --- a/gui/ice40/worker.cc +++ b/gui/ice40/worker.cc @@ -25,7 +25,6 @@ #include "log.h" #include "pack.h" #include "pcf.h" -#include "place_sa.h" #include "timing.h" NEXTPNR_NAMESPACE_BEGIN @@ -123,7 +122,7 @@ void Worker::place(bool timing_driven) Q_EMIT taskStarted(); try { ctx->timing_driven = timing_driven; - Q_EMIT place_finished(place_design_sa(ctx)); + Q_EMIT place_finished(ctx->place()); } catch (WorkerInterruptionRequested) { Q_EMIT taskCanceled(); } diff --git a/ice40/arch.cc b/ice40/arch.cc index 0bb27d38..1e6b4569 100644 --- a/ice40/arch.cc +++ b/ice40/arch.cc @@ -21,6 +21,7 @@ #include #include "log.h" #include "nextpnr.h" +#include "placer1.h" #include "router1.h" #include "util.h" #include "gfx.h" @@ -401,6 +402,11 @@ delay_t Arch::estimateDelay(WireId src, WireId dst) const // ----------------------------------------------------------------------- +bool Arch::place() +{ + return placer1(getCtx()); +} + bool Arch::route() { return router1(getCtx()); diff --git a/ice40/arch.h b/ice40/arch.h index 02c37fae..659139a6 100644 --- a/ice40/arch.h +++ b/ice40/arch.h @@ -643,6 +643,7 @@ struct Arch : BaseCtx // ------------------------------------------------- + bool place(); bool route(); // ------------------------------------------------- diff --git a/ice40/main.cc b/ice40/main.cc index f586a079..2427ea6c 100644 --- a/ice40/main.cc +++ b/ice40/main.cc @@ -42,7 +42,6 @@ #include "pack.h" #include "pcf.h" #include "place_legaliser.h" -#include "place_sa.h" #include "timing.h" #include "version.h" @@ -372,7 +371,7 @@ int main(int argc, char *argv[]) if (vm.count("no-tmdriv")) ctx.timing_driven = false; if (!vm.count("pack-only")) { - if (!place_design_sa(&ctx) && !ctx.force) + if (!ctx.place() && !ctx.force) log_error("Placing design failed.\n"); ctx.check(); if (!ctx.route() && !ctx.force)