3
0
Fork 0
mirror of https://github.com/YosysHQ/yosys synced 2025-11-13 09:31:16 +00:00

Make SigSpec::is_one_hot use try_as_const

This commit is contained in:
Robert O'Callahan 2025-10-28 12:39:31 +00:00
parent ce597dc38c
commit dd3940c8bb

View file

@ -5540,12 +5540,8 @@ bool RTLIL::SigSpec::is_onehot(int *pos) const
{ {
cover("kernel.rtlil.sigspec.is_onehot"); cover("kernel.rtlil.sigspec.is_onehot");
pack(); if (std::optional<RTLIL::Const> c = try_as_const())
if (!is_fully_const()) return c->is_onehot(pos);
return false;
log_assert(GetSize(chunks_) <= 1);
if (width_)
return RTLIL::Const(chunks_[0].data).is_onehot(pos);
return false; return false;
} }