3
0
Fork 0
mirror of https://github.com/YosysHQ/yosys synced 2025-09-29 04:39:02 +00:00

kernel: Add known_driver method to Wire/SigSpec

This commit is contained in:
Jannis Harder 2025-09-03 15:29:08 +02:00
parent 22423b97c1
commit c4f435569f
2 changed files with 13 additions and 0 deletions

View file

@ -5534,6 +5534,15 @@ bool RTLIL::SigSpec::is_chunk() const
return GetSize(chunks_) == 1;
}
bool RTLIL::SigSpec::known_driver() const
{
pack();
for (auto &chunk : chunks_)
if (chunk.is_wire() && !chunk.wire->known_driver())
return false;
return true;
}
bool RTLIL::SigSpec::is_fully_const() const
{
cover("kernel.rtlil.sigspec.is_fully_const");

View file

@ -1329,6 +1329,8 @@ public:
bool is_chunk() const;
inline bool is_bit() const { return width_ == 1; }
bool known_driver() const;
bool is_fully_const() const;
bool is_fully_zero() const;
bool is_fully_ones() const;
@ -2059,6 +2061,8 @@ public:
int width, start_offset, port_id;
bool port_input, port_output, upto, is_signed;
bool known_driver() const { return driverCell_ != nullptr; }
RTLIL::Cell *driverCell() const { log_assert(driverCell_); return driverCell_; };
RTLIL::IdString driverPort() const { log_assert(driverCell_); return driverPort_; };