3
0
Fork 0
mirror of https://github.com/YosysHQ/yosys synced 2025-04-23 17:15:33 +00:00

Added $eq/$neq -> $logic_not/$reduce_bool optimization

This commit is contained in:
Clifford Wolf 2015-04-29 07:28:15 +02:00
parent 9d067fecea
commit f483dce7c2
4 changed files with 38 additions and 1 deletions

View file

@ -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");

View file

@ -692,6 +692,7 @@ public:
bool is_chunk() const;
bool is_fully_const() const;
bool is_fully_zero() const;
bool is_fully_def() const;
bool is_fully_undef() const;
bool has_const() const;