aboutsummaryrefslogtreecommitdiffstats
path: root/common/router2.cc
diff options
context:
space:
mode:
authorDavid Shah <dave@ds0.me>2019-11-20 15:13:28 +0000
committerDavid Shah <dave@ds0.me>2020-02-03 11:38:31 +0000
commit59c554b50ad599cbfc6f832b6942075efe3a0dbe (patch)
tree0a1ed62fc469a35c43aeea7fca1f12bdd2ba9e8d /common/router2.cc
parent363d664f273976e1d1e23bd272329dbff3c858ce (diff)
downloadnextpnr-59c554b50ad599cbfc6f832b6942075efe3a0dbe.tar.gz
nextpnr-59c554b50ad599cbfc6f832b6942075efe3a0dbe.tar.bz2
nextpnr-59c554b50ad599cbfc6f832b6942075efe3a0dbe.zip
router2: Improve backwards routing of some cases
Signed-off-by: David Shah <dave@ds0.me>
Diffstat (limited to 'common/router2.cc')
-rw-r--r--common/router2.cc28
1 files changed, 27 insertions, 1 deletions
diff --git a/common/router2.cc b/common/router2.cc
index fcd52bb3..271595ad 100644
--- a/common/router2.cc
+++ b/common/router2.cc
@@ -374,8 +374,34 @@ struct Router2
t.backwards_queue.pop();
auto &cwd = wires.at(cursor);
PipId cpip;
- if (cwd.bound_nets.count(net->udata))
+ if (cwd.bound_nets.count(net->udata)) {
+ // If we can tack onto existing routing; try that
+ // Only do this if the existing routing is uncontented; however
+ WireId cursor2 = cursor;
+ bool bwd_merge_fail = false;
+ while (wires.at(cursor2).bound_nets.count(net->udata)) {
+ if (wires.at(cursor2).bound_nets.size() > 1) {
+ bwd_merge_fail = true;
+ break;
+ }
+ PipId p = wires.at(cursor2).bound_nets.at(net->udata).second;
+ if (p == PipId())
+ break;
+ cursor2 = ctx->getPipSrcWire(p);
+ }
+ if (!bwd_merge_fail && cursor2 == src_wire) {
+ // Found a path to merge to existing routing; backwards
+ cursor2 = cursor;
+ while (wires.at(cursor2).bound_nets.count(net->udata)) {
+ PipId p = wires.at(cursor2).bound_nets.at(net->udata).second;
+ if (p == PipId())
+ break;
+ cursor2 = ctx->getPipSrcWire(p);
+ t.backwards_pip[cursor2] = p;
+ }
+ }
cpip = cwd.bound_nets.at(net->udata).second;
+ }
bool did_something = false;
for (auto uh : ctx->getPipsUphill(cursor)) {
did_something = true;