Skip to content

Commit de6e7e7

Browse files
committed
Verilog: make net_decl_assignment rule match SystemVerilog 1800-2017
This removes the net_name rule, and makes the assignment in the net_decl_assignment rule optional, to match SystemVerilog 1800-2017.
1 parent f17eeb7 commit de6e7e7

File tree

1 file changed

+11
-23
lines changed

1 file changed

+11
-23
lines changed

src/verilog/parser.y

Lines changed: 11 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1179,12 +1179,7 @@ genvar_declaration:
11791179
;
11801180

11811181
net_declaration:
1182-
net_type drive_strength_opt vectored_scalared_opt data_type_or_implicit delay3_opt list_of_net_names ';'
1183-
{ init($$, ID_decl);
1184-
addswap($$, ID_class, $1);
1185-
addswap($$, ID_type, $4);
1186-
swapop($$, $6); }
1187-
| net_type drive_strength_opt vectored_scalared_opt data_type_or_implicit delay3_opt list_of_net_decl_assignments ';'
1182+
net_type drive_strength_opt vectored_scalared_opt data_type_or_implicit delay3_opt list_of_net_decl_assignments ';'
11881183
{ init($$, ID_decl);
11891184
addswap($$, ID_class, $1);
11901185
addswap($$, ID_type, $4);
@@ -1214,21 +1209,6 @@ vectored_scalared_opt:
12141209
| TOK_SCALARED { init($$, "scalared"); }
12151210
;
12161211

1217-
list_of_net_names:
1218-
net_name
1219-
{ init($$); mto($$, $1); }
1220-
| list_of_net_names ',' net_name
1221-
{ $$=$1; mto($$, $3); }
1222-
;
1223-
1224-
net_name: net_identifier unpacked_dimension_brace
1225-
{
1226-
$$=$1;
1227-
stack_expr($$).id(ID_declarator);
1228-
addswap($$, ID_type, $2);
1229-
}
1230-
;
1231-
12321212
list_of_net_decl_assignments:
12331213
net_decl_assignment
12341214
{ init($$); mto($$, $1); }
@@ -1708,8 +1688,16 @@ range: part_select;
17081688
// System Verilog standard 1800-2017
17091689
// A.2.4 Declaration assignments
17101690

1711-
net_decl_assignment: net_identifier '=' expression
1712-
{ $$ = $1; stack_expr($$).id(ID_declarator); addswap($$, ID_value, $3); }
1691+
net_decl_assignment:
1692+
net_identifier unpacked_dimension_brace
1693+
{ $$ = $1;
1694+
stack_expr($$).id(ID_declarator);
1695+
addswap($$, ID_type, $2); }
1696+
| net_identifier unpacked_dimension_brace '=' expression
1697+
{ $$ = $1;
1698+
stack_expr($$).id(ID_declarator);
1699+
addswap($$, ID_type, $2);
1700+
addswap($$, ID_value, $4); }
17131701
;
17141702

17151703
variable_decl_assignment:

0 commit comments

Comments
 (0)