diff options
Diffstat (limited to 'common')
-rw-r--r-- | common/bits.cc | 11 | ||||
-rw-r--r-- | common/bits.h | 8 | ||||
-rw-r--r-- | common/dynamic_bitarray.h | 15 | ||||
-rw-r--r-- | common/exclusive_state_groups.h | 4 | ||||
-rw-r--r-- | common/placer1.cc | 2 | ||||
-rw-r--r-- | common/placer_heap.cc | 2 | ||||
-rw-r--r-- | common/router1.cc | 2 | ||||
-rw-r--r-- | common/router2.cc | 2 | ||||
-rw-r--r-- | common/scope_lock.h | 6 |
9 files changed, 29 insertions, 23 deletions
diff --git a/common/bits.cc b/common/bits.cc index 36c7539a..b20c2e86 100644 --- a/common/bits.cc +++ b/common/bits.cc @@ -19,10 +19,13 @@ */ #include "bits.h" + #include <limits> #include <stdexcept> -namespace nextpnr { +#include "log.h" + +NEXTPNR_NAMESPACE_BEGIN int Bits::generic_popcount(unsigned int v) { @@ -37,7 +40,7 @@ int Bits::generic_popcount(unsigned int v) int Bits::generic_ctz(unsigned int x) { if (x == 0) { - throw std::runtime_error("Cannot call ctz with arg = 0"); + log_error("Cannot call ctz with arg = 0"); } for (size_t i = 0; i < std::numeric_limits<unsigned int>::digits; ++i) { @@ -47,7 +50,7 @@ int Bits::generic_ctz(unsigned int x) } // Unreachable! - throw std::runtime_error("Unreachable!"); + log_error("Unreachable!"); } -}; // namespace nextpnr +NEXTPNR_NAMESPACE_END diff --git a/common/bits.h b/common/bits.h index d1598a8e..1d6bb8be 100644 --- a/common/bits.h +++ b/common/bits.h @@ -37,9 +37,9 @@ #pragma intrinsic(_BitScanForward, _BitScanReverse, __popcnt) #endif -// Uses plain nextpnr namespace to avoid header inclusion nightmare that is -// "nextpnr.h". -namespace nextpnr { +#include "nextpnr_namespaces.h" + +NEXTPNR_NAMESPACE_BEGIN struct Bits { @@ -71,6 +71,6 @@ struct Bits } }; -}; // namespace nextpnr +NEXTPNR_NAMESPACE_END #endif /* BITS_H */ diff --git a/common/dynamic_bitarray.h b/common/dynamic_bitarray.h index 2b5ab2bc..605d59d5 100644 --- a/common/dynamic_bitarray.h +++ b/common/dynamic_bitarray.h @@ -17,18 +17,19 @@ * */ +#ifndef DYNAMIC_BITARRAY_H +#define DYNAMIC_BITARRAY_H + #include <cstdint> #include <limits> #include <vector> -// This class implements a simple dynamic bitarray, backed by some resizable -// random access storage. The default is to use a std::vector<uint8_t>. - -#ifndef DYNAMIC_BITARRAY_H -#define DYNAMIC_BITARRAY_H +#include "nextpnr_namespaces.h" -namespace nextpnr { +NEXTPNR_NAMESPACE_BEGIN +// This class implements a simple dynamic bitarray, backed by some resizable +// random access storage. The default is to use a std::vector<uint8_t>. template <typename Storage = std::vector<uint8_t>> class DynamicBitarray { public: @@ -76,6 +77,6 @@ template <typename Storage = std::vector<uint8_t>> class DynamicBitarray Storage storage; }; -}; // namespace nextpnr +NEXTPNR_NAMESPACE_END #endif /* DYNAMIC_BITARRAY_H */ diff --git a/common/exclusive_state_groups.h b/common/exclusive_state_groups.h index cd3f0bfa..68ce7c4e 100644 --- a/common/exclusive_state_groups.h +++ b/common/exclusive_state_groups.h @@ -111,10 +111,10 @@ template <size_t StateCount, typename StateType = int8_t, typename CountType = u // Check whether the state group is now unselected or satified. auto value = selected_states.to_ulong(); - auto number_selected = nextpnr::Bits::popcount(value); + auto number_selected = Bits::popcount(value); if (number_selected == 1) { // Group is no longer overconstrained. - state = nextpnr::Bits::ctz(value); + state = Bits::ctz(value); NPNR_ASSERT(selected_states[state]); } else if (number_selected == 0) { // Group is unselected. diff --git a/common/placer1.cc b/common/placer1.cc index c8b0d385..c2698ad9 100644 --- a/common/placer1.cc +++ b/common/placer1.cc @@ -144,7 +144,7 @@ class SAPlacer { log_break(); - nextpnr::ScopeLock<Context> lock(ctx); + ScopeLock<Context> lock(ctx); size_t placed_cells = 0; std::vector<CellInfo *> autoplaced; diff --git a/common/placer_heap.cc b/common/placer_heap.cc index 3ee8503c..97c9c4e5 100644 --- a/common/placer_heap.cc +++ b/common/placer_heap.cc @@ -151,7 +151,7 @@ class HeAPPlacer { auto startt = std::chrono::high_resolution_clock::now(); - nextpnr::ScopeLock<Context> lock(ctx); + ScopeLock<Context> lock(ctx); place_constraints(); build_fast_bels(); seed_placement(); diff --git a/common/router1.cc b/common/router1.cc index bffbc9f9..30ebc113 100644 --- a/common/router1.cc +++ b/common/router1.cc @@ -806,7 +806,7 @@ bool router1(Context *ctx, const Router1Cfg &cfg) try { log_break(); log_info("Routing..\n"); - nextpnr::ScopeLock<Context> lock(ctx); + ScopeLock<Context> lock(ctx); auto rstart = std::chrono::high_resolution_clock::now(); log_info("Setting up routing queue.\n"); diff --git a/common/router2.cc b/common/router2.cc index ccce5205..27f8ec0d 100644 --- a/common/router2.cc +++ b/common/router2.cc @@ -1218,7 +1218,7 @@ struct Router2 ThreadContext st; int iter = 1; - nextpnr::ScopeLock<Context> lock(ctx); + ScopeLock<Context> lock(ctx); for (size_t i = 0; i < nets_by_udata.size(); i++) route_queue.push_back(i); diff --git a/common/scope_lock.h b/common/scope_lock.h index 7b6c9dcd..2f0f767c 100644 --- a/common/scope_lock.h +++ b/common/scope_lock.h @@ -22,7 +22,9 @@ #include <stdexcept> -namespace nextpnr { +#include "nextpnr_namespaces.h" + +NEXTPNR_NAMESPACE_BEGIN // Provides a simple RAII locking object. ScopeLock takes a lock when // constructed, and releases the lock on destruction or if "unlock_early" is @@ -60,6 +62,6 @@ template <typename LockingObject> class ScopeLock bool locked_; }; -}; // namespace nextpnr +NEXTPNR_NAMESPACE_END #endif /* SCOPE_LOCK_H */ |