aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/sigtools.h
diff options
context:
space:
mode:
authorAman Goel <amangoel@umich.edu>2019-09-27 12:30:27 -0400
committerGitHub <noreply@github.com>2019-09-27 12:30:27 -0400
commitcb0dc6e68b9432edc9c30c153954be53c8576911 (patch)
treec137f970f949117d04632158d73bfe1f9c146e6f /kernel/sigtools.h
parent4d343fc1cdafe469484846051680ca0b1f948549 (diff)
parent4b15cf5f76e2226bbce1a73d1e0ff54fbf093fe8 (diff)
downloadyosys-cb0dc6e68b9432edc9c30c153954be53c8576911.tar.gz
yosys-cb0dc6e68b9432edc9c30c153954be53c8576911.tar.bz2
yosys-cb0dc6e68b9432edc9c30c153954be53c8576911.zip
Merge pull request #7 from YosysHQ/master
Syncing with official repo
Diffstat (limited to 'kernel/sigtools.h')
-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;