mirror of
https://github.com/YosysHQ/yosys
synced 2025-04-21 16:16:39 +00:00
Add is_mostly_const to SigSpec
This commit is contained in:
parent
610d4cc716
commit
7d33fd463b
|
@ -5164,6 +5164,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::is_fully_const() const
|
||||
{
|
||||
cover("kernel.rtlil.sigspec.is_fully_const");
|
||||
|
|
|
@ -1094,6 +1094,7 @@ public:
|
|||
bool is_chunk() const;
|
||||
inline bool is_bit() const { return width_ == 1; }
|
||||
|
||||
bool is_mostly_const() const;
|
||||
bool is_fully_const() const;
|
||||
bool is_fully_zero() const;
|
||||
bool is_fully_ones() const;
|
||||
|
|
Loading…
Reference in a new issue