summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClifford Wolf <clifford@clifford.at>2013-10-27 08:21:05 +0100
committerClifford Wolf <clifford@clifford.at>2013-10-27 08:21:05 +0100
commitd9fa1e5a1d01e5a69dca6f8f0d760b047f29a772 (patch)
tree4d356f79c3cc20e33e1d28de9c8b1d697e9ce8a8
parentd635f8adaa40ca1e52c5da7b71d70284d6aef7dc (diff)
Fixed hex string generation bug in edif backend
-rw-r--r--backends/edif/edif.cc8
1 files changed, 4 insertions, 4 deletions
diff --git a/backends/edif/edif.cc b/backends/edif/edif.cc
index f898dc6d..fe6e7bad 100644
--- a/backends/edif/edif.cc
+++ b/backends/edif/edif.cc
@@ -250,10 +250,10 @@ struct EdifBackend : public Backend {
std::string hex_string = "";
for (size_t i = 0; i < p.second.bits.size(); i += 4) {
int digit_value = 0;
- if (i+0 < p.second.bits.size() && p.second.bits.at(i+0) == RTLIL::State::S1) digit_value += 1;
- if (i+1 < p.second.bits.size() && p.second.bits.at(i+1) == RTLIL::State::S1) digit_value += 2;
- if (i+2 < p.second.bits.size() && p.second.bits.at(i+2) == RTLIL::State::S1) digit_value += 3;
- if (i+3 < p.second.bits.size() && p.second.bits.at(i+3) == RTLIL::State::S1) digit_value += 4;
+ if (i+0 < p.second.bits.size() && p.second.bits.at(i+0) == RTLIL::State::S1) digit_value |= 1;
+ if (i+1 < p.second.bits.size() && p.second.bits.at(i+1) == RTLIL::State::S1) digit_value |= 2;
+ if (i+2 < p.second.bits.size() && p.second.bits.at(i+2) == RTLIL::State::S1) digit_value |= 4;
+ if (i+3 < p.second.bits.size() && p.second.bits.at(i+3) == RTLIL::State::S1) digit_value |= 8;
char digit_str[2] = { "0123456789abcdef"[digit_value], 0 };
hex_string = std::string(digit_str) + hex_string;
}