diff options
author | David Shah <dave@ds0.me> | 2020-05-24 14:23:35 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-05-24 14:23:35 +0100 |
commit | f44498a5301f9f516488fb748c684926be514346 (patch) | |
tree | d37948e9ad90850c2d90566cebc5dc6d4ac07fb9 /common/router2.cc | |
parent | 2d406f3e275beda8b70b4c7d4d5e43433dd3c43c (diff) | |
parent | e7bb04769d5d7262d3ecfd0de49953078174a880 (diff) | |
download | nextpnr-f44498a5301f9f516488fb748c684926be514346.tar.gz nextpnr-f44498a5301f9f516488fb748c684926be514346.tar.bz2 nextpnr-f44498a5301f9f516488fb748c684926be514346.zip |
Merge pull request #447 from whitequark/wasi
Port nextpnr-{ice40,ecp5} to WASI
Diffstat (limited to 'common/router2.cc')
-rw-r--r-- | common/router2.cc | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/common/router2.cc b/common/router2.cc index 26e78eaa..4dfd868b 100644 --- a/common/router2.cc +++ b/common/router2.cc @@ -33,7 +33,6 @@ #include <deque> #include <fstream> #include <queue> -#include <thread> #include "log.h" #include "nextpnr.h" #include "router1.h" @@ -985,8 +984,22 @@ struct Router2 } if (ctx->verbose) log_info("%d/%d nets not multi-threadable\n", int(tcs.at(N).route_nets.size()), int(route_queue.size())); +#ifdef NPNR_DISABLE_THREADS + // Singlethreaded routing - quadrants + for (int i = 0; i < Nq; i++) { + router_thread(tcs.at(i)); + } + // Vertical splits + for (int i = Nq; i < Nq + Nv; i++) { + router_thread(tcs.at(i)); + } + // Horizontal splits + for (int i = Nq + Nv; i < Nq + Nv + Nh; i++) { + router_thread(tcs.at(i)); + } +#else // Multithreaded part of routing - quadrants - std::vector<std::thread> threads; + std::vector<boost::thread> threads; for (int i = 0; i < Nq; i++) { threads.emplace_back([this, &tcs, i]() { router_thread(tcs.at(i)); }); } @@ -1007,6 +1020,7 @@ struct Router2 for (auto &t : threads) t.join(); threads.clear(); +#endif // Singlethreaded part of routing - nets that cross partitions // or don't fit within bounding box for (auto st_net : tcs.at(N).route_nets) @@ -1130,4 +1144,4 @@ Router2Cfg::Router2Cfg(Context *ctx) perf_profile = ctx->setting<float>("router2/perfProfile", false); } -NEXTPNR_NAMESPACE_END
\ No newline at end of file +NEXTPNR_NAMESPACE_END |