diff options
author | Clifford Wolf <clifford@clifford.at> | 2015-02-13 22:48:10 +0100 |
---|---|---|
committer | Clifford Wolf <clifford@clifford.at> | 2015-02-13 22:48:10 +0100 |
commit | 756b4064b29cf07bf0870f06dd538b34763f3cdd (patch) | |
tree | d647c8d5d438d12f0cb829f04e9bae82fa177236 /backends/verilog | |
parent | a0a0594d1e9d0699a6875a9899752de9dd5d261d (diff) | |
download | yosys-756b4064b29cf07bf0870f06dd538b34763f3cdd.tar.gz yosys-756b4064b29cf07bf0870f06dd538b34763f3cdd.tar.bz2 yosys-756b4064b29cf07bf0870f06dd538b34763f3cdd.zip |
Fixed "write_verilog -attr2comment" handling of "*/" in strings
Diffstat (limited to 'backends/verilog')
-rw-r--r-- | backends/verilog/verilog_backend.cc | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/backends/verilog/verilog_backend.cc b/backends/verilog/verilog_backend.cc index ab0844d72..845be883a 100644 --- a/backends/verilog/verilog_backend.cc +++ b/backends/verilog/verilog_backend.cc @@ -151,7 +151,7 @@ bool is_reg_wire(RTLIL::SigSpec sig, std::string ®_name) return true; } -void dump_const(std::ostream &f, const RTLIL::Const &data, int width = -1, int offset = 0, bool no_decimal = false, bool set_signed = false) +void dump_const(std::ostream &f, const RTLIL::Const &data, int width = -1, int offset = 0, bool no_decimal = false, bool set_signed = false, bool escape_comment = false) { if (width < 0) width = data.bits.size() - offset; @@ -199,6 +199,8 @@ void dump_const(std::ostream &f, const RTLIL::Const &data, int width = -1, int o f << stringf("\\\""); else if (str[i] == '\\') f << stringf("\\\\"); + else if (str[i] == '/' && escape_comment && i > 0 && str[i-1] == '*') + f << stringf("\\/"); else f << str[i]; } @@ -258,7 +260,7 @@ void dump_attributes(std::ostream &f, std::string indent, dict<RTLIL::IdString, else if (modattr && (it->second == Const(1, 1) || it->second == Const(1))) f << stringf(" 1 "); else - dump_const(f, it->second); + dump_const(f, it->second, -1, 0, false, false, attr2comment); f << stringf(" %s%c", attr2comment ? "*/" : "*)", term); } } |