aboutsummaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
authorEddie Hung <eddie@fpgeh.com>2019-09-18 12:23:22 -0700
committerEddie Hung <eddie@fpgeh.com>2019-09-18 12:23:22 -0700
commitfd3b033903bf005c4308923ccb34ab269d55dd3e (patch)
treebdb846f228a6517612fab5b7f19a642c91fd093d /kernel
parent25e0f0c3765060b7ce25a0c58bc926b90dba304d (diff)
parent3ec28ec53a4350d041cd24a4fa9b03e985d20d95 (diff)
downloadyosys-fd3b033903bf005c4308923ccb34ab269d55dd3e.tar.gz
yosys-fd3b033903bf005c4308923ccb34ab269d55dd3e.tar.bz2
yosys-fd3b033903bf005c4308923ccb34ab269d55dd3e.zip
Merge remote-tracking branch 'origin/master' into xc7dsp
Diffstat (limited to 'kernel')
-rw-r--r--kernel/sigtools.h11
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;