mirror of https://github.com/YosysHQ/yosys.git
rtlil.cc: Fix #4427
If a `RTLIL::Const` is composed of multiple strings, such as when using a ternary expression to select between two strings of different lengths, zero padding for the strings needs to be maintained. Only leading (and trailing) null characters should be dropped from the decoded string, rather than all null characters.
This commit is contained in:
parent
9f94ecf4ed
commit
94b44a37b2
|
@ -325,7 +325,6 @@ std::string RTLIL::Const::decode_string() const
|
|||
ch |= 1 << j;
|
||||
}
|
||||
}
|
||||
if (ch != 0)
|
||||
s.append({ch});
|
||||
}
|
||||
i -= 8;
|
||||
|
@ -336,10 +335,9 @@ std::string RTLIL::Const::decode_string() const
|
|||
ch |= 1 << j;
|
||||
}
|
||||
}
|
||||
if (ch != 0)
|
||||
s.append({ch});
|
||||
}
|
||||
return s;
|
||||
return s.substr(s.find_first_not_of('\0'));
|
||||
}
|
||||
|
||||
bool RTLIL::Const::is_fully_zero() const
|
||||
|
|
Loading…
Reference in New Issue