Put back is_mostly_const

This commit is contained in:
Akash Levy 2025-09-29 20:56:58 -07:00
parent 313c7e4b95
commit 93a24fe275
2 changed files with 14 additions and 1 deletions

View File

@ -5437,6 +5437,18 @@ bool RTLIL::SigSpec::is_chunk() const
return GetSize(chunks_) == 1;
}
bool RTLIL::SigSpec::is_mostly_const() const
{
cover("kernel.rtlil.sigspec.is_mostly_const");
pack();
int constbits = 0;
for (auto it = chunks_.begin(); it != chunks_.end(); it++)
if (it->width > 0 && it->wire == NULL)
constbits += it->width;
return (constbits > width_/2);
}
bool RTLIL::SigSpec::known_driver() const
{
pack();

View File

@ -1347,7 +1347,8 @@ public:
inline bool is_bit() const { return width_ == 1; }
bool known_driver() const;
bool is_mostly_const() const;
bool is_fully_const() const;
bool is_fully_zero() const;
bool is_fully_ones() const;