summaryrefslogtreecommitdiff
path: root/kernel/rtlil.cc
diff options
context:
space:
mode:
authorClifford Wolf <clifford@clifford.at>2015-04-29 07:28:15 +0200
committerClifford Wolf <clifford@clifford.at>2015-04-29 07:28:15 +0200
commitf483dce7c231f83937b5944ed0166a70594a0e8b (patch)
treef9a2dc487da84ba9fcd53d8c56991b1dbe2dd7de /kernel/rtlil.cc
parent9d067fecea8d17dc3e800d09973f5ddaae41774b (diff)
Added $eq/$neq -> $logic_not/$reduce_bool optimization
Diffstat (limited to 'kernel/rtlil.cc')
-rw-r--r--kernel/rtlil.cc15
1 files changed, 15 insertions, 0 deletions
diff --git a/kernel/rtlil.cc b/kernel/rtlil.cc
index 8c0b41d0..bf0fd1c8 100644
--- a/kernel/rtlil.cc
+++ b/kernel/rtlil.cc
@@ -3000,6 +3000,21 @@ bool RTLIL::SigSpec::is_fully_const() const
return true;
}
+bool RTLIL::SigSpec::is_fully_zero() const
+{
+ cover("kernel.rtlil.sigspec.is_fully_zero");
+
+ pack();
+ for (auto it = chunks_.begin(); it != chunks_.end(); it++) {
+ if (it->width > 0 && it->wire != NULL)
+ return false;
+ for (size_t i = 0; i < it->data.size(); i++)
+ if (it->data[i] != RTLIL::State::S0)
+ return false;
+ }
+ return true;
+}
+
bool RTLIL::SigSpec::is_fully_def() const
{
cover("kernel.rtlil.sigspec.is_fully_def");