aboutsummaryrefslogtreecommitdiffstats
path: root/frontends/verilog
diff options
context:
space:
mode:
Diffstat (limited to 'frontends/verilog')
-rw-r--r--frontends/verilog/verilog_parser.y64
1 files changed, 22 insertions, 42 deletions
diff --git a/frontends/verilog/verilog_parser.y b/frontends/verilog/verilog_parser.y
index 0024d4778..77f6d2051 100644
--- a/frontends/verilog/verilog_parser.y
+++ b/frontends/verilog/verilog_parser.y
@@ -112,10 +112,6 @@ struct specify_rise_fall {
%define api.prefix {frontend_verilog_yy}
-%glr-parser
-%expect 21
-%expect-rr 2
-
/* The union is defined in the header, so we need to provide all the
* includes it requires
*/
@@ -158,8 +154,8 @@ struct specify_rise_fall {
%token TOK_INCREMENT TOK_DECREMENT TOK_UNIQUE TOK_PRIORITY
%type <ast> range range_or_multirange non_opt_range non_opt_multirange range_or_signed_int
-%type <ast> wire_type wire_type_io expr basic_expr concat_list rvalue lvalue lvalue_concat_list
-%type <string> opt_label opt_sva_label tok_prim_wrapper hierarchical_id
+%type <ast> wire_type expr basic_expr concat_list rvalue lvalue lvalue_concat_list
+%type <string> opt_label opt_sva_label tok_prim_wrapper hierarchical_id hierarchical_type_id
%type <boolean> opt_signed opt_property unique_case_attr
%type <al> attr case_attr
@@ -184,7 +180,7 @@ struct specify_rise_fall {
%right UNARY_OPS
%define parse.error verbose
-// %define parse.lac full
+%define parse.lac full
%nonassoc FAKE_THEN
%nonassoc TOK_ELSE
@@ -295,6 +291,9 @@ hierarchical_id:
$$ = $1;
};
+hierarchical_type_id:
+ '(' hierarchical_id ')' { $$ = $2; };
+
module:
attr TOK_MODULE TOK_ID {
do_not_require_port_stubs = false;
@@ -329,13 +328,13 @@ single_module_para:
astbuf1 = new AstNode(AST_PARAMETER);
astbuf1->children.push_back(AstNode::mkconst_int(0, true));
append_attr(astbuf1, $1);
- } int_param_type single_param_decl |
+ } param_type single_param_decl |
attr TOK_LOCALPARAM {
if (astbuf1) delete astbuf1;
astbuf1 = new AstNode(AST_LOCALPARAM);
astbuf1->children.push_back(AstNode::mkconst_int(0, true));
append_attr(astbuf1, $1);
- } int_param_type single_param_decl |
+ } param_type single_param_decl |
single_param_decl;
module_args_opt:
@@ -396,7 +395,7 @@ module_arg:
ast_stack.back()->children.push_back(astbuf2);
delete astbuf1; // really only needed if multiple instances of same type.
} module_arg_opt_assignment |
- attr wire_type_io range TOK_ID {
+ attr wire_type range TOK_ID {
AstNode *node = $2;
node->str = *$4;
node->port_id = ++port_counter;
@@ -480,18 +479,15 @@ wire_type:
$$ = astbuf3;
};
-wire_type_io:
- {
- astbuf3 = new AstNode(AST_WIRE);
- current_wire_rand = false;
- current_wire_const = false;
- } io_wire_type_token_list delay {
- $$ = astbuf3;
- };
-
wire_type_token_list:
- wire_type_token | wire_type_token_list wire_type_token |
- wire_type_token_io ;
+ wire_type_token |
+ wire_type_token_list wire_type_token |
+ wire_type_token_io |
+ hierarchical_type_id {
+ astbuf3->is_custom_type = true;
+ astbuf3->children.push_back(new AstNode(AST_WIRETYPE));
+ astbuf3->children.back()->str = *$1;
+ };
wire_type_token_io:
TOK_INPUT {
@@ -544,19 +540,8 @@ wire_type_token:
} |
TOK_CONST {
current_wire_const = true;
- } |
- hierarchical_id {
- astbuf3->is_custom_type = true;
- astbuf3->children.push_back(new AstNode(AST_WIRETYPE));
- astbuf3->children.back()->str = *$1;
};
-wire_type_token_list_without_io:
- wire_type_token | wire_type_token_list wire_type_token;
-
-io_wire_type_token_list:
- wire_type_token_io | wire_type_token_io wire_type_token_list_without_io;
-
non_opt_range:
'[' expr ':' expr ']' {
$$ = new AstNode(AST_RANGE);
@@ -617,7 +602,7 @@ module_body:
/* empty */;
module_body_stmt:
- task_func_decl | specify_block |param_decl | localparam_decl | typedef_decl | defparam_decl | specparam_declaration | wire_decl | assign_stmt | cell_stmt |
+ task_func_decl | specify_block | param_decl | localparam_decl | typedef_decl | defparam_decl | specparam_declaration | wire_decl | assign_stmt | cell_stmt |
always_stmt | TOK_GENERATE module_gen_body TOK_ENDGENERATE | defattr | assert_property | checker_decl | ignored_specify_block;
checker_decl:
@@ -1175,19 +1160,14 @@ param_range:
}
};
-custom_param_type:
- hierarchical_id {
+param_type:
+ param_signed param_integer param_real param_range |
+ hierarchical_type_id {
astbuf1->is_custom_type = true;
astbuf1->children.push_back(new AstNode(AST_WIRETYPE));
astbuf1->children.back()->str = *$1;
};
-param_type:
- param_signed param_integer param_real param_range | custom_param_type;
-
-int_param_type:
- param_signed param_integer param_range | custom_param_type;
-
param_decl:
attr TOK_PARAMETER {
astbuf1 = new AstNode(AST_PARAMETER);
@@ -1202,7 +1182,7 @@ localparam_decl:
astbuf1 = new AstNode(AST_LOCALPARAM);
astbuf1->children.push_back(AstNode::mkconst_int(0, true));
append_attr(astbuf1, $1);
- } param_type param_decl_list ';' {
+ } param_type param_decl_list ';' {
delete astbuf1;
};