diff options
author | Serge Bazanski <serge@bazanski.pl> | 2018-07-17 16:27:50 +0100 |
---|---|---|
committer | Serge Bazanski <serge@bazanski.pl> | 2018-07-17 16:27:50 +0100 |
commit | 2f5b94fe309619c221c3e1ea5aa48a4523bd3156 (patch) | |
tree | 20fcaaa8364a3be58a9978578f1f796793058026 /common/router1.cc | |
parent | 498bef3f3e82ed214daf44ada83eb22a21159993 (diff) | |
download | nextpnr-2f5b94fe309619c221c3e1ea5aa48a4523bd3156.tar.gz nextpnr-2f5b94fe309619c221c3e1ea5aa48a4523bd3156.tar.bz2 nextpnr-2f5b94fe309619c221c3e1ea5aa48a4523bd3156.zip |
Add basic external locking, lock from P&R
Diffstat (limited to 'common/router1.cc')
-rw-r--r-- | common/router1.cc | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/common/router1.cc b/common/router1.cc index 94c7070e..a85de7c6 100644 --- a/common/router1.cc +++ b/common/router1.cc @@ -414,6 +414,7 @@ bool router1(Context *ctx) std::unordered_set<IdString> netsQueue; + ctx->lock(); for (auto &net_it : ctx->nets) { auto net_name = net_it.first; auto net_info = net_it.second.get(); @@ -478,6 +479,7 @@ bool router1(Context *ctx) estimatedTotalDelayCnt++; } } + ctx->unlock(); log_info("estimated total wire delay: %.2f (avg %.2f)\n", float(estimatedTotalDelay), float(estimatedTotalDelay) / estimatedTotalDelayCnt); @@ -493,6 +495,7 @@ bool router1(Context *ctx) #endif return false; } + ctx->lock(); iterCnt++; if (ctx->verbose) @@ -621,6 +624,8 @@ bool router1(Context *ctx) if (iterCnt == 8 || iterCnt == 16 || iterCnt == 32 || iterCnt == 64 || iterCnt == 128) ripup_penalty += ctx->getRipupDelayPenalty(); + + ctx->unlock(); } log_info("routing complete after %d iterations.\n", iterCnt); @@ -637,7 +642,9 @@ bool router1(Context *ctx) return true; } catch (log_execution_error_exception) { #ifndef NDEBUG + ctx->lock(); ctx->check(); + ctx->unlock(); #endif return false; } |