3
0
Fork 0
mirror of https://github.com/YosysHQ/yosys synced 2025-04-14 21:08:47 +00:00

Merge pull request #3017 from YosysHQ/claire/short_rtlil_x_const

Add optimization to rtlil back-end for all-x parameter values
This commit is contained in:
Miodrag Milanović 2021-09-28 18:03:14 +02:00 committed by GitHub
commit 62739f7bf7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -51,6 +51,9 @@ void RTLIL_BACKEND::dump_const(std::ostream &f, const RTLIL::Const &data, int wi
} }
} }
f << stringf("%d'", width); f << stringf("%d'", width);
if (data.is_fully_undef()) {
f << "x";
} else {
for (int i = offset+width-1; i >= offset; i--) { for (int i = offset+width-1; i >= offset; i--) {
log_assert(i < (int)data.bits.size()); log_assert(i < (int)data.bits.size());
switch (data.bits[i]) { switch (data.bits[i]) {
@ -62,6 +65,7 @@ void RTLIL_BACKEND::dump_const(std::ostream &f, const RTLIL::Const &data, int wi
case RTLIL::Sm: f << stringf("m"); break; case RTLIL::Sm: f << stringf("m"); break;
} }
} }
}
} else { } else {
f << stringf("\""); f << stringf("\"");
std::string str = data.decode_string(); std::string str = data.decode_string();