Maintain "is_unsized" state of constants

This commit is contained in:
Eddie Hung 2019-06-20 12:43:39 -07:00
parent e33cbb0dde
commit 20119ee50e
1 changed files with 6 additions and 6 deletions

View File

@ -204,7 +204,7 @@ AstNode *VERILOG_FRONTEND::const2ast(std::string code, char case_type, bool warn
{ {
std::vector<RTLIL::State> data; std::vector<RTLIL::State> data;
bool is_signed = false; bool is_signed = false;
bool is_unsized = false; bool is_unsized = len_in_bits < 0;
if (*(endptr+1) == 's') { if (*(endptr+1) == 's') {
is_signed = true; is_signed = true;
endptr++; endptr++;
@ -213,25 +213,25 @@ AstNode *VERILOG_FRONTEND::const2ast(std::string code, char case_type, bool warn
{ {
case 'b': case 'b':
case 'B': case 'B':
my_strtobin(data, endptr+2, len_in_bits, 2, case_type, false); my_strtobin(data, endptr+2, len_in_bits, 2, case_type, is_unsized);
break; break;
case 'o': case 'o':
case 'O': case 'O':
my_strtobin(data, endptr+2, len_in_bits, 8, case_type, false); my_strtobin(data, endptr+2, len_in_bits, 8, case_type, is_unsized);
break; break;
case 'd': case 'd':
case 'D': case 'D':
my_strtobin(data, endptr+2, len_in_bits, 10, case_type, false); my_strtobin(data, endptr+2, len_in_bits, 10, case_type, is_unsized);
break; break;
case 'h': case 'h':
case 'H': case 'H':
my_strtobin(data, endptr+2, len_in_bits, 16, case_type, false); my_strtobin(data, endptr+2, len_in_bits, 16, case_type, is_unsized);
break; break;
default: default:
char next_char = char(tolower(*(endptr+1))); char next_char = char(tolower(*(endptr+1)));
if (next_char == '0' || next_char == '1' || next_char == 'x' || next_char == 'z') { if (next_char == '0' || next_char == '1' || next_char == 'x' || next_char == 'z') {
my_strtobin(data, endptr+1, 1, 2, case_type, true);
is_unsized = true; is_unsized = true;
my_strtobin(data, endptr+1, 1, 2, case_type, is_unsized);
} else { } else {
return NULL; return NULL;
} }