diff options
author | Clifford Wolf <clifford@clifford.at> | 2015-08-11 11:32:37 +0200 |
---|---|---|
committer | Clifford Wolf <clifford@clifford.at> | 2015-08-11 11:32:37 +0200 |
commit | 45ee2ba3b853ca2dd74931c193f12eb46c0e766f (patch) | |
tree | d1a3682bd863084b2157685fd1dc558a420b2fc9 /frontends/verilog | |
parent | 21851257608a502e4ab7e54d65100c4f2aa6fa33 (diff) | |
download | yosys-45ee2ba3b853ca2dd74931c193f12eb46c0e766f.tar.gz yosys-45ee2ba3b853ca2dd74931c193f12eb46c0e766f.tar.bz2 yosys-45ee2ba3b853ca2dd74931c193f12eb46c0e766f.zip |
Fixed handling of [a-fxz?] in decimal constants
Diffstat (limited to 'frontends/verilog')
-rw-r--r-- | frontends/verilog/const2ast.cc | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/frontends/verilog/const2ast.cc b/frontends/verilog/const2ast.cc index 5dc149dfd..d54f1428e 100644 --- a/frontends/verilog/const2ast.cc +++ b/frontends/verilog/const2ast.cc @@ -48,7 +48,9 @@ static int my_decimal_div_by_two(std::vector<uint8_t> &digits) { int carry = 0; for (size_t i = 0; i < digits.size(); i++) { - log_assert(digits[i] < 10); + if (digits[i] >= 10) + log_error("Invalid use of [a-fxz?] in decimal constant at %s:%d.\n", + current_filename.c_str(), get_line_num()); digits[i] += carry * 10; carry = digits[i] % 2; digits[i] /= 2; @@ -91,6 +93,9 @@ static void my_strtobin(std::vector<RTLIL::State> &data, const char *str, int le str++; } + if (base == 10 && GetSize(digits) == 1 && digits.front() >= 0xf0) + base = 2; + if (base == 10) { data.clear(); if (len_in_bits < 0) { @@ -138,7 +143,7 @@ AstNode *VERILOG_FRONTEND::const2ast(std::string code, char case_type, bool warn AstNode *ret = const2ast(code, case_type); if (std::find(ret->bits.begin(), ret->bits.end(), RTLIL::State::Sz) != ret->bits.end()) log_warning("Yosys does not support tri-state logic at the moment. (%s:%d)\n", - current_filename.c_str(), frontend_verilog_yyget_lineno()); + current_filename.c_str(), get_line_num()); return ret; } |