aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--common/nextpnr.h9
-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.cc8
-rw-r--r--ecp5/arch.h4
-rw-r--r--ecp5/main.cc3
-rw-r--r--generic/arch.cc9
-rw-r--r--generic/arch.h2
-rw-r--r--gui/ice40/mainwindow.cc3
-rw-r--r--gui/ice40/worker.cc3
-rw-r--r--ice40/arch.cc8
-rw-r--r--ice40/arch.h4
-rw-r--r--ice40/main.cc5
13 files changed, 57 insertions, 18 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/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..74548391 100644
--- a/ecp5/arch.cc
+++ b/ecp5/arch.cc
@@ -23,6 +23,7 @@
#include <cstring>
#include "log.h"
#include "nextpnr.h"
+#include "router1.h"
#include "util.h"
NEXTPNR_NAMESPACE_BEGIN
@@ -288,6 +289,13 @@ delay_t Arch::estimateDelay(WireId src, WireId dst) const
// -----------------------------------------------------------------------
+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..c9c5a6a1 100644
--- a/ecp5/arch.h
+++ b/ecp5/arch.h
@@ -720,6 +720,10 @@ struct Arch : BaseCtx
// -------------------------------------------------
+ bool route();
+
+ // -------------------------------------------------
+
std::vector<GraphicElement> getDecalGraphics(DecalId decal) const;
DecalXY getFrameDecal() const;
diff --git a/ecp5/main.cc b/ecp5/main.cc
index caa28563..a6128d0f 100644
--- a/ecp5/main.cc
+++ b/ecp5/main.cc
@@ -45,7 +45,6 @@
#include "jsonparse.h"
#include "pack.h"
#include "place_sa.h"
-#include "route.h"
#include "timing.h"
USING_NEXTPNR_NAMESPACE
@@ -150,7 +149,7 @@ int main(int argc, char *argv[])
if (!place_design_sa(&ctx) && !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..b82d8ce6 100644
--- a/generic/arch.cc
+++ b/generic/arch.cc
@@ -19,6 +19,7 @@
#include <math.h>
#include "nextpnr.h"
+#include "router1.h"
NEXTPNR_NAMESPACE_BEGIN
@@ -315,6 +316,14 @@ delay_t Arch::estimateDelay(WireId src, WireId dst) const
// ---------------------------------------------------------------
+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..60ac9435 100644
--- a/generic/arch.h
+++ b/generic/arch.h
@@ -158,6 +158,8 @@ struct Arch : BaseCtx
float getDelayNS(delay_t v) const { return v; }
uint32_t getDelayChecksum(delay_t v) const { return 0; }
+ 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..ea7e0667 100644
--- a/gui/ice40/mainwindow.cc
+++ b/gui/ice40/mainwindow.cc
@@ -30,7 +30,6 @@
#include "pack.h"
#include "pcf.h"
#include "place_sa.h"
-#include "route.h"
static void initMainResource() { Q_INIT_RESOURCE(nextpnr); }
@@ -444,4 +443,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..fc21ed34 100644
--- a/gui/ice40/worker.cc
+++ b/gui/ice40/worker.cc
@@ -26,7 +26,6 @@
#include "pack.h"
#include "pcf.h"
#include "place_sa.h"
-#include "route.h"
#include "timing.h"
NEXTPNR_NAMESPACE_BEGIN
@@ -134,7 +133,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..0bb27d38 100644
--- a/ice40/arch.cc
+++ b/ice40/arch.cc
@@ -21,6 +21,7 @@
#include <cmath>
#include "log.h"
#include "nextpnr.h"
+#include "router1.h"
#include "util.h"
#include "gfx.h"
@@ -400,6 +401,13 @@ delay_t Arch::estimateDelay(WireId src, WireId dst) const
// -----------------------------------------------------------------------
+bool Arch::route()
+{
+ return router1(getCtx());
+}
+
+// -----------------------------------------------------------------------
+
DecalXY Arch::getFrameDecal() const
{
DecalXY decalxy;
diff --git a/ice40/arch.h b/ice40/arch.h
index 28e913e4..02c37fae 100644
--- a/ice40/arch.h
+++ b/ice40/arch.h
@@ -643,6 +643,10 @@ struct Arch : BaseCtx
// -------------------------------------------------
+ bool route();
+
+ // -------------------------------------------------
+
std::vector<GraphicElement> getDecalGraphics(DecalId decal) const;
DecalXY getFrameDecal() const;
diff --git a/ice40/main.cc b/ice40/main.cc
index ff823cbe..f586a079 100644
--- a/ice40/main.cc
+++ b/ice40/main.cc
@@ -43,7 +43,6 @@
#include "pcf.h"
#include "place_legaliser.h"
#include "place_sa.h"
-#include "route.h"
#include "timing.h"
#include "version.h"
@@ -339,7 +338,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),
@@ -376,7 +375,7 @@ int main(int argc, char *argv[])
if (!place_design_sa(&ctx) && !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");
}
}