diff options
author | Clifford Wolf <clifford@clifford.at> | 2014-02-02 21:35:26 +0100 |
---|---|---|
committer | Clifford Wolf <clifford@clifford.at> | 2014-02-02 21:35:26 +0100 |
commit | f9c4d33909c54b69d5ba513762ce4b05ed61dd30 (patch) | |
tree | 562fbed1f0dee48e7a9f5a6381884ceb4afe4db8 /kernel | |
parent | 67b0ce2578f8c7ade43e8c4e817e4bf4225e78fb (diff) | |
download | yosys-f9c4d33909c54b69d5ba513762ce4b05ed61dd30.tar.gz yosys-f9c4d33909c54b69d5ba513762ce4b05ed61dd30.tar.bz2 yosys-f9c4d33909c54b69d5ba513762ce4b05ed61dd30.zip |
Added RTLIL::SigSpec::to_single_sigbit()
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); }; |