diff options
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/rtlil.cc | 9 | ||||
-rw-r--r-- | kernel/rtlil.h | 1 |
2 files changed, 10 insertions, 0 deletions
diff --git a/kernel/rtlil.cc b/kernel/rtlil.cc index 7638d4689..1d1448d45 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 e0b3a693d..df0e94dcc 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); }; |