3
0
Fork 0
mirror of https://github.com/YosysHQ/yosys synced 2026-07-24 16:12:33 +00:00

rtlil: parameterize SigSpec::is_mostly_const

This commit is contained in:
tondapusili 2026-03-06 15:51:58 -08:00
parent a67471d7f9
commit e394197bc5
2 changed files with 5 additions and 3 deletions

View file

@ -5605,13 +5605,13 @@ bool RTLIL::SigSpec::is_chunk() const
return ++it == cs.end();
}
bool RTLIL::SigSpec::is_mostly_const() const
bool RTLIL::SigSpec::is_mostly_const(double const_ratio_threshold) const
{
int constbits = 0;
for (auto &chunk : chunks())
if (chunk.width > 0 && chunk.wire == NULL)
constbits += chunk.width;
return (constbits > size()/2);
return (constbits > size() * const_ratio_threshold);
}
bool RTLIL::SigSpec::known_driver() const