Skip to content

Commit 9b1aad8

Browse files
committed
Verilog: add net identifiers to the scope
The parser now adds net identifiers to the current scope.
1 parent dc46d28 commit 9b1aad8

3 files changed

Lines changed: 8 additions & 2 deletions

File tree

src/verilog/parser.y

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2172,11 +2172,15 @@ range: part_select;
21722172

21732173
net_decl_assignment:
21742174
net_identifier unpacked_dimension_brace
2175-
{ $$ = $1;
2175+
{ // add to the scope
2176+
PARSER.scopes.add_identifier(stack_expr($1).get(ID_base_name), verilog_scopet::NET);
2177+
$$ = $1;
21762178
stack_expr($$).id(ID_declarator);
21772179
addswap($$, ID_type, $2); }
21782180
| net_identifier unpacked_dimension_brace '=' expression
2179-
{ $$ = $1;
2181+
{ // add to the scope
2182+
PARSER.scopes.add_identifier(stack_expr($1).get(ID_base_name), verilog_scopet::NET);
2183+
$$ = $1;
21802184
stack_expr($$).id(ID_declarator);
21812185
addswap($$, ID_type, $2);
21822186
addswap($$, ID_value, $4); }

src/verilog/verilog_scope.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ unsigned verilog_scopet::identifier_token() const
9393
case verilog_scopet::PARAMETER: return TOK_NON_TYPE_IDENTIFIER;
9494
case verilog_scopet::PROPERTY: return TOK_NON_TYPE_IDENTIFIER;
9595
case verilog_scopet::SEQUENCE: return TOK_NON_TYPE_IDENTIFIER;
96+
case verilog_scopet::NET: return TOK_NON_TYPE_IDENTIFIER;
9697
case verilog_scopet::VAR: return TOK_NON_TYPE_IDENTIFIER;
9798
case verilog_scopet::OTHER: return TOK_NON_TYPE_IDENTIFIER;
9899
// clang-format on

src/verilog/verilog_scope.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ struct verilog_scopet
3232
PARAMETER,
3333
PROPERTY,
3434
SEQUENCE,
35+
NET,
3536
VAR,
3637
OTHER
3738
};

0 commit comments

Comments
 (0)