From d86a25f145012ccb6b2048af3aae22f13b97b505 Mon Sep 17 00:00:00 2001 From: Clifford Wolf Date: Mon, 28 Jul 2014 10:52:58 +0200 Subject: Added std::initializer_list<> constructor to SigSpec --- kernel/rtlil.cc | 12 ++++++++++++ kernel/rtlil.h | 3 +++ 2 files changed, 15 insertions(+) (limited to 'kernel') diff --git a/kernel/rtlil.cc b/kernel/rtlil.cc index 610ab6a8..753c4009 100644 --- a/kernel/rtlil.cc +++ b/kernel/rtlil.cc @@ -1652,6 +1652,18 @@ RTLIL::SigSpec::SigSpec(const RTLIL::SigSpec &other) *this = other; } +RTLIL::SigSpec::SigSpec(std::initializer_list parts) +{ + cover("kernel.rtlil.sigspec.init.list"); + + width_ = 0; + hash_ = 0; + + std::vector parts_vec(parts.begin(), parts.end()); + for (auto it = parts_vec.rbegin(); it != parts_vec.rend(); it++) + append(*it); +} + const RTLIL::SigSpec &RTLIL::SigSpec::operator=(const RTLIL::SigSpec &other) { cover("kernel.rtlil.sigspec.assign"); diff --git a/kernel/rtlil.h b/kernel/rtlil.h index cd00b43d..331ea377 100644 --- a/kernel/rtlil.h +++ b/kernel/rtlil.h @@ -26,6 +26,8 @@ #include #include +#include + // various helpers (unrelated to RTLIL) std::string stringf(const char *fmt, ...); #define SIZE(__obj) int(__obj.size()) @@ -738,6 +740,7 @@ private: public: SigSpec(); SigSpec(const RTLIL::SigSpec &other); + SigSpec(std::initializer_list parts); const RTLIL::SigSpec &operator=(const RTLIL::SigSpec &other); SigSpec(const RTLIL::Const &value); -- cgit v1.2.3