diff options
-rw-r--r-- | common/nextpnr.h | 9 | ||||
-rw-r--r-- | common/placer1.cc (renamed from common/place_sa.cc) | 4 | ||||
-rw-r--r-- | common/placer1.h (renamed from common/place_sa.h) | 2 | ||||
-rw-r--r-- | common/router1.cc (renamed from common/route.cc) | 8 | ||||
-rw-r--r-- | common/router1.h (renamed from common/route.h) | 9 | ||||
-rw-r--r-- | ecp5/arch.cc | 14 | ||||
-rw-r--r-- | ecp5/arch.h | 5 | ||||
-rw-r--r-- | ecp5/main.cc | 6 | ||||
-rw-r--r-- | generic/arch.cc | 24 | ||||
-rw-r--r-- | generic/arch.h | 3 | ||||
-rw-r--r-- | gui/ice40/mainwindow.cc | 4 | ||||
-rw-r--r-- | gui/ice40/worker.cc | 6 | ||||
-rw-r--r-- | ice40/arch.cc | 14 | ||||
-rw-r--r-- | ice40/arch.h | 5 | ||||
-rw-r--r-- | ice40/main.cc | 8 |
15 files changed, 89 insertions, 32 deletions
diff --git a/common/nextpnr.h b/common/nextpnr.h index 856d8993..09bd1554 100644 --- a/common/nextpnr.h +++ b/common/nextpnr.h @@ -260,6 +260,10 @@ struct BaseCtx delete idstring_idx_to_str; } + Context *getCtx() { return reinterpret_cast<Context*>(this); } + + const Context *getCtx() const { return reinterpret_cast<const Context*>(this); } + // -------------------------------------------------------------- bool allUiReload = false; @@ -366,6 +370,11 @@ struct Context : Arch // -------------------------------------------------------------- + // provided by router1.cc + bool getActualRouteDelay(WireId src_wire, WireId dst_wire, delay_t &delay); + + // -------------------------------------------------------------- + uint64_t rngstate = 0x3141592653589793; uint64_t rng64() diff --git a/common/place_sa.cc b/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 <algorithm> #include <cmath> #include <iostream> @@ -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 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/common/route.cc b/common/router1.cc index 82525fcc..94c7070e 100644 --- a/common/route.cc +++ b/common/router1.cc @@ -21,7 +21,7 @@ #include <queue> #include "log.h" -#include "route.h" +#include "router1.h" namespace { @@ -402,7 +402,7 @@ struct Router NEXTPNR_NAMESPACE_BEGIN -bool route_design(Context *ctx) +bool router1(Context *ctx) { try { int totalVisitCnt = 0, totalRevisitCnt = 0, totalOvertimeRevisitCnt = 0; @@ -643,10 +643,10 @@ bool route_design(Context *ctx) } } -bool get_actual_route_delay(Context *ctx, WireId src_wire, WireId dst_wire, delay_t &delay) +bool Context::getActualRouteDelay(WireId src_wire, WireId dst_wire, delay_t &delay) { RipupScoreboard scores; - Router router(ctx, scores, src_wire, dst_wire); + Router router(this, scores, src_wire, dst_wire); if (router.routedOkay) delay = router.visited.at(dst_wire).delay; return router.routedOkay; diff --git a/common/route.h b/common/router1.h index 1da9edc2..38552c58 100644 --- a/common/route.h +++ b/common/router1.h @@ -17,16 +17,15 @@ * */ -#ifndef ROUTE_H -#define ROUTE_H +#ifndef ROUTER1_H +#define ROUTER1_H #include "nextpnr.h" NEXTPNR_NAMESPACE_BEGIN -extern bool route_design(Context *ctx); -extern bool get_actual_route_delay(Context *ctx, WireId src_wire, WireId dst_wire, delay_t &delay); +extern bool router1(Context *ctx); NEXTPNR_NAMESPACE_END -#endif // ROUTE_H +#endif // ROUTER1_H diff --git a/ecp5/arch.cc b/ecp5/arch.cc index 6d320996..7383e0e7 100644 --- a/ecp5/arch.cc +++ b/ecp5/arch.cc @@ -23,6 +23,8 @@ #include <cstring> #include "log.h" #include "nextpnr.h" +#include "placer1.h" +#include "router1.h" #include "util.h" NEXTPNR_NAMESPACE_BEGIN @@ -288,6 +290,18 @@ delay_t Arch::estimateDelay(WireId src, WireId dst) const // ----------------------------------------------------------------------- +bool Arch::place() +{ + return placer1(getCtx()); +} + +bool Arch::route() +{ + return router1(getCtx()); +} + +// ----------------------------------------------------------------------- + std::vector<GraphicElement> Arch::getDecalGraphics(DecalId decalId) const { std::vector<GraphicElement> ret; diff --git a/ecp5/arch.h b/ecp5/arch.h index ba26682e..5f01c8c8 100644 --- a/ecp5/arch.h +++ b/ecp5/arch.h @@ -720,6 +720,11 @@ struct Arch : BaseCtx // ------------------------------------------------- + bool place(); + bool route(); + + // ------------------------------------------------- + std::vector<GraphicElement> getDecalGraphics(DecalId decal) const; DecalXY getFrameDecal() const; diff --git a/ecp5/main.cc b/ecp5/main.cc index caa28563..45774431 100644 --- a/ecp5/main.cc +++ b/ecp5/main.cc @@ -44,8 +44,6 @@ #include "design_utils.h" #include "jsonparse.h" #include "pack.h" -#include "place_sa.h" -#include "route.h" #include "timing.h" USING_NEXTPNR_NAMESPACE @@ -147,10 +145,10 @@ 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 (!route_design(&ctx) && !ctx.force) + if (!ctx.route() && !ctx.force) log_error("Routing design failed.\n"); std::string basecfg; diff --git a/generic/arch.cc b/generic/arch.cc index b3854401..60874e1e 100644 --- a/generic/arch.cc +++ b/generic/arch.cc @@ -19,6 +19,8 @@ #include <math.h> #include "nextpnr.h" +#include "placer1.h" +#include "router1.h" NEXTPNR_NAMESPACE_BEGIN @@ -110,30 +112,31 @@ void Arch::addBelInout(IdString bel, IdString name, IdString wire) void Arch::addDecalGraphic(DecalId decal, const GraphicElement &graphic) { decal_graphics[decal].push_back(graphic); + refreshUi(); } void Arch::setFrameDecal(DecalXY decalxy) { frame_decalxy = decalxy; - frameGraphicsReload = true; + refreshUiFrame(); } void Arch::setWireDecal(WireId wire, DecalXY decalxy) { wires.at(wire).decalxy = decalxy; - wireGraphicsReload.insert(wire); + refreshUiWire(wire); } void Arch::setPipDecal(PipId pip, DecalXY decalxy) { pips.at(pip).decalxy = decalxy; - pipGraphicsReload.insert(pip); + refreshUiPip(pip); } void Arch::setBelDecal(BelId bel, DecalXY decalxy) { bels.at(bel).decalxy = decalxy; - belGraphicsReload.insert(bel); + refreshUiBel(bel); } // --------------------------------------------------------------- @@ -315,6 +318,19 @@ delay_t Arch::estimateDelay(WireId src, WireId dst) const // --------------------------------------------------------------- +bool Arch::place() +{ + return placer1(getCtx()); +} + +bool Arch::route() +{ + return router1(getCtx()); +} + +// --------------------------------------------------------------- + + const std::vector<GraphicElement> &Arch::getDecalGraphics(DecalId decal) const { return decal_graphics.at(decal); } DecalXY Arch::getFrameDecal() const { return frame_decalxy; } diff --git a/generic/arch.h b/generic/arch.h index c73bbf3f..85f469f9 100644 --- a/generic/arch.h +++ b/generic/arch.h @@ -158,6 +158,9 @@ 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<GraphicElement> &getDecalGraphics(DecalId decal) const; DecalXY getFrameDecal() const; DecalXY getBelDecal(BelId bel) const; diff --git a/gui/ice40/mainwindow.cc b/gui/ice40/mainwindow.cc index c4e568a3..6f0a9b97 100644 --- a/gui/ice40/mainwindow.cc +++ b/gui/ice40/mainwindow.cc @@ -29,8 +29,6 @@ #include "log.h"
#include "pack.h"
#include "pcf.h"
-#include "place_sa.h"
-#include "route.h"
static void initMainResource() { Q_INIT_RESOURCE(nextpnr); }
@@ -444,4 +442,4 @@ void MainWindow::budget() void MainWindow::place() { Q_EMIT task->place(timing_driven); }
-NEXTPNR_NAMESPACE_END
\ No newline at end of file +NEXTPNR_NAMESPACE_END
diff --git a/gui/ice40/worker.cc b/gui/ice40/worker.cc index ab82b6bb..16f5fb89 100644 --- a/gui/ice40/worker.cc +++ b/gui/ice40/worker.cc @@ -25,8 +25,6 @@ #include "log.h" #include "pack.h" #include "pcf.h" -#include "place_sa.h" -#include "route.h" #include "timing.h" NEXTPNR_NAMESPACE_BEGIN @@ -124,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(); } @@ -134,7 +132,7 @@ void Worker::route() { Q_EMIT taskStarted(); try { - Q_EMIT route_finished(route_design(ctx)); + Q_EMIT route_finished(ctx->route()); } catch (WorkerInterruptionRequested) { Q_EMIT taskCanceled(); } diff --git a/ice40/arch.cc b/ice40/arch.cc index a25c3d87..1e6b4569 100644 --- a/ice40/arch.cc +++ b/ice40/arch.cc @@ -21,6 +21,8 @@ #include <cmath> #include "log.h" #include "nextpnr.h" +#include "placer1.h" +#include "router1.h" #include "util.h" #include "gfx.h" @@ -400,6 +402,18 @@ delay_t Arch::estimateDelay(WireId src, WireId dst) const // ----------------------------------------------------------------------- +bool Arch::place() +{ + return placer1(getCtx()); +} + +bool Arch::route() +{ + return router1(getCtx()); +} + +// ----------------------------------------------------------------------- + DecalXY Arch::getFrameDecal() const { DecalXY decalxy; diff --git a/ice40/arch.h b/ice40/arch.h index 28e913e4..659139a6 100644 --- a/ice40/arch.h +++ b/ice40/arch.h @@ -643,6 +643,11 @@ struct Arch : BaseCtx // ------------------------------------------------- + bool place(); + bool route(); + + // ------------------------------------------------- + std::vector<GraphicElement> getDecalGraphics(DecalId decal) const; DecalXY getFrameDecal() const; diff --git a/ice40/main.cc b/ice40/main.cc index ff823cbe..2427ea6c 100644 --- a/ice40/main.cc +++ b/ice40/main.cc @@ -42,8 +42,6 @@ #include "pack.h" #include "pcf.h" #include "place_legaliser.h" -#include "place_sa.h" -#include "route.h" #include "timing.h" #include "version.h" @@ -339,7 +337,7 @@ int main(int argc, char *argv[]) for (int i = 0; i < int(src_wires.size()) && i < int(dst_wires.size()); i++) { delay_t actual_delay; WireId src = src_wires[i], dst = dst_wires[i]; - if (!get_actual_route_delay(&ctx, src, dst, actual_delay)) + if (!ctx.getActualRouteDelay(src, dst, actual_delay)) continue; printf("%s %s %.3f %.3f %d %d %d %d %d %d\n", ctx.getWireName(src).c_str(&ctx), ctx.getWireName(dst).c_str(&ctx), ctx.getDelayNS(actual_delay), @@ -373,10 +371,10 @@ 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 (!route_design(&ctx) && !ctx.force) + if (!ctx.route() && !ctx.force) log_error("Routing design failed.\n"); } } |