Skip to content

Commit dc46b78

Browse files
authored
Merge pull request #1272 from diffblue/nettype1-fix
SystemVerilog: net type declarations
2 parents 35a4586 + eb36485 commit dc46b78

File tree

2 files changed

+19
-2
lines changed

2 files changed

+19
-2
lines changed
Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
1-
KNOWNBUG
1+
CORE
22
nettype1.sv
33

44
^EXIT=0$
55
^SIGNAL=0$
66
--
77
^warning: ignoring
88
--
9-
nettype is not implemented.

src/verilog/parser.y

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1395,6 +1395,7 @@ data_declaration:
13951395
swapop($$, $4); }
13961396
| type_declaration
13971397
| package_import_declaration
1398+
| net_type_declaration
13981399
;
13991400

14001401
const_opt:
@@ -1464,6 +1465,21 @@ type_declaration:
14641465
}
14651466
;
14661467

1468+
net_type_declaration:
1469+
TOK_NETTYPE
1470+
{ init($$, ID_decl);
1471+
stack_expr($$).set(ID_class, ID_typedef);
1472+
}
1473+
data_type any_identifier ';'
1474+
{ $$ = $2;
1475+
// add to the scope as a type name
1476+
PARSER.scopes.add_name(stack_expr($4).get(ID_base_name), "", verilog_scopet::TYPEDEF);
1477+
addswap($$, ID_type, $3);
1478+
stack_expr($4).id(ID_declarator);
1479+
mto($$, $4);
1480+
}
1481+
;
1482+
14671483
vectored_scalared_opt:
14681484
/* Optional */
14691485
{ make_nil($$); }
@@ -4624,6 +4640,8 @@ hierarchical_identifier:
46244640

46254641
hierarchical_variable_identifier: hierarchical_identifier;
46264642

4643+
net_type_identifier: TOK_TYPE_IDENTIFIER;
4644+
46274645
identifier: non_type_identifier;
46284646

46294647
property_identifier: TOK_NON_TYPE_IDENTIFIER;

0 commit comments

Comments
 (0)