summaryrefslogtreecommitdiff
path: root/kernel
diff options
context:
space:
mode:
authorClifford Wolf <clifford@clifford.at>2014-02-02 21:35:26 +0100
committerClifford Wolf <clifford@clifford.at>2014-02-02 21:35:26 +0100
commitf9c4d33909c54b69d5ba513762ce4b05ed61dd30 (patch)
tree562fbed1f0dee48e7a9f5a6381884ceb4afe4db8 /kernel
parent67b0ce2578f8c7ade43e8c4e817e4bf4225e78fb (diff)
Added RTLIL::SigSpec::to_single_sigbit()
Diffstat (limited to 'kernel')
-rw-r--r--kernel/rtlil.cc9
-rw-r--r--kernel/rtlil.h1
2 files changed, 10 insertions, 0 deletions
diff --git a/kernel/rtlil.cc b/kernel/rtlil.cc
index 7638d468..1d1448d4 100644
--- a/kernel/rtlil.cc
+++ b/kernel/rtlil.cc
@@ -1551,6 +1551,15 @@ std::vector<RTLIL::SigBit> RTLIL::SigSpec::to_sigbit_vector() const
return sigbits;
}
+RTLIL::SigBit RTLIL::SigSpec::to_single_sigbit() const
+{
+ log_assert(width == 1);
+ for (auto &c : chunks)
+ if (c.width)
+ return RTLIL::SigBit(c);
+ log_abort();
+}
+
static void sigspec_parse_split(std::vector<std::string> &tokens, const std::string &text, char sep)
{
size_t start = 0, end = 0;
diff --git a/kernel/rtlil.h b/kernel/rtlil.h
index e0b3a693..df0e94dc 100644
--- a/kernel/rtlil.h
+++ b/kernel/rtlil.h
@@ -409,6 +409,7 @@ struct RTLIL::SigSpec {
bool match(std::string pattern) const;
std::set<RTLIL::SigBit> to_sigbit_set() const;
std::vector<RTLIL::SigBit> to_sigbit_vector() const;
+ RTLIL::SigBit to_single_sigbit() const;
static bool parse(RTLIL::SigSpec &sig, RTLIL::Module *module, std::string str);
static bool parse_rhs(const RTLIL::SigSpec &lhs, RTLIL::SigSpec &sig, RTLIL::Module *module, std::string str);
};