Skip to content

Commit

Permalink
Fix improper CST construction of TypeIdDimensions tuple.
Browse files Browse the repository at this point in the history
Grammar was correct, but node construction failed consistency check.

was crashing with:
  Check failed: E(node.Tag().tag) == expected_node_enum (kDeclarationDimensions vs. kUnpackedDimensions)

PiperOrigin-RevId: 303816208
  • Loading branch information
fangism authored and hzeller committed Mar 30, 2020
1 parent 92b063c commit 862813b
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
2 changes: 1 addition & 1 deletion verilog/parser/verilog.y
Original file line number Diff line number Diff line change
Expand Up @@ -3238,7 +3238,7 @@ tf_port_item
{ $$ = MakeTaskFunctionPortItem($1,
MakeTypeIdDimensionsTuple(
MakeTaggedNode(N::kDataType, $2, nullptr),
$3, $4),
$3, MakeUnpackedDimensionsNode($4)),
$5); }
;
tf_port_item_expr_opt
Expand Down
20 changes: 20 additions & 0 deletions verilog/parser/verilog_parser_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -869,6 +869,26 @@ static const char* kTaskTests[] = {
"const ref StringType intake;\n" // const ref
"ref StringType [7:0] outtake [3:0];\n" // ref
"endtask",
"task t(virtual foo_if vif);\n"
"endtask\n",
"task t(virtual foo_if#(12) vif);\n"
"endtask\n",
"task t(virtual foo_if#(.W(12)) vif);\n"
"endtask\n",
"task t(virtual interface foo_if vif);\n"
"endtask\n",
"task t(ref virtual foo_if vif);\n"
"endtask\n",
"task t(ref virtual foo_if vifs[]);\n"
"endtask\n",
"task t(ref virtual foo_if vifs[N]);\n"
"endtask\n",
"task t(ref virtual foo_if vifs[N:M]);\n"
"endtask\n",
"task t(ref virtual foo_if vifs[N:M][X:Y]);\n"
"endtask\n",
"task t(ref virtual interface foo_if#(P,Q,R) vifs[N:M][X:Y]);\n"
"endtask\n",
// macro
"task stringer;\n"
" `uvm_error(`gtn, \"frownie =(\")\n" // string with balance character
Expand Down

0 comments on commit 862813b

Please sign in to comment.