diff options
author | David Shah <davey1576@gmail.com> | 2018-07-21 11:52:41 +0200 |
---|---|---|
committer | David Shah <davey1576@gmail.com> | 2018-07-21 11:52:41 +0200 |
commit | bbb140c6991f01838009a65c81399694fe8afe3f (patch) | |
tree | 9505d0ee4065335733294a7eef8f4ff77b4613be /common | |
parent | d23cdd6c06a37ef32740ee910aba6704a8a46292 (diff) | |
download | nextpnr-bbb140c6991f01838009a65c81399694fe8afe3f.tar.gz nextpnr-bbb140c6991f01838009a65c81399694fe8afe3f.tar.bz2 nextpnr-bbb140c6991f01838009a65c81399694fe8afe3f.zip |
Quick hack to route nets with lowest budget first
Diffstat (limited to 'common')
-rw-r--r-- | common/router1.cc | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/common/router1.cc b/common/router1.cc index 94c7070e..50022169 100644 --- a/common/router1.cc +++ b/common/router1.cc @@ -402,6 +402,21 @@ struct Router NEXTPNR_NAMESPACE_BEGIN +static void prioritise_nets(Context *ctx, std::vector<IdString> &netsArray) +{ + std::unordered_map<IdString, delay_t> netScores; + for (auto net_name : netsArray) { + delay_t score = std::numeric_limits<delay_t>::max(); + for (const auto &sink : ctx->nets.at(net_name)->users) { + if (sink.budget < score) + score = sink.budget; + } + netScores[net_name] = score; + } + std::sort(netsArray.begin(), netsArray.end(), + [&netScores](IdString a, IdString b) { return netScores[a] < netScores[b]; }); +} + bool router1(Context *ctx) { try { @@ -508,7 +523,7 @@ bool router1(Context *ctx) bool printNets = ctx->verbose && (netsQueue.size() < 10); std::vector<IdString> netsArray(netsQueue.begin(), netsQueue.end()); - ctx->sorted_shuffle(netsArray); + prioritise_nets(ctx, netsArray); netsQueue.clear(); for (auto net_name : netsArray) { @@ -560,7 +575,7 @@ bool router1(Context *ctx) int ripCnt = 0; std::vector<IdString> ripupArray(ripupQueue.begin(), ripupQueue.end()); - ctx->sorted_shuffle(ripupArray); + prioritise_nets(ctx, ripupArray); for (auto net_name : ripupArray) { if (printNets) |