diff --git a/parse.y b/parse.y index a6bc54cf2..7bc27cee2 100644 --- a/parse.y +++ b/parse.y @@ -3463,6 +3463,19 @@ dimensions tmp->push_back(index); $$ = tmp; } + | '[' expression ']' + { if (generation_flag < GN_VER2005_SV) { + warn_count += 1; + cerr << @2 << ": warning: Use of SystemVerilog [size] dimension. " + << "Use at least -g2005-sv to remove this warning." << endl; + } + list *tmp = new list; + index_component_t index; + index.msb = new PENumber(new verinum((uint64_t)0, integer_width)); + index.lsb = new PEBinary('-', $2, new PENumber(new verinum((uint64_t)1, integer_width))); + tmp->push_back(index); + $$ = tmp; + } | dimensions '[' expression ':' expression ']' { list *tmp = $1; index_component_t index; @@ -3471,6 +3484,19 @@ dimensions tmp->push_back(index); $$ = tmp; } + | dimensions '[' expression ']' + { if (generation_flag < GN_VER2005_SV) { + warn_count += 1; + cerr << @2 << ": warning: Use of SystemVerilog [size] dimension. " + << "Use at least -g2005-sv to remove this warning." << endl; + } + list *tmp = $1; + index_component_t index; + index.msb = new PENumber(new verinum((uint64_t)0, integer_width)); + index.lsb = new PEBinary('-', $3, new PENumber(new verinum((uint64_t)1, integer_width))); + tmp->push_back(index); + $$ = tmp; + } /* This is used to express the return type of a function. */ function_range_or_type_opt