diff options
Diffstat (limited to 'common')
-rw-r--r-- | common/nextpnr.h | 15 | ||||
-rw-r--r-- | common/pybindings.h | 12 | ||||
-rw-r--r-- | common/timing_opt.cc | 2 |
3 files changed, 28 insertions, 1 deletions
diff --git a/common/nextpnr.h b/common/nextpnr.h index d4db9e9e..78bbf66e 100644 --- a/common/nextpnr.h +++ b/common/nextpnr.h @@ -243,6 +243,21 @@ struct IdStringList const IdString &operator[](size_t idx) const { return ids[idx]; } bool operator==(const IdStringList &other) const { return ids == other.ids; } bool operator!=(const IdStringList &other) const { return ids != other.ids; } + bool operator<(const IdStringList &other) const + { + if (size() > other.size()) + return false; + if (size() < other.size()) + return true; + for (size_t i = 0; i < size(); i++) { + IdString a = ids[i], b = other[i]; + if (a.index < b.index) + return true; + if (a.index > b.index) + return false; + } + return false; + } }; NEXTPNR_NAMESPACE_END diff --git a/common/pybindings.h b/common/pybindings.h index e50ffd1b..3e33a374 100644 --- a/common/pybindings.h +++ b/common/pybindings.h @@ -74,6 +74,18 @@ template <> struct string_converter<const IdString> inline std::string to_str(Context *ctx, IdString id) { return id.str(ctx); } }; +template <> struct string_converter<IdStringList> +{ + IdStringList from_str(Context *ctx, std::string name) { return IdStringList::parse(ctx, name); } + std::string to_str(Context *ctx, const IdStringList &id) { return id.str(ctx); } +}; + +template <> struct string_converter<const IdStringList> +{ + IdStringList from_str(Context *ctx, std::string name) { return IdStringList::parse(ctx, name); } + std::string to_str(Context *ctx, const IdStringList &id) { return id.str(ctx); } +}; + } // namespace PythonConversion NEXTPNR_NAMESPACE_END diff --git a/common/timing_opt.cc b/common/timing_opt.cc index 7ee7b805..9c601e48 100644 --- a/common/timing_opt.cc +++ b/common/timing_opt.cc @@ -59,7 +59,7 @@ template <> struct hash<std::pair<int, NEXTPNR_NAMESPACE_PREFIX BelId>> return seed; } }; -#if !defined(ARCH_GENERIC) && !defined(ARCH_GOWIN) +#if !defined(ARCH_GOWIN) template <> struct hash<std::pair<NEXTPNR_NAMESPACE_PREFIX IdString, NEXTPNR_NAMESPACE_PREFIX BelId>> { std::size_t |