3
0
Fork 0
mirror of https://github.com/YosysHQ/yosys synced 2025-06-06 14:13:23 +00:00

Fixed type of sign extension in opt_const $eq/$ne handling

This commit is contained in:
Clifford Wolf 2013-11-07 16:53:28 +01:00
parent ed4bcd52e5
commit 0e1661f84e
3 changed files with 26 additions and 9 deletions

View file

@ -940,6 +940,22 @@ void RTLIL::SigSpec::extend(int width, bool is_signed)
optimize();
}
void RTLIL::SigSpec::extend_un0(int width, bool is_signed)
{
if (this->width > width)
remove(width, this->width - width);
if (this->width < width) {
RTLIL::SigSpec padding = this->width > 0 ? extract(this->width - 1, 1) : RTLIL::SigSpec(RTLIL::State::S0);
if (!is_signed)
padding = RTLIL::SigSpec(RTLIL::State::S0);
while (this->width < width)
append(padding);
}
optimize();
}
void RTLIL::SigSpec::check() const
{
int w = 0;

View file

@ -342,6 +342,7 @@ struct RTLIL::SigSpec {
void append(const RTLIL::SigSpec &signal);
bool combine(RTLIL::SigSpec signal, RTLIL::State freeState = RTLIL::State::Sz, bool override = false);
void extend(int width, bool is_signed = false);
void extend_un0(int width, bool is_signed = false);
void check() const;
bool operator <(const RTLIL::SigSpec &other) const;
bool operator ==(const RTLIL::SigSpec &other) const;