diff options
author | whitequark <whitequark@whitequark.org> | 2020-07-09 20:17:19 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-07-09 20:17:19 +0000 |
commit | c0bcbe1f6254f050207a91506a63aa9d784bd8d6 (patch) | |
tree | a788116d9cbdfe717123327895ea8a565a12ee39 /frontends/verilog/verilog_parser.y | |
parent | 0e9b889b77454ce8bcee47e73ed9b79f9b31771f (diff) | |
parent | dc35ef05f93bf634e7f158869af48707233505e2 (diff) | |
download | yosys-c0bcbe1f6254f050207a91506a63aa9d784bd8d6.tar.gz yosys-c0bcbe1f6254f050207a91506a63aa9d784bd8d6.tar.bz2 yosys-c0bcbe1f6254f050207a91506a63aa9d784bd8d6.zip |
Merge pull request #2255 from whitequark/bison-Werror-conflicts
verilog_parser: turn S/R and R/R conflicts into hard errors
Diffstat (limited to 'frontends/verilog/verilog_parser.y')
-rw-r--r-- | frontends/verilog/verilog_parser.y | 29 |
1 files changed, 10 insertions, 19 deletions
diff --git a/frontends/verilog/verilog_parser.y b/frontends/verilog/verilog_parser.y index dfdb11cf0..0fdf2b516 100644 --- a/frontends/verilog/verilog_parser.y +++ b/frontends/verilog/verilog_parser.y @@ -747,7 +747,7 @@ module_body: module_body_stmt: task_func_decl | specify_block | param_decl | localparam_decl | typedef_decl | defparam_decl | specparam_declaration | wire_decl | assign_stmt | cell_stmt | enum_decl | struct_decl | - always_stmt | TOK_GENERATE module_gen_body TOK_ENDGENERATE | defattr | assert_property | checker_decl | ignored_specify_block | /* empty statement */ ';'; + always_stmt | TOK_GENERATE module_gen_body TOK_ENDGENERATE | defattr | assert_property | checker_decl | ignored_specify_block; checker_decl: TOK_CHECKER TOK_ID ';' { @@ -1331,45 +1331,36 @@ ignspec_id: param_signed: TOK_SIGNED { astbuf1->is_signed = true; - } | TOK_UNSIGNED { - astbuf1->is_signed = false; } | /* empty */; param_integer: TOK_INTEGER { + if (astbuf1->children.size() != 1) + frontend_verilog_yyerror("Internal error in param_integer - should not happen?"); astbuf1->children.push_back(new AstNode(AST_RANGE)); astbuf1->children.back()->children.push_back(AstNode::mkconst_int(31, true)); astbuf1->children.back()->children.push_back(AstNode::mkconst_int(0, true)); astbuf1->is_signed = true; - } + } | /* empty */; param_real: TOK_REAL { + if (astbuf1->children.size() != 1) + frontend_verilog_yyerror("Parameter already declared as integer, cannot set to real."); astbuf1->children.push_back(new AstNode(AST_REALVALUE)); - } - -param_logic: - TOK_LOGIC { - // SV LRM 6.11, Table 6-8: logic -- 4-state, user-defined vector size, unsigned - astbuf1->is_signed = false; - astbuf1->is_logic = true; - } + } | /* empty */; param_range: range { if ($1 != NULL) { + if (astbuf1->children.size() != 1) + frontend_verilog_yyerror("integer/real parameters should not have a range."); astbuf1->children.push_back($1); } }; -param_integer_type: param_integer param_signed -param_range_type: type_vec param_signed param_range -param_implicit_type: param_signed param_range - -param_integer_vector_type: param_logic param_signed param_range - param_type: - param_integer_type | param_integer_vector_type | param_real | param_range_type | param_implicit_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)); |