diff options
author | Claire Xenia Wolf <claire@clairexen.net> | 2021-09-27 16:02:20 +0200 |
---|---|---|
committer | Claire Xenia Wolf <claire@clairexen.net> | 2021-09-27 16:02:20 +0200 |
commit | 89df26e4bcc958708f9c0715440ff08975d4e0f7 (patch) | |
tree | a1af2b6441f019ae0e7b42bd0336067b7a97dd6d /backends/rtlil | |
parent | 1cac671c70bc3da9808ceb3add15686da4a5d82e (diff) | |
download | yosys-89df26e4bcc958708f9c0715440ff08975d4e0f7.tar.gz yosys-89df26e4bcc958708f9c0715440ff08975d4e0f7.tar.bz2 yosys-89df26e4bcc958708f9c0715440ff08975d4e0f7.zip |
Add optimization to rtlil back-end for all-x parameter values
Signed-off-by: Claire Xenia Wolf <claire@clairexen.net>
Diffstat (limited to 'backends/rtlil')
-rw-r--r-- | backends/rtlil/rtlil_backend.cc | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/backends/rtlil/rtlil_backend.cc b/backends/rtlil/rtlil_backend.cc index a6e45b2f2..68521d52d 100644 --- a/backends/rtlil/rtlil_backend.cc +++ b/backends/rtlil/rtlil_backend.cc @@ -51,15 +51,19 @@ void RTLIL_BACKEND::dump_const(std::ostream &f, const RTLIL::Const &data, int wi } } f << stringf("%d'", width); - for (int i = offset+width-1; i >= offset; i--) { - log_assert(i < (int)data.bits.size()); - switch (data.bits[i]) { - case State::S0: f << stringf("0"); break; - case State::S1: f << stringf("1"); break; - case RTLIL::Sx: f << stringf("x"); break; - case RTLIL::Sz: f << stringf("z"); break; - case RTLIL::Sa: f << stringf("-"); break; - case RTLIL::Sm: f << stringf("m"); break; + if (data.is_fully_undef()) { + f << "x"; + } else { + for (int i = offset+width-1; i >= offset; i--) { + log_assert(i < (int)data.bits.size()); + switch (data.bits[i]) { + case State::S0: f << stringf("0"); break; + case State::S1: f << stringf("1"); break; + case RTLIL::Sx: f << stringf("x"); break; + case RTLIL::Sz: f << stringf("z"); break; + case RTLIL::Sa: f << stringf("-"); break; + case RTLIL::Sm: f << stringf("m"); break; + } } } } else { |