diff options
author | Clifford Wolf <clifford@clifford.at> | 2013-12-04 14:14:05 +0100 |
---|---|---|
committer | Clifford Wolf <clifford@clifford.at> | 2013-12-04 14:14:05 +0100 |
commit | 93a70959f3f67ffcee8159b18a5f68904e32a074 (patch) | |
tree | 1bf68c1a36c3d126fdb396b0ea9c06bcdc2040fb /backends/ilang | |
parent | a2d053694b6269bab8871a810142943fac6a3a18 (diff) | |
download | yosys-93a70959f3f67ffcee8159b18a5f68904e32a074.tar.gz yosys-93a70959f3f67ffcee8159b18a5f68904e32a074.tar.bz2 yosys-93a70959f3f67ffcee8159b18a5f68904e32a074.zip |
Replaced RTLIL::Const::str with generic decoder method
Diffstat (limited to 'backends/ilang')
-rw-r--r-- | backends/ilang/ilang_backend.cc | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/backends/ilang/ilang_backend.cc b/backends/ilang/ilang_backend.cc index 46f411cee..a37c7330d 100644 --- a/backends/ilang/ilang_backend.cc +++ b/backends/ilang/ilang_backend.cc @@ -36,7 +36,7 @@ void ILANG_BACKEND::dump_const(FILE *f, const RTLIL::Const &data, int width, int { if (width < 0) width = data.bits.size() - offset; - if (data.str.empty() || width != (int)data.bits.size()) { + if ((data.flags & RTLIL::CONST_FLAG_STRING) == 0 || width != (int)data.bits.size()) { if (width == 32 && autoint) { int32_t val = 0; for (int i = 0; i < width; i++) { @@ -66,17 +66,20 @@ void ILANG_BACKEND::dump_const(FILE *f, const RTLIL::Const &data, int width, int } } else { fprintf(f, "\""); - for (size_t i = 0; i < data.str.size(); i++) { - if (data.str[i] == '\n') + std::string str = data.decode_string(); + for (size_t i = 0; i < str.size(); i++) { + if (str[i] == '\n') fprintf(f, "\\n"); - else if (data.str[i] == '\t') + else if (str[i] == '\t') fprintf(f, "\\t"); - else if (data.str[i] < 32) - fprintf(f, "\\%03o", data.str[i]); - else if (data.str[i] == '"') + else if (str[i] < 32) + fprintf(f, "\\%03o", str[i]); + else if (str[i] == '"') fprintf(f, "\\\""); + else if (str[i] == '\\') + fprintf(f, "\\\\"); else - fputc(data.str[i], f); + fputc(str[i], f); } fprintf(f, "\""); } |