3
0
Fork 0
mirror of https://github.com/YosysHQ/yosys synced 2025-11-03 13:07:58 +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 a0e9e2d364
commit 0d45d9cc6e

View file

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