diff options
author | whitequark <whitequark@whitequark.org> | 2018-12-23 09:04:23 +0000 |
---|---|---|
committer | whitequark <whitequark@whitequark.org> | 2018-12-23 09:04:30 +0000 |
commit | 18291c20d2b17689729d9c36b08967e928e4e32a (patch) | |
tree | 12137ac745879d7f4c9c9d00b6285b9a3f6c7d86 /kernel | |
parent | b784440857d6b71f46ae8784cc3767962e4edcaa (diff) | |
download | yosys-18291c20d2b17689729d9c36b08967e928e4e32a.tar.gz yosys-18291c20d2b17689729d9c36b08967e928e4e32a.tar.bz2 yosys-18291c20d2b17689729d9c36b08967e928e4e32a.zip |
proc_clean: remove any empty cases if all cases use all-def compare.
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/rtlil.cc | 10 | ||||
-rw-r--r-- | kernel/rtlil.h | 4 |
2 files changed, 14 insertions, 0 deletions
diff --git a/kernel/rtlil.cc b/kernel/rtlil.cc index 14259f8ed..8404db5e9 100644 --- a/kernel/rtlil.cc +++ b/kernel/rtlil.cc @@ -3793,6 +3793,11 @@ RTLIL::CaseRule::~CaseRule() delete *it; } +bool RTLIL::CaseRule::empty() const +{ + return actions.empty() && switches.empty(); +} + RTLIL::CaseRule *RTLIL::CaseRule::clone() const { RTLIL::CaseRule *new_caserule = new RTLIL::CaseRule; @@ -3809,6 +3814,11 @@ RTLIL::SwitchRule::~SwitchRule() delete *it; } +bool RTLIL::SwitchRule::empty() const +{ + return cases.empty(); +} + RTLIL::SwitchRule *RTLIL::SwitchRule::clone() const { RTLIL::SwitchRule *new_switchrule = new RTLIL::SwitchRule; diff --git a/kernel/rtlil.h b/kernel/rtlil.h index 276540aa1..f877622aa 100644 --- a/kernel/rtlil.h +++ b/kernel/rtlil.h @@ -1227,6 +1227,8 @@ struct RTLIL::CaseRule ~CaseRule(); void optimize(); + bool empty() const; + template<typename T> void rewrite_sigspecs(T &functor); RTLIL::CaseRule *clone() const; }; @@ -1238,6 +1240,8 @@ struct RTLIL::SwitchRule : public RTLIL::AttrObject ~SwitchRule(); + bool empty() const; + template<typename T> void rewrite_sigspecs(T &functor); RTLIL::SwitchRule *clone() const; }; |