diff options
author | Eddie Hung <eddie@fpgeh.com> | 2019-09-15 13:56:07 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-09-15 13:56:07 -0700 |
commit | 2b93b8fc74d98d1d2b1ec9a8cfb5665db1666726 (patch) | |
tree | 5389b83070c6430560fed254e7ee5d642a74299b /kernel | |
parent | 09ac36da601aab607f01ccf6e2baa29296877877 (diff) | |
parent | 9a84e4711cfa7a6ee82b8d67a48be96064659651 (diff) | |
download | yosys-2b93b8fc74d98d1d2b1ec9a8cfb5665db1666726.tar.gz yosys-2b93b8fc74d98d1d2b1ec9a8cfb5665db1666726.tar.bz2 yosys-2b93b8fc74d98d1d2b1ec9a8cfb5665db1666726.zip |
Merge pull request #1374 from YosysHQ/eddie/fix1371
Fix two non-deterministic behaviours that cause divergence between compilers
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/sigtools.h | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/kernel/sigtools.h b/kernel/sigtools.h index 4e97bb775..2517d6de3 100644 --- a/kernel/sigtools.h +++ b/kernel/sigtools.h @@ -135,9 +135,11 @@ struct SigPool } }; -template <typename T, class Compare = std::less<T>> +template <typename T, class Compare = void> struct SigSet { + static_assert(!std::is_same<Compare,void>::value, "Default value for `Compare' class not found for SigSet<T>. Please specify."); + struct bitDef_t : public std::pair<RTLIL::Wire*, int> { bitDef_t() : std::pair<RTLIL::Wire*, int>(NULL, 0) { } bitDef_t(const RTLIL::SigBit &bit) : std::pair<RTLIL::Wire*, int>(bit.wire, bit.offset) { } @@ -220,6 +222,13 @@ struct SigSet } }; +template<typename T> +class SigSet<T, typename std::enable_if<!std::is_pointer<T>::value>::type> : public SigSet<T, std::less<T>> {}; +template<typename T> +using sort_by_name_id_guard = typename std::enable_if<std::is_same<T,RTLIL::Cell*>::value>::type; +template<typename T> +class SigSet<T, sort_by_name_id_guard<T>> : public SigSet<T, RTLIL::sort_by_name_id<typename std::remove_pointer<T>::type>> {}; + struct SigMap { mfp<SigBit> database; |