From: Clifford Wolf Date: Sun, 27 Oct 2013 07:21:05 +0000 (+0100) Subject: Fixed hex string generation bug in edif backend X-Git-Tag: yosys-0.2.0~442 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=d9fa1e5a1d01e5a69dca6f8f0d760b047f29a772;p=yosys.git Fixed hex string generation bug in edif backend --- diff --git a/backends/edif/edif.cc b/backends/edif/edif.cc index f898dc6d7..fe6e7bade 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; }