diff options
author | Eddie Hung <eddie.hung+gitlab@gmail.com> | 2018-07-21 19:03:35 +0000 |
---|---|---|
committer | Eddie Hung <eddie.hung+gitlab@gmail.com> | 2018-07-21 19:03:35 +0000 |
commit | f176ee48cdd6b508f6f26e7b2ccca97a680929cf (patch) | |
tree | 93d8b7f0baad5b504aff26acdba441ea6ba6d8c6 /common/router1.cc | |
parent | 3eecccc6f7f8c36994e9227adfc8ab1067ea287f (diff) | |
parent | 1f6897733b57f03cf7f5ccab46c27de811d42167 (diff) | |
download | nextpnr-f176ee48cdd6b508f6f26e7b2ccca97a680929cf.tar.gz nextpnr-f176ee48cdd6b508f6f26e7b2ccca97a680929cf.tar.bz2 nextpnr-f176ee48cdd6b508f6f26e7b2ccca97a680929cf.zip |
Merge branch 'redist_slack' into 'redist_slack'
Redist slack
See merge request eddiehung/nextpnr!5
Diffstat (limited to 'common/router1.cc')
-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) |