aboutsummaryrefslogtreecommitdiffstats
path: root/ecp5/globals.cc
diff options
context:
space:
mode:
authorDavid Shah <davey1576@gmail.com>2018-09-29 17:01:19 +0100
committerDavid Shah <davey1576@gmail.com>2018-09-29 17:01:19 +0100
commit9ff5d5a73534d19c78cc2b8c9cf4bd4d351978fa (patch)
tree73591fb1e3d9bbf250862651df735e623de130e4 /ecp5/globals.cc
parent2a0bb2be29a58017c31dd813cc061268abb292f8 (diff)
downloadnextpnr-9ff5d5a73534d19c78cc2b8c9cf4bd4d351978fa.tar.gz
nextpnr-9ff5d5a73534d19c78cc2b8c9cf4bd4d351978fa.tar.bz2
nextpnr-9ff5d5a73534d19c78cc2b8c9cf4bd4d351978fa.zip
ecp5: Fixing global router bugs
Signed-off-by: David Shah <davey1576@gmail.com>
Diffstat (limited to 'ecp5/globals.cc')
-rw-r--r--ecp5/globals.cc17
1 files changed, 14 insertions, 3 deletions
diff --git a/ecp5/globals.cc b/ecp5/globals.cc
index 0c95cd23..53bf303c 100644
--- a/ecp5/globals.cc
+++ b/ecp5/globals.cc
@@ -198,17 +198,19 @@ class Ecp5GlobalRouter
visit.push(src);
WireId cursor;
while (true) {
+
if (visit.empty() || visit.size() > 50000) {
if (allow_fail)
return false;
log_error("cannot route global from %s to %s.\n", ctx->getWireName(src).c_str(ctx),
ctx->getWireName(dst).c_str(ctx));
}
- cursor = visit.back();
+ cursor = visit.front();
visit.pop();
NetInfo *bound = ctx->getBoundWireNet(cursor);
+ if (ctx->verbose)
+ log_info(" exploring %s\n", ctx->getWireName(cursor).c_str(ctx));
if (bound == net) {
- break;
} else if (bound != nullptr) {
continue;
}
@@ -216,6 +218,8 @@ class Ecp5GlobalRouter
break;
for (auto dh : ctx->getPipsDownhill(cursor)) {
WireId pipDst = ctx->getPipDstWire(dh);
+ if (ctx->verbose)
+ log_info(" downhill -> %s\n", ctx->getWireName(pipDst).c_str(ctx));
if (backtrace.count(pipDst))
continue;
backtrace[pipDst] = dh;
@@ -226,9 +230,16 @@ class Ecp5GlobalRouter
auto fnd = backtrace.find(cursor);
if (fnd == backtrace.end())
break;
+ NetInfo * bound = ctx->getBoundWireNet(cursor);
+ if (bound != nullptr) {
+ NPNR_ASSERT(bound == net);
+ break;
+ }
ctx->bindPip(fnd->second, net, STRENGTH_LOCKED);
cursor = ctx->getPipSrcWire(fnd->second);
}
+ if (ctx->getBoundWireNet(src) == nullptr)
+ ctx->bindWire(src, net, STRENGTH_LOCKED);
return true;
}
@@ -294,7 +305,7 @@ class Ecp5GlobalRouter
public:
void promote_and_route_globals() {
- log_info("Promoting and routing globals...");
+ log_info("Promoting and routing globals...\n");
auto clocks = get_clocks();
int glbid = 0;
for (auto clock : clocks) {