aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMiodrag Milanović <mmicko@gmail.com>2021-09-28 18:03:14 +0200
committerGitHub <noreply@github.com>2021-09-28 18:03:14 +0200
commit62739f7bf7b82afccd10c22bdabf89d305485966 (patch)
tree3e6fe28a2202e0addeeaffddb2481097a0f59856
parent7a7df9a3b4996b17bb774377483b15de49aa3d9b (diff)
parent89df26e4bcc958708f9c0715440ff08975d4e0f7 (diff)
downloadyosys-62739f7bf7b82afccd10c22bdabf89d305485966.tar.gz
yosys-62739f7bf7b82afccd10c22bdabf89d305485966.tar.bz2
yosys-62739f7bf7b82afccd10c22bdabf89d305485966.zip
Merge pull request #3017 from YosysHQ/claire/short_rtlil_x_const
Add optimization to rtlil back-end for all-x parameter values
-rw-r--r--backends/rtlil/rtlil_backend.cc22
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 {