diff options
author | David Shah <davey1576@gmail.com> | 2018-08-05 14:31:43 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-08-05 14:31:43 +0200 |
commit | ba97c233fb6e4502f3465a602f997cc2382f0e06 (patch) | |
tree | 3a62397aebff56e2031f3d5c6c930ead2699d641 /common | |
parent | 8a9b3626d32e8845dc51044e0f281c0ccdb7e53a (diff) | |
parent | 287fe7e89451b952d15c7839aff9cb3db12bf807 (diff) | |
download | nextpnr-ba97c233fb6e4502f3465a602f997cc2382f0e06.tar.gz nextpnr-ba97c233fb6e4502f3465a602f997cc2382f0e06.tar.bz2 nextpnr-ba97c233fb6e4502f3465a602f997cc2382f0e06.zip |
Merge pull request #36 from YosysHQ/lutperm
Add LUT input permutations, improvements in ice40 timing model, improvements in router
Diffstat (limited to 'common')
-rw-r--r-- | common/nextpnr.h | 3 | ||||
-rw-r--r-- | common/router1.cc | 40 | ||||
-rw-r--r-- | common/router1.h | 1 |
3 files changed, 35 insertions, 9 deletions
diff --git a/common/nextpnr.h b/common/nextpnr.h index c87a98d9..bb55d4ff 100644 --- a/common/nextpnr.h +++ b/common/nextpnr.h @@ -484,7 +484,8 @@ struct Context : Arch, DeterministicRNG delay_t getNetinfoRouteDelay(const NetInfo *net_info, const PortRef &sink) const; // provided by router1.cc - bool getActualRouteDelay(WireId src_wire, WireId dst_wire, delay_t &delay); + bool getActualRouteDelay(WireId src_wire, WireId dst_wire, delay_t *delay = nullptr, + std::unordered_map<WireId, PipId> *route = nullptr, bool useEstimate = true); // -------------------------------------------------------------- diff --git a/common/router1.cc b/common/router1.cc index dd338b35..77e84696 100644 --- a/common/router1.cc +++ b/common/router1.cc @@ -130,7 +130,8 @@ struct Router qw.wire = it.first; qw.pip = PipId(); qw.delay = it.second - (it.second / 16); - qw.togo = ctx->estimateDelay(qw.wire, dst_wire); + if (cfg.useEstimate) + qw.togo = ctx->estimateDelay(qw.wire, dst_wire); qw.randtag = ctx->rng(); queue.push(qw); @@ -216,7 +217,8 @@ struct Router next_qw.wire = next_wire; next_qw.pip = pip; next_qw.delay = next_delay; - next_qw.togo = ctx->estimateDelay(next_wire, dst_wire); + if (cfg.useEstimate) + next_qw.togo = ctx->estimateDelay(next_wire, dst_wire); next_qw.randtag = ctx->rng(); visited[next_qw.wire] = next_qw; @@ -420,7 +422,9 @@ struct Router NPNR_ASSERT(ripup); NPNR_ASSERT(conflicting_pip_net != net_name); - ctx->unbindPip(pip); + if (ctx->getBoundPipNet(pip) == conflicting_pip_net) + ctx->unbindPip(pip); + if (!ctx->checkPipAvail(pip)) ripup_net(ctx, conflicting_pip_net); @@ -945,13 +949,33 @@ bool router1(Context *ctx, const Router1Cfg &cfg) } } -bool Context::getActualRouteDelay(WireId src_wire, WireId dst_wire, delay_t &delay) +bool Context::getActualRouteDelay(WireId src_wire, WireId dst_wire, delay_t *delay, + std::unordered_map<WireId, PipId> *route, bool useEstimate) { RipupScoreboard scores; - Router router(this, Router1Cfg(), scores, src_wire, dst_wire); - if (router.routedOkay) - delay = router.visited.at(dst_wire).delay; - return router.routedOkay; + Router1Cfg cfg; + cfg.useEstimate = useEstimate; + + Router router(this, cfg, scores, src_wire, dst_wire); + + if (!router.routedOkay) + return false; + + if (delay != nullptr) + *delay = router.visited.at(dst_wire).delay; + + if (route != nullptr) { + WireId cursor = dst_wire; + while (1) { + PipId pip = router.visited.at(cursor).pip; + (*route)[cursor] = pip; + if (pip == PipId()) + break; + cursor = getPipSrcWire(pip); + } + } + + return true; } NEXTPNR_NAMESPACE_END diff --git a/common/router1.h b/common/router1.h index a9e84b6b..0380adc2 100644 --- a/common/router1.h +++ b/common/router1.h @@ -29,6 +29,7 @@ struct Router1Cfg int maxIterCnt = 200; bool cleanupReroute = true; bool fullCleanupReroute = true; + bool useEstimate = true; }; extern bool router1(Context *ctx, const Router1Cfg &cfg); |