diff options
author | Clifford Wolf <clifford@clifford.at> | 2017-12-14 02:06:39 +0100 |
---|---|---|
committer | Clifford Wolf <clifford@clifford.at> | 2017-12-14 02:06:39 +0100 |
commit | 76afff7ef67265b296455649c9bc6f0196aa5390 (patch) | |
tree | 188c184f997e7b6450f6dbc3ab82a7d6ccc6af54 /kernel | |
parent | 96ad6888496f4cd34bbf461ce26f97f598bf898c (diff) | |
download | yosys-76afff7ef67265b296455649c9bc6f0196aa5390.tar.gz yosys-76afff7ef67265b296455649c9bc6f0196aa5390.tar.bz2 yosys-76afff7ef67265b296455649c9bc6f0196aa5390.zip |
Add RTLIL::Const::is_fully_ones()
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/rtlil.cc | 11 | ||||
-rw-r--r-- | kernel/rtlil.h | 1 |
2 files changed, 12 insertions, 0 deletions
diff --git a/kernel/rtlil.cc b/kernel/rtlil.cc index 7dc7107c1..3e873054f 100644 --- a/kernel/rtlil.cc +++ b/kernel/rtlil.cc @@ -172,6 +172,17 @@ bool RTLIL::Const::is_fully_zero() const return true; } +bool RTLIL::Const::is_fully_ones() const +{ + cover("kernel.rtlil.const.is_fully_ones"); + + for (auto bit : bits) + if (bit != RTLIL::State::S1) + return false; + + return true; +} + bool RTLIL::Const::is_fully_def() const { cover("kernel.rtlil.const.is_fully_def"); diff --git a/kernel/rtlil.h b/kernel/rtlil.h index b33cb53a3..fc29e1e65 100644 --- a/kernel/rtlil.h +++ b/kernel/rtlil.h @@ -480,6 +480,7 @@ struct RTLIL::Const inline const RTLIL::State &operator[](int index) const { return bits.at(index); } bool is_fully_zero() const; + bool is_fully_ones() const; bool is_fully_def() const; bool is_fully_undef() const; |