aboutsummaryrefslogtreecommitdiffstats
path: root/common/router2.cc
diff options
context:
space:
mode:
Diffstat (limited to 'common/router2.cc')
-rw-r--r--common/router2.cc26
1 files changed, 12 insertions, 14 deletions
diff --git a/common/router2.cc b/common/router2.cc
index 2f9f0ac4..0a3a4e94 100644
--- a/common/router2.cc
+++ b/common/router2.cc
@@ -37,6 +37,7 @@
#include "log.h"
#include "nextpnr.h"
#include "router1.h"
+#include "scope_lock.h"
#include "timing.h"
#include "util.h"
@@ -112,16 +113,14 @@ struct Router2
Context *ctx;
Router2Cfg cfg;
- Router2(Context *ctx, const Router2Cfg &cfg) : ctx(ctx), cfg(cfg) {}
+ Router2(Context *ctx, const Router2Cfg &cfg) : ctx(ctx), cfg(cfg), tmg(ctx) { tmg.setup(); }
// Use 'udata' for fast net lookups and indexing
std::vector<NetInfo *> nets_by_udata;
std::vector<PerNetData> nets;
bool timing_driven;
-
- // Criticality data from timing analysis
- NetCriticalityMap net_crit;
+ TimingAnalyser tmg;
void setup_nets()
{
@@ -640,7 +639,7 @@ struct Router2
bool debug_arc = /*usr.cell->type.str(ctx).find("RAMB") != std::string::npos && (usr.port ==
ctx->id("ADDRATIEHIGH0") || usr.port == ctx->id("ADDRARDADDRL0"))*/
false;
- while (!t.queue.empty() && (!is_bb || iter < toexplore)) {
+ while (!t.queue.empty() && iter < toexplore) {
auto curr = t.queue.top();
auto &d = flat_wires.at(curr.wire);
t.queue.pop();
@@ -1162,6 +1161,8 @@ struct Router2
ThreadContext st;
int iter = 1;
+ nextpnr::ScopeLock<Context> lock(ctx);
+
for (size_t i = 0; i < nets_by_udata.size(); i++)
route_queue.push_back(i);
@@ -1173,18 +1174,13 @@ struct Router2
if (timing_driven && (int(route_queue.size()) > (int(nets_by_udata.size()) / 50))) {
// Heuristic: reduce runtime by skipping STA in the case of a "long tail" of a few
// congested nodes
- get_criticalities(ctx, &net_crit);
+ tmg.run();
for (auto n : route_queue) {
- IdString name = nets_by_udata.at(n)->name;
- auto fnd = net_crit.find(name);
+ NetInfo *ni = nets_by_udata.at(n);
auto &net = nets.at(n);
net.max_crit = 0;
- if (fnd == net_crit.end())
- continue;
- for (int i = 0; i < int(fnd->second.criticality.size()); i++) {
- float c = fnd->second.criticality.at(i);
- for (auto &a : net.arcs.at(i))
- a.arc_crit = c;
+ for (auto &usr : ni->users) {
+ float c = tmg.get_criticality(CellPortKey(usr));
net.max_crit = std::max(net.max_crit, c);
}
}
@@ -1238,6 +1234,8 @@ struct Router2
log_info("Running router1 to check that route is legal...\n");
+ lock.unlock_early();
+
router1(ctx, Router1Cfg(ctx));
}
};