From 01378fbdb0b56aaafb5495d202b108456460addd Mon Sep 17 00:00:00 2001 From: Martin Whitaker Date: Wed, 21 Dec 2022 14:11:47 +0000 Subject: [PATCH 1/8] Clean up indentation in compiler parse.y. Convert the remaining old-style indentation to the new style. --- parse.y | 2683 ++++++++++++++++++++++++++++--------------------------- 1 file changed, 1358 insertions(+), 1325 deletions(-) diff --git a/parse.y b/parse.y index 19b1577d8..d84f204d7 100644 --- a/parse.y +++ b/parse.y @@ -1163,9 +1163,9 @@ data_declaration /* IEEE1800-2005: A.2.1.3 */ package_scope : PACKAGE_IDENTIFIER K_SCOPE_RES - { lex_in_package_scope($1); - $$ = $1; - } + { lex_in_package_scope($1); + $$ = $1; + } ; ps_type_identifier /* IEEE1800-2017: A.9.3 */ @@ -1190,7 +1190,7 @@ packed_array_data_type /* IEEE1800-2005: A.2.2.1 */ | struct_data_type { if (!$1->packed_flag) { yyerror(@1, "sorry: Unpacked structs not supported."); - } + } $$ = $1; } | ps_type_identifier @@ -1958,20 +1958,20 @@ non_integer_type /* IEEE1800-2005: A.2.2.1 */ | K_shortreal { $$ = real_type_t::SHORTREAL; } ; -number : BASED_NUMBER - { $$ = $1; based_size = 0;} - | DEC_NUMBER - { $$ = $1; based_size = 0;} - | DEC_NUMBER BASED_NUMBER - { $$ = pform_verinum_with_size($1,$2, @2.text, @2.first_line); - based_size = 0; } - | UNBASED_NUMBER - { $$ = $1; based_size = 0;} - | DEC_NUMBER UNBASED_NUMBER - { yyerror(@1, "error: Unbased SystemVerilog literal cannot have " - "a size."); - $$ = $1; based_size = 0;} - ; +number + : BASED_NUMBER + { $$ = $1; based_size = 0;} + | DEC_NUMBER + { $$ = $1; based_size = 0;} + | DEC_NUMBER BASED_NUMBER + { $$ = pform_verinum_with_size($1,$2, @2.text, @2.first_line); + based_size = 0; } + | UNBASED_NUMBER + { $$ = $1; based_size = 0;} + | DEC_NUMBER UNBASED_NUMBER + { yyerror(@1, "error: Unbased SystemVerilog literal cannot have a size."); + $$ = $1; based_size = 0;} + ; open_range_list /* IEEE1800-2005 A.2.11 */ : open_range_list ',' value_range @@ -2582,14 +2582,14 @@ attribute_list attribute - : IDENTIFIER initializer_opt - { named_pexpr_t*tmp = new named_pexpr_t; - tmp->name = lex_strings.make($1); - tmp->parm = $2; - delete[]$1; - $$ = tmp; - } - ; + : IDENTIFIER initializer_opt + { named_pexpr_t*tmp = new named_pexpr_t; + tmp->name = lex_strings.make($1); + tmp->parm = $2; + delete[]$1; + $$ = tmp; + } + ; /* The block_item_decl is used in function definitions, task @@ -2665,14 +2665,14 @@ block_item_decl ; block_item_decls - : block_item_decl - | block_item_decls block_item_decl - ; + : block_item_decl + | block_item_decls block_item_decl + ; block_item_decls_opt - : block_item_decls { $$ = true; } - | { $$ = false; } - ; + : block_item_decls { $$ = true; } + | { $$ = false; } + ; /* We need to handle K_enum separately because * `typedef enum ` can either be the start of a enum forward @@ -2735,7 +2735,7 @@ enum_base_type /* IEEE 1800-2012 A.2.2.1 */ $$ = $1; } } - | + | { $$ = new atom_type_t(atom_type_t::INT, true); FILE_NAME($$, @0); } @@ -2883,56 +2883,56 @@ struct_union_member /* IEEE 1800-2012 A.2.2.1 */ ; case_item - : expression_list_proper ':' statement_or_null - { PCase::Item*tmp = new PCase::Item; - tmp->expr = *$1; - tmp->stat = $3; - delete $1; - $$ = tmp; - } - | K_default ':' statement_or_null - { PCase::Item*tmp = new PCase::Item; - tmp->stat = $3; - $$ = tmp; - } - | K_default statement_or_null - { PCase::Item*tmp = new PCase::Item; - tmp->stat = $2; - $$ = tmp; - } - | error ':' statement_or_null - { yyerror(@2, "error: Incomprehensible case expression."); - yyerrok; - } - ; + : expression_list_proper ':' statement_or_null + { PCase::Item*tmp = new PCase::Item; + tmp->expr = *$1; + tmp->stat = $3; + delete $1; + $$ = tmp; + } + | K_default ':' statement_or_null + { PCase::Item*tmp = new PCase::Item; + tmp->stat = $3; + $$ = tmp; + } + | K_default statement_or_null + { PCase::Item*tmp = new PCase::Item; + tmp->stat = $2; + $$ = tmp; + } + | error ':' statement_or_null + { yyerror(@2, "error: Incomprehensible case expression."); + yyerrok; + } + ; case_items - : case_items case_item - { $1->push_back($2); - $$ = $1; - } - | case_item - { $$ = new std::vector(1, $1); - } - ; + : case_items case_item + { $1->push_back($2); + $$ = $1; + } + | case_item + { $$ = new std::vector(1, $1); + } + ; charge_strength - : '(' K_small ')' - | '(' K_medium ')' - | '(' K_large ')' - ; + : '(' K_small ')' + | '(' K_medium ')' + | '(' K_large ')' + ; charge_strength_opt - : charge_strength - | - ; + : charge_strength + | + ; defparam_assign - : hierarchy_identifier '=' expression - { pform_set_defparam(*$1, $3); - delete $1; - } - ; + : hierarchy_identifier '=' expression + { pform_set_defparam(*$1, $3); + delete $1; + } + ; defparam_assign_list : defparam_assign @@ -2941,51 +2941,51 @@ defparam_assign_list delete $1; } | defparam_assign_list ',' defparam_assign - ; + ; delay1 - : '#' delay_value_simple - { std::list*tmp = new std::list; - tmp->push_back($2); - $$ = tmp; - } - | '#' '(' delay_value ')' - { std::list*tmp = new std::list; - tmp->push_back($3); - $$ = tmp; - } - ; + : '#' delay_value_simple + { std::list*tmp = new std::list; + tmp->push_back($2); + $$ = tmp; + } + | '#' '(' delay_value ')' + { std::list*tmp = new std::list; + tmp->push_back($3); + $$ = tmp; + } + ; delay3 - : '#' delay_value_simple - { std::list*tmp = new std::list; - tmp->push_back($2); - $$ = tmp; - } - | '#' '(' delay_value ')' - { std::list*tmp = new std::list; - tmp->push_back($3); - $$ = tmp; - } - | '#' '(' delay_value ',' delay_value ')' - { std::list*tmp = new std::list; - tmp->push_back($3); - tmp->push_back($5); - $$ = tmp; - } - | '#' '(' delay_value ',' delay_value ',' delay_value ')' - { std::list*tmp = new std::list; - tmp->push_back($3); - tmp->push_back($5); - tmp->push_back($7); - $$ = tmp; - } - ; + : '#' delay_value_simple + { std::list*tmp = new std::list; + tmp->push_back($2); + $$ = tmp; + } + | '#' '(' delay_value ')' + { std::list*tmp = new std::list; + tmp->push_back($3); + $$ = tmp; + } + | '#' '(' delay_value ',' delay_value ')' + { std::list*tmp = new std::list; + tmp->push_back($3); + tmp->push_back($5); + $$ = tmp; + } + | '#' '(' delay_value ',' delay_value ',' delay_value ')' + { std::list*tmp = new std::list; + tmp->push_back($3); + tmp->push_back($5); + tmp->push_back($7); + $$ = tmp; + } + ; delay3_opt - : delay3 { $$ = $1; } - | { $$ = 0; } - ; + : delay3 { $$ = $1; } + | { $$ = 0; } + ; delay_value_list : delay_value @@ -3001,61 +3001,60 @@ delay_value_list ; delay_value - : expression - { PExpr*tmp = $1; - $$ = tmp; - } - | expression ':' expression ':' expression - { $$ = pform_select_mtm_expr($1, $3, $5); } - ; + : expression + { PExpr*tmp = $1; + $$ = tmp; + } + | expression ':' expression ':' expression + { $$ = pform_select_mtm_expr($1, $3, $5); } + ; delay_value_simple - : DEC_NUMBER - { verinum*tmp = $1; - if (tmp == 0) { - yyerror(@1, "internal error: decimal delay."); - $$ = 0; - } else { - $$ = new PENumber(tmp); - FILE_NAME($$, @1); - } - based_size = 0; - } - | REALTIME - { verireal*tmp = $1; - if (tmp == 0) { - yyerror(@1, "internal error: real time delay."); - $$ = 0; - } else { - $$ = new PEFNumber(tmp); - FILE_NAME($$, @1); - } - } - | IDENTIFIER - { PEIdent*tmp = new PEIdent(lex_strings.make($1)); - FILE_NAME(tmp, @1); - $$ = tmp; - delete[]$1; - } - | TIME_LITERAL - { int unit; + : DEC_NUMBER + { verinum*tmp = $1; + if (tmp == 0) { + yyerror(@1, "internal error: decimal delay."); + $$ = 0; + } else { + $$ = new PENumber(tmp); + FILE_NAME($$, @1); + } + based_size = 0; + } + | REALTIME + { verireal*tmp = $1; + if (tmp == 0) { + yyerror(@1, "internal error: real time delay."); + $$ = 0; + } else { + $$ = new PEFNumber(tmp); + FILE_NAME($$, @1); + } + } + | IDENTIFIER + { PEIdent*tmp = new PEIdent(lex_strings.make($1)); + FILE_NAME(tmp, @1); + $$ = tmp; + delete[]$1; + } + | TIME_LITERAL + { int unit; - based_size = 0; - $$ = 0; - if ($1 == 0 || !get_time_unit($1, unit)) - yyerror(@1, "internal error: time literal delay."); - else { - double p = pow(10.0, - (double)(unit - pform_get_timeunit())); - double time = atof($1) * p; + based_size = 0; + $$ = 0; + if ($1 == 0 || !get_time_unit($1, unit)) + yyerror(@1, "internal error: time literal delay."); + else { + double p = pow(10.0, (double)(unit - pform_get_timeunit())); + double time = atof($1) * p; - verireal *v = new verireal(time); - $$ = new PEFNumber(v); - FILE_NAME($$, @1); - } - } - ; + verireal *v = new verireal(time); + $$ = new PEFNumber(v); + FILE_NAME($$, @1); + } + } + ; /* The discipline and nature declarations used to take no ';' after the identifier. The 2.3 LRM adds the ';', but since there are @@ -3162,50 +3161,52 @@ list_of_libraries ; drive_strength - : '(' dr_strength0 ',' dr_strength1 ')' - { $$.str0 = $2.str0; - $$.str1 = $4.str1; - } - | '(' dr_strength1 ',' dr_strength0 ')' - { $$.str0 = $4.str0; - $$.str1 = $2.str1; - } - | '(' dr_strength0 ',' K_highz1 ')' - { $$.str0 = $2.str0; - $$.str1 = IVL_DR_HiZ; - } - | '(' dr_strength1 ',' K_highz0 ')' - { $$.str0 = IVL_DR_HiZ; - $$.str1 = $2.str1; - } - | '(' K_highz1 ',' dr_strength0 ')' - { $$.str0 = $4.str0; - $$.str1 = IVL_DR_HiZ; - } - | '(' K_highz0 ',' dr_strength1 ')' - { $$.str0 = IVL_DR_HiZ; - $$.str1 = $4.str1; - } - ; + : '(' dr_strength0 ',' dr_strength1 ')' + { $$.str0 = $2.str0; + $$.str1 = $4.str1; + } + | '(' dr_strength1 ',' dr_strength0 ')' + { $$.str0 = $4.str0; + $$.str1 = $2.str1; + } + | '(' dr_strength0 ',' K_highz1 ')' + { $$.str0 = $2.str0; + $$.str1 = IVL_DR_HiZ; + } + | '(' dr_strength1 ',' K_highz0 ')' + { $$.str0 = IVL_DR_HiZ; + $$.str1 = $2.str1; + } + | '(' K_highz1 ',' dr_strength0 ')' + { $$.str0 = $4.str0; + $$.str1 = IVL_DR_HiZ; + } + | '(' K_highz0 ',' dr_strength1 ')' + { $$.str0 = IVL_DR_HiZ; + $$.str1 = $4.str1; + } + ; drive_strength_opt - : drive_strength { $$ = $1; } - | { $$.str0 = IVL_DR_STRONG; $$.str1 = IVL_DR_STRONG; } - ; + : drive_strength + { $$ = $1; } + | + { $$.str0 = IVL_DR_STRONG; $$.str1 = IVL_DR_STRONG; } + ; dr_strength0 - : K_supply0 { $$.str0 = IVL_DR_SUPPLY; } - | K_strong0 { $$.str0 = IVL_DR_STRONG; } - | K_pull0 { $$.str0 = IVL_DR_PULL; } - | K_weak0 { $$.str0 = IVL_DR_WEAK; } - ; + : K_supply0 { $$.str0 = IVL_DR_SUPPLY; } + | K_strong0 { $$.str0 = IVL_DR_STRONG; } + | K_pull0 { $$.str0 = IVL_DR_PULL; } + | K_weak0 { $$.str0 = IVL_DR_WEAK; } + ; dr_strength1 - : K_supply1 { $$.str1 = IVL_DR_SUPPLY; } - | K_strong1 { $$.str1 = IVL_DR_STRONG; } - | K_pull1 { $$.str1 = IVL_DR_PULL; } - | K_weak1 { $$.str1 = IVL_DR_WEAK; } - ; + : K_supply1 { $$.str1 = IVL_DR_SUPPLY; } + | K_strong1 { $$.str1 = IVL_DR_STRONG; } + | K_pull1 { $$.str1 = IVL_DR_PULL; } + | K_weak1 { $$.str1 = IVL_DR_WEAK; } + ; clocking_event_opt /* */ : event_control @@ -3213,64 +3214,64 @@ clocking_event_opt /* */ ; event_control /* A.K.A. clocking_event */ - : '@' hierarchy_identifier - { PEIdent*tmpi = pform_new_ident(@2, *$2); - FILE_NAME(tmpi, @2); - PEEvent*tmpe = new PEEvent(PEEvent::ANYEDGE, tmpi); - PEventStatement*tmps = new PEventStatement(tmpe); - FILE_NAME(tmps, @1); - $$ = tmps; - delete $2; - } - | '@' '(' event_expression_list ')' - { PEventStatement*tmp = new PEventStatement(*$3); - FILE_NAME(tmp, @1); - delete $3; - $$ = tmp; - } - | '@' '(' error ')' - { yyerror(@1, "error: Malformed event control expression."); - $$ = 0; - } - ; + : '@' hierarchy_identifier + { PEIdent*tmpi = pform_new_ident(@2, *$2); + FILE_NAME(tmpi, @2); + PEEvent*tmpe = new PEEvent(PEEvent::ANYEDGE, tmpi); + PEventStatement*tmps = new PEventStatement(tmpe); + FILE_NAME(tmps, @1); + $$ = tmps; + delete $2; + } + | '@' '(' event_expression_list ')' + { PEventStatement*tmp = new PEventStatement(*$3); + FILE_NAME(tmp, @1); + delete $3; + $$ = tmp; + } + | '@' '(' error ')' + { yyerror(@1, "error: Malformed event control expression."); + $$ = 0; + } + ; event_expression_list - : event_expression - { $$ = new std::vector(1, $1); - } - | event_expression_list K_or event_expression - { $1->push_back($3); - $$ = $1; - } - | event_expression_list ',' event_expression - { $1->push_back($3); - $$ = $1; - } - ; + : event_expression + { $$ = new std::vector(1, $1); + } + | event_expression_list K_or event_expression + { $1->push_back($3); + $$ = $1; + } + | event_expression_list ',' event_expression + { $1->push_back($3); + $$ = $1; + } + ; event_expression - : K_posedge expression - { PEEvent*tmp = new PEEvent(PEEvent::POSEDGE, $2); - FILE_NAME(tmp, @1); - $$ = tmp; - } - | K_negedge expression - { PEEvent*tmp = new PEEvent(PEEvent::NEGEDGE, $2); - FILE_NAME(tmp, @1); - $$ = tmp; - } - | K_edge expression - { PEEvent*tmp = new PEEvent(PEEvent::EDGE, $2); - FILE_NAME(tmp, @1); - $$ = tmp; - pform_requires_sv(@1, "Edge event"); - } - | expression - { PEEvent*tmp = new PEEvent(PEEvent::ANYEDGE, $1); - FILE_NAME(tmp, @1); - $$ = tmp; - } - ; + : K_posedge expression + { PEEvent*tmp = new PEEvent(PEEvent::POSEDGE, $2); + FILE_NAME(tmp, @1); + $$ = tmp; + } + | K_negedge expression + { PEEvent*tmp = new PEEvent(PEEvent::NEGEDGE, $2); + FILE_NAME(tmp, @1); + $$ = tmp; + } + | K_edge expression + { PEEvent*tmp = new PEEvent(PEEvent::EDGE, $2); + FILE_NAME(tmp, @1); + $$ = tmp; + pform_requires_sv(@1, "Edge event"); + } + | expression + { PEEvent*tmp = new PEEvent(PEEvent::ANYEDGE, $1); + FILE_NAME(tmp, @1); + $$ = tmp; + } + ; /* A branch probe expression applies a probe function (potential or flow) to a branch. The branch may be implicit as a pair of nets @@ -3516,44 +3517,44 @@ expression ; expr_mintypmax - : expression - { $$ = $1; } - | expression ':' expression ':' expression - { switch (min_typ_max_flag) { - case MIN: - $$ = $1; - delete $3; - delete $5; - break; - case TYP: - delete $1; - $$ = $3; - delete $5; - break; - case MAX: - delete $1; - delete $3; - $$ = $5; - break; - } - if (min_typ_max_warn > 0) { - cerr << $$->get_fileline() << ": warning: choosing "; - switch (min_typ_max_flag) { - case MIN: - cerr << "min"; - break; - case TYP: - cerr << "typ"; - break; - case MAX: - cerr << "max"; - break; - } - cerr << " expression." << endl; - min_typ_max_warn -= 1; - } - } - ; + : expression + { $$ = $1; } + | expression ':' expression ':' expression + { switch (min_typ_max_flag) { + case MIN: + $$ = $1; + delete $3; + delete $5; + break; + case TYP: + delete $1; + $$ = $3; + delete $5; + break; + case MAX: + delete $1; + delete $3; + $$ = $5; + break; + } + if (min_typ_max_warn > 0) { + cerr << $$->get_fileline() << ": warning: choosing "; + switch (min_typ_max_flag) { + case MIN: + cerr << "min"; + break; + case TYP: + cerr << "typ"; + break; + case MAX: + cerr << "max"; + break; + } + cerr << " expression." << endl; + min_typ_max_warn -= 1; + } + } + ; /* Many contexts take a comma separated list of expressions. Null @@ -3586,14 +3587,16 @@ expression_list_with_nuls tmp->push_back(0); $$ = tmp; } - ; + ; /* A task or function can be invoked with the task/function name followed by * an argument list in parenthesis or with just the task/function name by * itself. When an argument list is used it might be empty. */ argument_list_parens_opt - : '(' expression_list_with_nuls ')' { $$ = $2; } - | { $$ = new std::list; } + : '(' expression_list_with_nuls ')' + { $$ = $2; } + | + { $$ = new std::list; } expression_list_proper : expression_list_proper ',' expression @@ -3641,11 +3644,11 @@ expr_primary | TIME_LITERAL { int unit; - based_size = 0; - $$ = 0; - if ($1 == 0 || !get_time_unit($1, unit)) + based_size = 0; + $$ = 0; + if ($1 == 0 || !get_time_unit($1, unit)) yyerror(@1, "internal error: time literal."); - else { + else { double p = pow(10.0, (double)(unit - pform_get_timeunit())); double time = atof($1) * p; // The time value needs to be rounded at the correct digit @@ -3660,7 +3663,7 @@ expr_primary verireal *v = new verireal(time); $$ = new PEFNumber(v); FILE_NAME($$, @1); - } + } } | SYSTEM_IDENTIFIER { perm_string tn = lex_strings.make($1); @@ -4041,7 +4044,7 @@ expr_primary | K_null { PENull*tmp = new PENull; - FILE_NAME(tmp, @1); + FILE_NAME(tmp, @1); $$ = tmp; } ; @@ -4050,8 +4053,10 @@ expr_primary declarations of ports. We check later to make sure there are no output or inout ports actually used for functions. */ tf_item_list_opt /* IEEE1800-2017: A.2.7 */ - : tf_item_list { $$ = $1; } - | { $$ = 0; } + : tf_item_list + { $$ = $1; } + | + { $$ = 0; } ; tf_item_list /* IEEE1800-2017: A.2.7 */ @@ -4184,34 +4189,34 @@ gate_instance_list ; gatetype - : K_and { $$ = PGBuiltin::AND; } - | K_nand { $$ = PGBuiltin::NAND; } - | K_or { $$ = PGBuiltin::OR; } - | K_nor { $$ = PGBuiltin::NOR; } - | K_xor { $$ = PGBuiltin::XOR; } - | K_xnor { $$ = PGBuiltin::XNOR; } - | K_buf { $$ = PGBuiltin::BUF; } - | K_bufif0 { $$ = PGBuiltin::BUFIF0; } - | K_bufif1 { $$ = PGBuiltin::BUFIF1; } - | K_not { $$ = PGBuiltin::NOT; } - | K_notif0 { $$ = PGBuiltin::NOTIF0; } - | K_notif1 { $$ = PGBuiltin::NOTIF1; } - ; + : K_and { $$ = PGBuiltin::AND; } + | K_nand { $$ = PGBuiltin::NAND; } + | K_or { $$ = PGBuiltin::OR; } + | K_nor { $$ = PGBuiltin::NOR; } + | K_xor { $$ = PGBuiltin::XOR; } + | K_xnor { $$ = PGBuiltin::XNOR; } + | K_buf { $$ = PGBuiltin::BUF; } + | K_bufif0 { $$ = PGBuiltin::BUFIF0; } + | K_bufif1 { $$ = PGBuiltin::BUFIF1; } + | K_not { $$ = PGBuiltin::NOT; } + | K_notif0 { $$ = PGBuiltin::NOTIF0; } + | K_notif1 { $$ = PGBuiltin::NOTIF1; } + ; switchtype - : K_nmos { $$ = PGBuiltin::NMOS; } - | K_rnmos { $$ = PGBuiltin::RNMOS; } - | K_pmos { $$ = PGBuiltin::PMOS; } - | K_rpmos { $$ = PGBuiltin::RPMOS; } - | K_cmos { $$ = PGBuiltin::CMOS; } - | K_rcmos { $$ = PGBuiltin::RCMOS; } - | K_tran { $$ = PGBuiltin::TRAN; } - | K_rtran { $$ = PGBuiltin::RTRAN; } - | K_tranif0 { $$ = PGBuiltin::TRANIF0; } - | K_tranif1 { $$ = PGBuiltin::TRANIF1; } - | K_rtranif0 { $$ = PGBuiltin::RTRANIF0; } - | K_rtranif1 { $$ = PGBuiltin::RTRANIF1; } - ; + : K_nmos { $$ = PGBuiltin::NMOS; } + | K_rnmos { $$ = PGBuiltin::RNMOS; } + | K_pmos { $$ = PGBuiltin::PMOS; } + | K_rpmos { $$ = PGBuiltin::RPMOS; } + | K_cmos { $$ = PGBuiltin::CMOS; } + | K_rcmos { $$ = PGBuiltin::RCMOS; } + | K_tran { $$ = PGBuiltin::TRAN; } + | K_rtran { $$ = PGBuiltin::RTRAN; } + | K_tranif0 { $$ = PGBuiltin::TRANIF0; } + | K_tranif1 { $$ = PGBuiltin::TRANIF1; } + | K_rtranif0 { $$ = PGBuiltin::RTRANIF0; } + | K_rtranif1 { $$ = PGBuiltin::RTRANIF1; } + ; /* A general identifier is a hierarchical name, with the right most @@ -4220,92 +4225,92 @@ switchtype names. */ hierarchy_identifier - : IDENTIFIER - { $$ = new pform_name_t; - $$->push_back(name_component_t(lex_strings.make($1))); - delete[]$1; - } - | hierarchy_identifier '.' IDENTIFIER - { pform_name_t * tmp = $1; - tmp->push_back(name_component_t(lex_strings.make($3))); - delete[]$3; - $$ = tmp; - } - | hierarchy_identifier '[' expression ']' - { pform_name_t * tmp = $1; - name_component_t&tail = tmp->back(); - index_component_t itmp; - itmp.sel = index_component_t::SEL_BIT; - itmp.msb = $3; - tail.index.push_back(itmp); - $$ = tmp; - } - | hierarchy_identifier '[' '$' ']' - { pform_requires_sv(@3, "Last element expression ($)"); - pform_name_t * tmp = $1; - name_component_t&tail = tmp->back(); - index_component_t itmp; - itmp.sel = index_component_t::SEL_BIT_LAST; - itmp.msb = 0; - itmp.lsb = 0; - tail.index.push_back(itmp); - $$ = tmp; - } - | hierarchy_identifier '[' expression ':' expression ']' - { pform_name_t * tmp = $1; - name_component_t&tail = tmp->back(); - index_component_t itmp; - itmp.sel = index_component_t::SEL_PART; - itmp.msb = $3; - itmp.lsb = $5; - tail.index.push_back(itmp); - $$ = tmp; - } - | hierarchy_identifier '[' expression K_PO_POS expression ']' - { pform_name_t * tmp = $1; - name_component_t&tail = tmp->back(); - index_component_t itmp; - itmp.sel = index_component_t::SEL_IDX_UP; - itmp.msb = $3; - itmp.lsb = $5; - tail.index.push_back(itmp); - $$ = tmp; - } - | hierarchy_identifier '[' expression K_PO_NEG expression ']' - { pform_name_t * tmp = $1; - name_component_t&tail = tmp->back(); - index_component_t itmp; - itmp.sel = index_component_t::SEL_IDX_DO; - itmp.msb = $3; - itmp.lsb = $5; - tail.index.push_back(itmp); - $$ = tmp; - } - ; + : IDENTIFIER + { $$ = new pform_name_t; + $$->push_back(name_component_t(lex_strings.make($1))); + delete[]$1; + } + | hierarchy_identifier '.' IDENTIFIER + { pform_name_t * tmp = $1; + tmp->push_back(name_component_t(lex_strings.make($3))); + delete[]$3; + $$ = tmp; + } + | hierarchy_identifier '[' expression ']' + { pform_name_t * tmp = $1; + name_component_t&tail = tmp->back(); + index_component_t itmp; + itmp.sel = index_component_t::SEL_BIT; + itmp.msb = $3; + tail.index.push_back(itmp); + $$ = tmp; + } + | hierarchy_identifier '[' '$' ']' + { pform_requires_sv(@3, "Last element expression ($)"); + pform_name_t * tmp = $1; + name_component_t&tail = tmp->back(); + index_component_t itmp; + itmp.sel = index_component_t::SEL_BIT_LAST; + itmp.msb = 0; + itmp.lsb = 0; + tail.index.push_back(itmp); + $$ = tmp; + } + | hierarchy_identifier '[' expression ':' expression ']' + { pform_name_t * tmp = $1; + name_component_t&tail = tmp->back(); + index_component_t itmp; + itmp.sel = index_component_t::SEL_PART; + itmp.msb = $3; + itmp.lsb = $5; + tail.index.push_back(itmp); + $$ = tmp; + } + | hierarchy_identifier '[' expression K_PO_POS expression ']' + { pform_name_t * tmp = $1; + name_component_t&tail = tmp->back(); + index_component_t itmp; + itmp.sel = index_component_t::SEL_IDX_UP; + itmp.msb = $3; + itmp.lsb = $5; + tail.index.push_back(itmp); + $$ = tmp; + } + | hierarchy_identifier '[' expression K_PO_NEG expression ']' + { pform_name_t * tmp = $1; + name_component_t&tail = tmp->back(); + index_component_t itmp; + itmp.sel = index_component_t::SEL_IDX_DO; + itmp.msb = $3; + itmp.lsb = $5; + tail.index.push_back(itmp); + $$ = tmp; + } + ; /* This is a list of identifiers. The result is a list of strings, each one of the identifiers in the list. These are simple, non-hierarchical names separated by ',' characters. */ list_of_identifiers - : IDENTIFIER - { $$ = list_from_identifier($1); } - | list_of_identifiers ',' IDENTIFIER - { $$ = list_from_identifier($1, $3); } - ; + : IDENTIFIER + { $$ = list_from_identifier($1); } + | list_of_identifiers ',' IDENTIFIER + { $$ = list_from_identifier($1, $3); } + ; list_of_port_identifiers - : IDENTIFIER dimensions_opt - { $$ = make_port_list($1, $2, 0); } - | list_of_port_identifiers ',' IDENTIFIER dimensions_opt - { $$ = make_port_list($1, $3, $4, 0); } - ; + : IDENTIFIER dimensions_opt + { $$ = make_port_list($1, $2, 0); } + | list_of_port_identifiers ',' IDENTIFIER dimensions_opt + { $$ = make_port_list($1, $3, $4, 0); } + ; list_of_variable_port_identifiers - : IDENTIFIER dimensions_opt initializer_opt - { $$ = make_port_list($1, $2, $3); } - | list_of_variable_port_identifiers ',' IDENTIFIER dimensions_opt initializer_opt - { $$ = make_port_list($1, $3, $4, $5); } - ; + : IDENTIFIER dimensions_opt initializer_opt + { $$ = make_port_list($1, $2, $3); } + | list_of_variable_port_identifiers ',' IDENTIFIER dimensions_opt initializer_opt + { $$ = make_port_list($1, $3, $4, $5); } + ; /* The list_of_ports and list_of_port_declarations rules are the @@ -4325,75 +4330,68 @@ list_of_variable_port_identifiers the port list or in amongst the module items. */ list_of_ports - : port_opt - { std::vector*tmp - = new std::vector(1); - (*tmp)[0] = $1; - $$ = tmp; - } - | list_of_ports ',' port_opt - { std::vector*tmp = $1; - tmp->push_back($3); - $$ = tmp; - } - ; + : port_opt + { std::vector*tmp = new std::vector(1); + (*tmp)[0] = $1; + $$ = tmp; + } + | list_of_ports ',' port_opt + { std::vector*tmp = $1; + tmp->push_back($3); + $$ = tmp; + } + ; list_of_port_declarations - : port_declaration - { std::vector*tmp - = new std::vector(1); - (*tmp)[0] = $1; - $$ = tmp; - } - | list_of_port_declarations ',' port_declaration - { std::vector*tmp = $1; - tmp->push_back($3); - $$ = tmp; - } - | list_of_port_declarations ',' IDENTIFIER initializer_opt - { Module::port_t*ptmp; - perm_string name = lex_strings.make($3); - ptmp = pform_module_port_reference(@3, name); - std::vector*tmp = $1; - tmp->push_back(ptmp); + : port_declaration + { std::vector*tmp = new std::vector(1); + (*tmp)[0] = $1; + $$ = tmp; + } + | list_of_port_declarations ',' port_declaration + { std::vector*tmp = $1; + tmp->push_back($3); + $$ = tmp; + } + | list_of_port_declarations ',' IDENTIFIER initializer_opt + { Module::port_t*ptmp; + perm_string name = lex_strings.make($3); + ptmp = pform_module_port_reference(@3, name); + std::vector*tmp = $1; + tmp->push_back(ptmp); - if ($4) { - switch (port_declaration_context.port_type) { - case NetNet::PINOUT: - yyerror(@4, "error: Default port value not allowed for inout ports."); - break; - case NetNet::PINPUT: - pform_requires_sv(@4, "Default port value"); - ptmp->default_value = $4; - break; - case NetNet::POUTPUT: - pform_make_var_init(@3, name, $4); - break; - default: - break; - } - } - /* Get the port declaration details, the port type - and what not, from context data stored by the - last port_declaration rule. */ - pform_module_define_port(@3, name, - port_declaration_context.port_type, - port_declaration_context.port_net_type, - port_declaration_context.data_type, - nullptr, nullptr); - delete[]$3; - $$ = tmp; + if ($4) { + switch (port_declaration_context.port_type) { + case NetNet::PINOUT: + yyerror(@4, "error: Default port value not allowed for inout ports."); + break; + case NetNet::PINPUT: + pform_requires_sv(@4, "Default port value"); + ptmp->default_value = $4; + break; + case NetNet::POUTPUT: + pform_make_var_init(@3, name, $4); + break; + default: + break; } - | list_of_port_declarations ',' - { - yyerror(@2, "error: Superfluous comma in port declaration list."); - } - | list_of_port_declarations ';' - { - yyerror(@2, "error: ';' is an invalid port declaration " - "separator."); - } - ; + } + /* Get the port declaration details, the port type + and what not, from context data stored by the + last port_declaration rule. */ + pform_module_define_port(@3, name, + port_declaration_context.port_type, + port_declaration_context.port_net_type, + port_declaration_context.data_type, + nullptr, nullptr); + delete[]$3; + $$ = tmp; + } + | list_of_port_declarations ',' + { yyerror(@2, "error: Superfluous comma in port declaration list."); } + | list_of_port_declarations ';' + { yyerror(@2, "error: ';' is an invalid port declaration separator."); } + ; port_declaration : attribute_list_opt K_input net_type_or_var_opt data_type_or_implicit IDENTIFIER dimensions_opt @@ -4730,14 +4728,17 @@ label_opt ; module_attribute_foreign - : K_PSTAR IDENTIFIER K_integer IDENTIFIER '=' STRING ';' K_STARP { $$ = 0; } - | { $$ = 0; } - ; + : K_PSTAR IDENTIFIER K_integer IDENTIFIER '=' STRING ';' K_STARP { $$ = 0; } + | { $$ = 0; } + ; module_port_list_opt - : '(' list_of_ports ')' { $$ = $2; } - | '(' list_of_port_declarations ')' { $$ = $2; } - | { $$ = 0; } + : '(' list_of_ports ')' + { $$ = $2; } + | '(' list_of_port_declarations ')' + { $$ = $2; } + | + { $$ = 0; } | '(' error ')' { yyerror(@2, "Errors in port declarations."); yyerrok; @@ -4751,9 +4752,9 @@ module_port_list_opt module_parameter_port_list_opt : | '#' '(' - { pform_start_parameter_port_list(); } + { pform_start_parameter_port_list(); } module_parameter_port_list - { pform_end_parameter_port_list(); } + { pform_end_parameter_port_list(); } ')' ; @@ -4771,28 +4772,26 @@ module_parameter module_parameter_port_list : module_parameter | data_type_opt - { param_data_type = $1; - param_is_local = false; - param_is_type = false; - } + { param_data_type = $1; + param_is_local = false; + param_is_type = false; + } parameter_assign - { pform_requires_sv(@3, "Omitting initial `parameter` in parameter port " - "list"); - } + { pform_requires_sv(@3, "Omitting initial `parameter` in parameter port " + "list"); + } | type_param - { - param_is_local = false; - } + { param_is_local = false; } parameter_assign | module_parameter_port_list ',' module_parameter | module_parameter_port_list ',' data_type_opt - { if ($3) { - pform_requires_sv(@3, "Omitting `parameter`/`localparam` before " - "data type in parameter port list"); - param_data_type = $3; - param_is_type = false; + { if ($3) { + pform_requires_sv(@3, "Omitting `parameter`/`localparam` before " + "data type in parameter port list"); + param_data_type = $3; + param_is_type = false; + } } - } parameter_assign | module_parameter_port_list ',' type_param parameter_assign ; @@ -4869,11 +4868,11 @@ module_item delete $1; } - | K_trireg charge_strength_opt dimensions_opt delay3_opt list_of_identifiers ';' - { yyerror(@1, "sorry: trireg nets not supported."); - delete $3; - delete $4; - } + | K_trireg charge_strength_opt dimensions_opt delay3_opt list_of_identifiers ';' + { yyerror(@1, "sorry: trireg nets not supported."); + delete $3; + delete $4; + } /* The next two rules handle port declarations that include a net type, e.g. @@ -5048,26 +5047,26 @@ module_item primitives. These devices to not have delay lists or strengths, but then can have parameter lists. */ - | attribute_list_opt + | attribute_list_opt IDENTIFIER parameter_value_opt gate_instance_list ';' - { perm_string tmp1 = lex_strings.make($2); + { perm_string tmp1 = lex_strings.make($2); pform_make_modgates(@2, tmp1, $3, $4, $1); delete[]$2; - } + } | attribute_list_opt IDENTIFIER parameter_value_opt error ';' - { yyerror(@2, "error: Invalid module instantiation"); + { yyerror(@2, "error: Invalid module instantiation"); delete[]$2; if ($1) delete $1; - } + } /* Continuous assignment can have an optional drive strength, then an optional delay3 that applies to all the assignments in the cont_assign_list. */ - | K_assign drive_strength_opt delay3_opt cont_assign_list ';' - { pform_make_pgassign_list(@1, $4, $3, $2); } + | K_assign drive_strength_opt delay3_opt cont_assign_list ';' + { pform_make_pgassign_list(@1, $4, $3, $2); } /* Always and initial items are behavioral processes. */ @@ -5203,7 +5202,7 @@ module_item yyerrok; } - | K_assign error ';' + | K_assign error ';' { yyerror(@1, "error: syntax error in continuous assignment"); yyerrok; } @@ -5282,7 +5281,10 @@ module_item_list_opt | ; -generate_if : K_if '(' expression ')' { pform_start_generate_if(@1, $3); } ; +generate_if + : K_if '(' expression ')' + { pform_start_generate_if(@1, $3); } + ; generate_case_items : generate_case_items generate_case_item @@ -5290,9 +5292,13 @@ generate_case_items ; generate_case_item - : expression_list_proper ':' { pform_generate_case_item(@1, $1); } generate_block + : expression_list_proper ':' + { pform_generate_case_item(@1, $1); } + generate_block { pform_endgenerate(false); } - | K_default ':' { pform_generate_case_item(@1, 0); } generate_block + | K_default ':' + { pform_generate_case_item(@1, 0); } + generate_block { pform_endgenerate(false); } ; @@ -5306,9 +5312,9 @@ generate_item cerr << @1 << ": warning: Anachronistic use of begin/end to surround generate schemes." << endl; } } - | K_begin ':' IDENTIFIER { - pform_start_generate_nblock(@1, $3); - } generate_item_list_opt K_end + | K_begin ':' IDENTIFIER + { pform_start_generate_nblock(@1, $3); } + generate_item_list_opt K_end { /* Detect and warn about anachronistic named begin/end use */ if (generation_flag > GN_VER2001 && warn_anachronisms) { warn_count += 1; @@ -5324,7 +5330,8 @@ generate_item_list ; generate_item_list_opt - : { pform_generate_single_item = false; } generate_item_list + : { pform_generate_single_item = false; } + generate_item_list | ; @@ -5335,9 +5342,9 @@ generate_item_list_opt only need to take note here of the scope name, if any. */ generate_block - : { pform_generate_single_item = true; } + : { pform_generate_single_item = true; } module_item - { pform_generate_single_item = false; } + { pform_generate_single_item = false; } | K_begin label_opt generate_item_list_opt K_end label_opt { if ($2) pform_generate_block_name($2); @@ -5364,49 +5371,49 @@ net_decl_assign ; net_decl_assigns - : net_decl_assigns ',' net_decl_assign + : net_decl_assigns ',' net_decl_assign { std::list*tmp = $1; tmp->push_back($3); $$ = tmp; } - | net_decl_assign + | net_decl_assign { std::list*tmp = new std::list; tmp->push_back($1); $$ = tmp; } - ; + ; net_type - : K_wire { $$ = NetNet::WIRE; } - | K_tri { $$ = NetNet::TRI; } - | K_tri1 { $$ = NetNet::TRI1; } - | K_supply0 { $$ = NetNet::SUPPLY0; } - | K_wand { $$ = NetNet::WAND; } - | K_triand { $$ = NetNet::TRIAND; } - | K_tri0 { $$ = NetNet::TRI0; } - | K_supply1 { $$ = NetNet::SUPPLY1; } - | K_wor { $$ = NetNet::WOR; } - | K_trior { $$ = NetNet::TRIOR; } - | K_wone { $$ = NetNet::UNRESOLVED_WIRE; - cerr << @1.text << ":" << @1.first_line << ": warning: " - "'wone' is deprecated, please use 'uwire' " - "instead." << endl; - } - | K_uwire { $$ = NetNet::UNRESOLVED_WIRE; } - ; + : K_wire { $$ = NetNet::WIRE; } + | K_tri { $$ = NetNet::TRI; } + | K_tri1 { $$ = NetNet::TRI1; } + | K_supply0 { $$ = NetNet::SUPPLY0; } + | K_wand { $$ = NetNet::WAND; } + | K_triand { $$ = NetNet::TRIAND; } + | K_tri0 { $$ = NetNet::TRI0; } + | K_supply1 { $$ = NetNet::SUPPLY1; } + | K_wor { $$ = NetNet::WOR; } + | K_trior { $$ = NetNet::TRIOR; } + | K_wone { $$ = NetNet::UNRESOLVED_WIRE; + cerr << @1.text << ":" << @1.first_line << ": warning: " + "'wone' is deprecated, please use 'uwire' " + "instead." << endl; + } + | K_uwire { $$ = NetNet::UNRESOLVED_WIRE; } + ; net_type_opt : net_type { $$ = $1; } - | { $$ = NetNet::IMPLICIT; } + | { $$ = NetNet::IMPLICIT; } ; net_type_or_var : net_type { $$ = $1; } - | K_var { $$ = NetNet::REG; } + | K_var { $$ = NetNet::REG; } net_type_or_var_opt : net_type_opt { $$ = $1; } - | K_var { $$ = NetNet::REG; } + | K_var { $$ = NetNet::REG; } ; /* The param_type rule is just the data_type_or_implicit rule wrapped @@ -5416,13 +5423,20 @@ net_type_or_var_opt param_type : data_type_or_implicit - { param_is_type = false; - param_data_type = $1; - } + { param_is_type = false; + param_data_type = $1; + } | type_param -parameter : K_parameter { param_is_local = false; }; -localparam : K_localparam { param_is_local = true; }; +parameter + : K_parameter + { param_is_local = false; } + ; + +localparam + : K_localparam + { param_is_local = true; } + ; parameter_declaration : parameter_or_localparam param_type parameter_assign_list ';' @@ -5474,9 +5488,9 @@ parameter_value_range value_range_expression : expression { $$ = $1; } - | K_inf { $$ = 0; } - | '+' K_inf { $$ = 0; } - | '-' K_inf { $$ = 0; } + | K_inf { $$ = 0; } + | '+' K_inf { $$ = 0; } + | '-' K_inf { $$ = 0; } ; from_exclude : K_from { $$ = false; } | K_exclude { $$ = true; } ; @@ -5498,66 +5512,65 @@ from_exclude : K_from { $$ = false; } | K_exclude { $$ = true; } ; approved by WG1364 on 6/28/1998. */ parameter_value_opt - : '#' '(' expression_list_with_nuls ')' - { struct parmvalue_t*tmp = new struct parmvalue_t; - tmp->by_order = $3; - tmp->by_name = 0; - $$ = tmp; - } - | '#' '(' parameter_value_byname_list ')' - { struct parmvalue_t*tmp = new struct parmvalue_t; - tmp->by_order = 0; - tmp->by_name = $3; - $$ = tmp; - } - | '#' DEC_NUMBER - { assert($2); - PENumber*tmp = new PENumber($2); - FILE_NAME(tmp, @1); + : '#' '(' expression_list_with_nuls ')' + { struct parmvalue_t*tmp = new struct parmvalue_t; + tmp->by_order = $3; + tmp->by_name = 0; + $$ = tmp; + } + | '#' '(' parameter_value_byname_list ')' + { struct parmvalue_t*tmp = new struct parmvalue_t; + tmp->by_order = 0; + tmp->by_name = $3; + $$ = tmp; + } + | '#' DEC_NUMBER + { assert($2); + PENumber*tmp = new PENumber($2); + FILE_NAME(tmp, @1); - struct parmvalue_t*lst = new struct parmvalue_t; - lst->by_order = new std::list; - lst->by_order->push_back(tmp); - lst->by_name = 0; - $$ = lst; - based_size = 0; - } - | '#' REALTIME - { assert($2); - PEFNumber*tmp = new PEFNumber($2); - FILE_NAME(tmp, @1); + struct parmvalue_t*lst = new struct parmvalue_t; + lst->by_order = new std::list; + lst->by_order->push_back(tmp); + lst->by_name = 0; + $$ = lst; + based_size = 0; + } + | '#' REALTIME + { assert($2); + PEFNumber*tmp = new PEFNumber($2); + FILE_NAME(tmp, @1); - struct parmvalue_t*lst = new struct parmvalue_t; - lst->by_order = new std::list; - lst->by_order->push_back(tmp); - lst->by_name = 0; - $$ = lst; - } - | '#' error - { yyerror(@1, "error: syntax error in parameter value " - "assignment list."); - $$ = 0; - } - | - { $$ = 0; } - ; + struct parmvalue_t*lst = new struct parmvalue_t; + lst->by_order = new std::list; + lst->by_order->push_back(tmp); + lst->by_name = 0; + $$ = lst; + } + | '#' error + { yyerror(@1, "error: syntax error in parameter value assignment list."); + $$ = 0; + } + | + { $$ = 0; } + ; parameter_value_byname - : '.' IDENTIFIER '(' expression ')' - { named_pexpr_t*tmp = new named_pexpr_t; - tmp->name = lex_strings.make($2); - tmp->parm = $4; - delete[]$2; - $$ = tmp; - } - | '.' IDENTIFIER '(' ')' - { named_pexpr_t*tmp = new named_pexpr_t; - tmp->name = lex_strings.make($2); - tmp->parm = 0; - delete[]$2; - $$ = tmp; - } - ; + : '.' IDENTIFIER '(' expression ')' + { named_pexpr_t*tmp = new named_pexpr_t; + tmp->name = lex_strings.make($2); + tmp->parm = $4; + delete[]$2; + $$ = tmp; + } + | '.' IDENTIFIER '(' ')' + { named_pexpr_t*tmp = new named_pexpr_t; + tmp->name = lex_strings.make($2); + tmp->parm = 0; + delete[]$2; + $$ = tmp; + } + ; parameter_value_byname_list : parameter_value_byname @@ -5589,93 +5602,93 @@ parameter_value_byname_list tweaks its name as needed. */ port - : port_reference - { $$ = $1; } + : port_reference + { $$ = $1; } /* This syntax attaches an external name to the port reference so that the caller can bind by name to non-trivial port references. The port_t object gets its PWire from the port_reference, but its name from the IDENTIFIER. */ - | '.' IDENTIFIER '(' port_reference ')' - { Module::port_t*tmp = $4; - tmp->name = lex_strings.make($2); - delete[]$2; - $$ = tmp; - } + | '.' IDENTIFIER '(' port_reference ')' + { Module::port_t*tmp = $4; + tmp->name = lex_strings.make($2); + delete[]$2; + $$ = tmp; + } /* A port can also be a concatenation of port references. In this case the port does not have a name available to the outside, only positional parameter passing is possible here. */ - | '{' port_reference_list '}' - { Module::port_t*tmp = $2; - tmp->name = perm_string(); - $$ = tmp; - } + | '{' port_reference_list '}' + { Module::port_t*tmp = $2; + tmp->name = perm_string(); + $$ = tmp; + } /* This attaches a name to a port reference concatenation list so that parameter passing be name is possible. */ - | '.' IDENTIFIER '(' '{' port_reference_list '}' ')' - { Module::port_t*tmp = $5; - tmp->name = lex_strings.make($2); - delete[]$2; - $$ = tmp; - } - ; + | '.' IDENTIFIER '(' '{' port_reference_list '}' ')' + { Module::port_t*tmp = $5; + tmp->name = lex_strings.make($2); + delete[]$2; + $$ = tmp; + } + ; port_opt - : port { $$ = $1; } - | { $$ = 0; } - ; + : port { $$ = $1; } + | { $$ = 0; } + ; /* The port_name rule is used with a module is being *instantiated*, and not when it is being declared. See the port rule if you are looking for the ports of a module declaration. */ port_name - : attribute_list_opt '.' IDENTIFIER '(' expression ')' - { named_pexpr_t*tmp = new named_pexpr_t; - tmp->name = lex_strings.make($3); - tmp->parm = $5; - delete[]$3; - delete $1; - $$ = tmp; - } - | attribute_list_opt '.' IDENTIFIER '(' error ')' - { yyerror(@3, "error: invalid port connection expression."); - named_pexpr_t*tmp = new named_pexpr_t; - tmp->name = lex_strings.make($3); - tmp->parm = 0; - delete[]$3; - delete $1; - $$ = tmp; - } - | attribute_list_opt '.' IDENTIFIER '(' ')' - { named_pexpr_t*tmp = new named_pexpr_t; - tmp->name = lex_strings.make($3); - tmp->parm = 0; - delete[]$3; - delete $1; - $$ = tmp; - } - | attribute_list_opt '.' IDENTIFIER - { named_pexpr_t*tmp = new named_pexpr_t; - tmp->name = lex_strings.make($3); - tmp->parm = new PEIdent(lex_strings.make($3), true); - FILE_NAME(tmp->parm, @1); - delete[]$3; - delete $1; - $$ = tmp; - } - | K_DOTSTAR - { named_pexpr_t*tmp = new named_pexpr_t; - tmp->name = lex_strings.make("*"); - tmp->parm = 0; - $$ = tmp; - } - ; + : attribute_list_opt '.' IDENTIFIER '(' expression ')' + { named_pexpr_t*tmp = new named_pexpr_t; + tmp->name = lex_strings.make($3); + tmp->parm = $5; + delete[]$3; + delete $1; + $$ = tmp; + } + | attribute_list_opt '.' IDENTIFIER '(' error ')' + { yyerror(@3, "error: invalid port connection expression."); + named_pexpr_t*tmp = new named_pexpr_t; + tmp->name = lex_strings.make($3); + tmp->parm = 0; + delete[]$3; + delete $1; + $$ = tmp; + } + | attribute_list_opt '.' IDENTIFIER '(' ')' + { named_pexpr_t*tmp = new named_pexpr_t; + tmp->name = lex_strings.make($3); + tmp->parm = 0; + delete[]$3; + delete $1; + $$ = tmp; + } + | attribute_list_opt '.' IDENTIFIER + { named_pexpr_t*tmp = new named_pexpr_t; + tmp->name = lex_strings.make($3); + tmp->parm = new PEIdent(lex_strings.make($3), true); + FILE_NAME(tmp->parm, @1); + delete[]$3; + delete $1; + $$ = tmp; + } + | K_DOTSTAR + { named_pexpr_t*tmp = new named_pexpr_t; + tmp->name = lex_strings.make("*"); + tmp->parm = 0; + $$ = tmp; + } + ; port_name_list : port_name_list ',' port_name @@ -5728,90 +5741,86 @@ port_conn_expression_list_with_nuls port_t object to pass it up to the module declaration code. */ port_reference + : IDENTIFIER + { Module::port_t*ptmp; + perm_string name = lex_strings.make($1); + ptmp = pform_module_port_reference(@1, name); + delete[]$1; + $$ = ptmp; + } + | IDENTIFIER '[' expression ':' expression ']' + { index_component_t itmp; + itmp.sel = index_component_t::SEL_PART; + itmp.msb = $3; + itmp.lsb = $5; - : IDENTIFIER - { Module::port_t*ptmp; - perm_string name = lex_strings.make($1); - ptmp = pform_module_port_reference(@1, name); - delete[]$1; - $$ = ptmp; - } + name_component_t ntmp (lex_strings.make($1)); + ntmp.index.push_back(itmp); - | IDENTIFIER '[' expression ':' expression ']' - { index_component_t itmp; - itmp.sel = index_component_t::SEL_PART; - itmp.msb = $3; - itmp.lsb = $5; + pform_name_t pname; + pname.push_back(ntmp); - name_component_t ntmp (lex_strings.make($1)); - ntmp.index.push_back(itmp); + PEIdent*wtmp = new PEIdent(pname); + FILE_NAME(wtmp, @1); - pform_name_t pname; - pname.push_back(ntmp); + Module::port_t*ptmp = new Module::port_t; + ptmp->name = perm_string(); + ptmp->expr.push_back(wtmp); + ptmp->default_value = 0; - PEIdent*wtmp = new PEIdent(pname); - FILE_NAME(wtmp, @1); + delete[]$1; + $$ = ptmp; + } + | IDENTIFIER '[' expression ']' + { index_component_t itmp; + itmp.sel = index_component_t::SEL_BIT; + itmp.msb = $3; + itmp.lsb = 0; - Module::port_t*ptmp = new Module::port_t; - ptmp->name = perm_string(); - ptmp->expr.push_back(wtmp); - ptmp->default_value = 0; + name_component_t ntmp (lex_strings.make($1)); + ntmp.index.push_back(itmp); - delete[]$1; - $$ = ptmp; - } + pform_name_t pname; + pname.push_back(ntmp); - | IDENTIFIER '[' expression ']' - { index_component_t itmp; - itmp.sel = index_component_t::SEL_BIT; - itmp.msb = $3; - itmp.lsb = 0; + PEIdent*tmp = new PEIdent(pname); + FILE_NAME(tmp, @1); - name_component_t ntmp (lex_strings.make($1)); - ntmp.index.push_back(itmp); - - pform_name_t pname; - pname.push_back(ntmp); - - PEIdent*tmp = new PEIdent(pname); - FILE_NAME(tmp, @1); - - Module::port_t*ptmp = new Module::port_t; - ptmp->name = perm_string(); - ptmp->expr.push_back(tmp); - ptmp->default_value = 0; - delete[]$1; - $$ = ptmp; - } - - | IDENTIFIER '[' error ']' - { yyerror(@1, "error: invalid port bit select"); - Module::port_t*ptmp = new Module::port_t; - PEIdent*wtmp = new PEIdent(lex_strings.make($1)); - FILE_NAME(wtmp, @1); - ptmp->name = lex_strings.make($1); - ptmp->expr.push_back(wtmp); - ptmp->default_value = 0; - delete[]$1; - $$ = ptmp; - } - ; + Module::port_t*ptmp = new Module::port_t; + ptmp->name = perm_string(); + ptmp->expr.push_back(tmp); + ptmp->default_value = 0; + delete[]$1; + $$ = ptmp; + } + | IDENTIFIER '[' error ']' + { yyerror(@1, "error: invalid port bit select"); + Module::port_t*ptmp = new Module::port_t; + PEIdent*wtmp = new PEIdent(lex_strings.make($1)); + FILE_NAME(wtmp, @1); + ptmp->name = lex_strings.make($1); + ptmp->expr.push_back(wtmp); + ptmp->default_value = 0; + delete[]$1; + $$ = ptmp; + } + ; port_reference_list - : port_reference - { $$ = $1; } - | port_reference_list ',' port_reference - { Module::port_t*tmp = $1; - append(tmp->expr, $3->expr); - delete $3; - $$ = tmp; - } - ; + : port_reference + { $$ = $1; } + | port_reference_list ',' port_reference + { Module::port_t*tmp = $1; + append(tmp->expr, $3->expr); + delete $3; + $$ = tmp; + } + ; /* The range is a list of variable dimensions. */ dimensions_opt - : { $$ = 0; } + : { $$ = 0; } | dimensions { $$ = $1; } ; @@ -5837,16 +5846,16 @@ net_variable ; net_variable_list - : net_variable - { std::vector *tmp = new std::vector; - tmp->push_back($1); - $$ = tmp; - } - | net_variable_list ',' net_variable - { $1->push_back($3); - $$ = $1; - } - ; + : net_variable + { std::vector *tmp = new std::vector; + tmp->push_back($1); + $$ = tmp; + } + | net_variable_list ',' net_variable + { $1->push_back($3); + $$ = $1; + } + ; event_variable : IDENTIFIER dimensions_opt @@ -5866,303 +5875,303 @@ event_variable_list ; specify_item - : K_specparam specparam_decl ';' - | specify_simple_path_decl ';' - { pform_module_specify_path($1); - } - | specify_edge_path_decl ';' - { pform_module_specify_path($1); - } - | K_if '(' expression ')' specify_simple_path_decl ';' - { PSpecPath*tmp = $5; - if (tmp) { - tmp->conditional = true; - tmp->condition = $3; - } - pform_module_specify_path(tmp); - } - | K_if '(' expression ')' specify_edge_path_decl ';' - { PSpecPath*tmp = $5; - if (tmp) { - tmp->conditional = true; - tmp->condition = $3; - } - pform_module_specify_path(tmp); - } - | K_ifnone specify_simple_path_decl ';' - { PSpecPath*tmp = $2; - if (tmp) { - tmp->conditional = true; - tmp->condition = 0; - } - pform_module_specify_path(tmp); - } - | K_ifnone specify_edge_path_decl ';' - { yywarn(@1, "Sorry: ifnone with an edge-sensitive path is " - "not supported."); - yyerrok; - } - | K_Sfullskew '(' spec_reference_event ',' spec_reference_event + : K_specparam specparam_decl ';' + | specify_simple_path_decl ';' + { pform_module_specify_path($1); } + | specify_edge_path_decl ';' + { pform_module_specify_path($1); } + | K_if '(' expression ')' specify_simple_path_decl ';' + { PSpecPath*tmp = $5; + if (tmp) { + tmp->conditional = true; + tmp->condition = $3; + } + pform_module_specify_path(tmp); + } + | K_if '(' expression ')' specify_edge_path_decl ';' + { PSpecPath*tmp = $5; + if (tmp) { + tmp->conditional = true; + tmp->condition = $3; + } + pform_module_specify_path(tmp); + } + | K_ifnone specify_simple_path_decl ';' + { PSpecPath*tmp = $2; + if (tmp) { + tmp->conditional = true; + tmp->condition = 0; + } + pform_module_specify_path(tmp); + } + | K_ifnone specify_edge_path_decl ';' + { yywarn(@1, "Sorry: ifnone with an edge-sensitive path is not supported."); + yyerrok; + } + | K_Sfullskew '(' spec_reference_event ',' spec_reference_event + ',' delay_value ',' delay_value spec_notifier_opt ')' ';' + { delete $7; + delete $9; + } + | K_Shold '(' spec_reference_event ',' spec_reference_event + ',' delay_value spec_notifier_opt ')' ';' + { delete $7; + } + | K_Snochange '(' spec_reference_event ',' spec_reference_event ',' delay_value ',' delay_value spec_notifier_opt ')' ';' - { delete $7; - delete $9; - } - | K_Shold '(' spec_reference_event ',' spec_reference_event - ',' delay_value spec_notifier_opt ')' ';' - { delete $7; - } - | K_Snochange '(' spec_reference_event ',' spec_reference_event - ',' delay_value ',' delay_value spec_notifier_opt ')' ';' - { delete $7; - delete $9; - } - | K_Speriod '(' spec_reference_event ',' delay_value - spec_notifier_opt ')' ';' - { delete $5; - } - | K_Srecovery '(' spec_reference_event ',' spec_reference_event - ',' delay_value spec_notifier_opt ')' ';' - { delete $7; - } - | K_Srecrem '(' spec_reference_event ',' spec_reference_event - ',' delay_value ',' delay_value spec_notifier_opt ')' ';' - { delete $7; - delete $9; - } - | K_Sremoval '(' spec_reference_event ',' spec_reference_event - ',' delay_value spec_notifier_opt ')' ';' - { delete $7; - } - | K_Ssetup '(' spec_reference_event ',' spec_reference_event - ',' delay_value spec_notifier_opt ')' ';' - { delete $7; - } - | K_Ssetuphold '(' spec_reference_event ',' spec_reference_event - ',' delay_value ',' delay_value spec_notifier_opt ')' ';' - { delete $7; - delete $9; - } - | K_Sskew '(' spec_reference_event ',' spec_reference_event - ',' delay_value spec_notifier_opt ')' ';' - { delete $7; - } - | K_Stimeskew '(' spec_reference_event ',' spec_reference_event - ',' delay_value spec_notifier_opt ')' ';' - { delete $7; - } - | K_Swidth '(' spec_reference_event ',' delay_value ',' expression - spec_notifier_opt ')' ';' - { delete $5; - delete $7; - } - | K_Swidth '(' spec_reference_event ',' delay_value ')' ';' - { delete $5; - } - | K_pulsestyle_onevent specify_path_identifiers ';' - { delete $2; - } - | K_pulsestyle_ondetect specify_path_identifiers ';' - { delete $2; - } - | K_showcancelled specify_path_identifiers ';' - { delete $2; - } - | K_noshowcancelled specify_path_identifiers ';' - { delete $2; - } - ; + { delete $7; + delete $9; + } + | K_Speriod '(' spec_reference_event ',' delay_value + spec_notifier_opt ')' ';' + { delete $5; + } + | K_Srecovery '(' spec_reference_event ',' spec_reference_event + ',' delay_value spec_notifier_opt ')' ';' + { delete $7; + } + | K_Srecrem '(' spec_reference_event ',' spec_reference_event + ',' delay_value ',' delay_value spec_notifier_opt ')' ';' + { delete $7; + delete $9; + } + | K_Sremoval '(' spec_reference_event ',' spec_reference_event + ',' delay_value spec_notifier_opt ')' ';' + { delete $7; + } + | K_Ssetup '(' spec_reference_event ',' spec_reference_event + ',' delay_value spec_notifier_opt ')' ';' + { delete $7; + } + | K_Ssetuphold '(' spec_reference_event ',' spec_reference_event + ',' delay_value ',' delay_value spec_notifier_opt ')' ';' + { delete $7; + delete $9; + } + | K_Sskew '(' spec_reference_event ',' spec_reference_event + ',' delay_value spec_notifier_opt ')' ';' + { delete $7; + } + | K_Stimeskew '(' spec_reference_event ',' spec_reference_event + ',' delay_value spec_notifier_opt ')' ';' + { delete $7; + } + | K_Swidth '(' spec_reference_event ',' delay_value ',' expression + spec_notifier_opt ')' ';' + { delete $5; + delete $7; + } + | K_Swidth '(' spec_reference_event ',' delay_value ')' ';' + { delete $5; + } + | K_pulsestyle_onevent specify_path_identifiers ';' + { delete $2; + } + | K_pulsestyle_ondetect specify_path_identifiers ';' + { delete $2; + } + | K_showcancelled specify_path_identifiers ';' + { delete $2; + } + | K_noshowcancelled specify_path_identifiers ';' + { delete $2; + } + ; specify_item_list - : specify_item - | specify_item_list specify_item - ; + : specify_item + | specify_item_list specify_item + ; specify_item_list_opt - : /* empty */ - { } - | specify_item_list - { } + : /* empty */ + { } + | specify_item_list + { } specify_edge_path_decl - : specify_edge_path '=' '(' delay_value_list ')' - { $$ = pform_assign_path_delay($1, $4); } - | specify_edge_path '=' delay_value_simple - { std::list*tmp = new std::list; - tmp->push_back($3); - $$ = pform_assign_path_delay($1, tmp); - } - ; + : specify_edge_path '=' '(' delay_value_list ')' + { $$ = pform_assign_path_delay($1, $4); } + | specify_edge_path '=' delay_value_simple + { std::list*tmp = new std::list; + tmp->push_back($3); + $$ = pform_assign_path_delay($1, tmp); + } + ; -edge_operator : K_posedge { $$ = true; } | K_negedge { $$ = false; } ; +edge_operator + : K_posedge { $$ = true; } + | K_negedge { $$ = false; } + ; specify_edge_path - : '(' specify_path_identifiers spec_polarity - K_EG '(' specify_path_identifiers polarity_operator expression ')' ')' - { int edge_flag = 0; - $$ = pform_make_specify_edge_path(@1, edge_flag, $2, $3, false, $6, $8); } - | '(' edge_operator specify_path_identifiers spec_polarity - K_EG '(' specify_path_identifiers polarity_operator expression ')' ')' - { int edge_flag = $2? 1 : -1; - $$ = pform_make_specify_edge_path(@1, edge_flag, $3, $4, false, $7, $9);} - | '(' specify_path_identifiers spec_polarity - K_SG '(' specify_path_identifiers polarity_operator expression ')' ')' - { int edge_flag = 0; - $$ = pform_make_specify_edge_path(@1, edge_flag, $2, $3, true, $6, $8); } - | '(' edge_operator specify_path_identifiers spec_polarity - K_SG '(' specify_path_identifiers polarity_operator expression ')' ')' - { int edge_flag = $2? 1 : -1; - $$ = pform_make_specify_edge_path(@1, edge_flag, $3, $4, true, $7, $9); } - ; + : '(' specify_path_identifiers spec_polarity + K_EG '(' specify_path_identifiers polarity_operator expression ')' ')' + { int edge_flag = 0; + $$ = pform_make_specify_edge_path(@1, edge_flag, $2, $3, false, $6, $8); + } + | '(' edge_operator specify_path_identifiers spec_polarity + K_EG '(' specify_path_identifiers polarity_operator expression ')' ')' + { int edge_flag = $2? 1 : -1; + $$ = pform_make_specify_edge_path(@1, edge_flag, $3, $4, false, $7, $9); + } + | '(' specify_path_identifiers spec_polarity + K_SG '(' specify_path_identifiers polarity_operator expression ')' ')' + { int edge_flag = 0; + $$ = pform_make_specify_edge_path(@1, edge_flag, $2, $3, true, $6, $8); + } + | '(' edge_operator specify_path_identifiers spec_polarity + K_SG '(' specify_path_identifiers polarity_operator expression ')' ')' + { int edge_flag = $2? 1 : -1; + $$ = pform_make_specify_edge_path(@1, edge_flag, $3, $4, true, $7, $9); + } + ; polarity_operator - : K_PO_POS - | K_PO_NEG - | ':' - ; + : K_PO_POS + | K_PO_NEG + | ':' + ; specify_simple_path_decl - : specify_simple_path '=' '(' delay_value_list ')' - { $$ = pform_assign_path_delay($1, $4); } - | specify_simple_path '=' delay_value_simple - { std::list*tmp = new std::list; - tmp->push_back($3); - $$ = pform_assign_path_delay($1, tmp); - } - | specify_simple_path '=' '(' error ')' - { yyerror(@3, "Syntax error in delay value list."); - yyerrok; - $$ = 0; - } - ; + : specify_simple_path '=' '(' delay_value_list ')' + { $$ = pform_assign_path_delay($1, $4); } + | specify_simple_path '=' delay_value_simple + { std::list*tmp = new std::list; + tmp->push_back($3); + $$ = pform_assign_path_delay($1, tmp); + } + | specify_simple_path '=' '(' error ')' + { yyerror(@3, "Syntax error in delay value list."); + yyerrok; + $$ = 0; + } + ; specify_simple_path - : '(' specify_path_identifiers spec_polarity - K_EG specify_path_identifiers ')' - { $$ = pform_make_specify_path(@1, $2, $3, false, $5); } - | '(' specify_path_identifiers spec_polarity - K_SG specify_path_identifiers ')' - { $$ = pform_make_specify_path(@1, $2, $3, true, $5); } - | '(' error ')' - { yyerror(@1, "Invalid simple path"); - yyerrok; - } - ; + : '(' specify_path_identifiers spec_polarity K_EG specify_path_identifiers ')' + { $$ = pform_make_specify_path(@1, $2, $3, false, $5); } + | '(' specify_path_identifiers spec_polarity K_SG specify_path_identifiers ')' + { $$ = pform_make_specify_path(@1, $2, $3, true, $5); } + | '(' error ')' + { yyerror(@1, "Invalid simple path"); + yyerrok; + } + ; specify_path_identifiers - : IDENTIFIER - { std::list*tmp = new std::list; - tmp->push_back(lex_strings.make($1)); - $$ = tmp; - delete[]$1; - } - | IDENTIFIER '[' expr_primary ']' - { if (gn_specify_blocks_flag) { - yywarn(@4, "Bit selects are not currently supported " - "in path declarations. The declaration " - "will be applied to the whole vector."); - } - std::list*tmp = new std::list; - tmp->push_back(lex_strings.make($1)); - $$ = tmp; - delete[]$1; - } - | IDENTIFIER '[' expr_primary polarity_operator expr_primary ']' - { if (gn_specify_blocks_flag) { - yywarn(@4, "Part selects are not currently supported " - "in path declarations. The declaration " - "will be applied to the whole vector."); - } - std::list*tmp = new std::list; - tmp->push_back(lex_strings.make($1)); - $$ = tmp; - delete[]$1; - } - | specify_path_identifiers ',' IDENTIFIER - { std::list*tmp = $1; - tmp->push_back(lex_strings.make($3)); - $$ = tmp; - delete[]$3; - } - | specify_path_identifiers ',' IDENTIFIER '[' expr_primary ']' - { if (gn_specify_blocks_flag) { - yywarn(@4, "Bit selects are not currently supported " - "in path declarations. The declaration " - "will be applied to the whole vector."); - } - std::list*tmp = $1; - tmp->push_back(lex_strings.make($3)); - $$ = tmp; - delete[]$3; - } - | specify_path_identifiers ',' IDENTIFIER '[' expr_primary polarity_operator expr_primary ']' - { if (gn_specify_blocks_flag) { - yywarn(@4, "Part selects are not currently supported " - "in path declarations. The declaration " - "will be applied to the whole vector."); - } - std::list*tmp = $1; - tmp->push_back(lex_strings.make($3)); - $$ = tmp; - delete[]$3; - } - ; + : IDENTIFIER + { std::list*tmp = new std::list; + tmp->push_back(lex_strings.make($1)); + $$ = tmp; + delete[]$1; + } + | IDENTIFIER '[' expr_primary ']' + { if (gn_specify_blocks_flag) { + yywarn(@4, "Bit selects are not currently supported " + "in path declarations. The declaration " + "will be applied to the whole vector."); + } + std::list*tmp = new std::list; + tmp->push_back(lex_strings.make($1)); + $$ = tmp; + delete[]$1; + } + | IDENTIFIER '[' expr_primary polarity_operator expr_primary ']' + { if (gn_specify_blocks_flag) { + yywarn(@4, "Part selects are not currently supported " + "in path declarations. The declaration " + "will be applied to the whole vector."); + } + std::list*tmp = new std::list; + tmp->push_back(lex_strings.make($1)); + $$ = tmp; + delete[]$1; + } + | specify_path_identifiers ',' IDENTIFIER + { std::list*tmp = $1; + tmp->push_back(lex_strings.make($3)); + $$ = tmp; + delete[]$3; + } + | specify_path_identifiers ',' IDENTIFIER '[' expr_primary ']' + { if (gn_specify_blocks_flag) { + yywarn(@4, "Bit selects are not currently supported " + "in path declarations. The declaration " + "will be applied to the whole vector."); + } + std::list*tmp = $1; + tmp->push_back(lex_strings.make($3)); + $$ = tmp; + delete[]$3; + } + | specify_path_identifiers ',' IDENTIFIER '[' expr_primary polarity_operator expr_primary ']' + { if (gn_specify_blocks_flag) { + yywarn(@4, "Part selects are not currently supported " + "in path declarations. The declaration " + "will be applied to the whole vector."); + } + std::list*tmp = $1; + tmp->push_back(lex_strings.make($3)); + $$ = tmp; + delete[]$3; + } + ; specparam - : IDENTIFIER '=' expression - { PExpr*tmp = $3; - pform_set_specparam(@1, lex_strings.make($1), - specparam_active_range, tmp); - delete[]$1; - } - | IDENTIFIER '=' expression ':' expression ':' expression - { PExpr*tmp = 0; - switch (min_typ_max_flag) { - case MIN: - tmp = $3; - delete $5; - delete $7; - break; - case TYP: - delete $3; - tmp = $5; - delete $7; - break; - case MAX: - delete $3; - delete $5; - tmp = $7; - break; - } - if (min_typ_max_warn > 0) { - cerr << tmp->get_fileline() << ": warning: choosing "; - switch (min_typ_max_flag) { - case MIN: - cerr << "min"; - break; - case TYP: - cerr << "typ"; - break; - case MAX: - cerr << "max"; - break; - } - cerr << " expression." << endl; - min_typ_max_warn -= 1; - } - pform_set_specparam(@1, lex_strings.make($1), - specparam_active_range, tmp); - delete[]$1; - } - | PATHPULSE_IDENTIFIER '=' expression - { delete[]$1; - delete $3; - } - | PATHPULSE_IDENTIFIER '=' '(' expression ',' expression ')' - { delete[]$1; - delete $4; - delete $6; - } - ; + : IDENTIFIER '=' expression + { PExpr*tmp = $3; + pform_set_specparam(@1, lex_strings.make($1), specparam_active_range, tmp); + delete[]$1; + } + | IDENTIFIER '=' expression ':' expression ':' expression + { PExpr*tmp = 0; + switch (min_typ_max_flag) { + case MIN: + tmp = $3; + delete $5; + delete $7; + break; + case TYP: + delete $3; + tmp = $5; + delete $7; + break; + case MAX: + delete $3; + delete $5; + tmp = $7; + break; + } + if (min_typ_max_warn > 0) { + cerr << tmp->get_fileline() << ": warning: choosing "; + switch (min_typ_max_flag) { + case MIN: + cerr << "min"; + break; + case TYP: + cerr << "typ"; + break; + case MAX: + cerr << "max"; + break; + } + cerr << " expression." << endl; + min_typ_max_warn -= 1; + } + pform_set_specparam(@1, lex_strings.make($1), specparam_active_range, tmp); + delete[]$1; + } + | PATHPULSE_IDENTIFIER '=' expression + { delete[]$1; + delete $3; + } + | PATHPULSE_IDENTIFIER '=' '(' expression ',' expression ')' + { delete[]$1; + delete $4; + delete $6; + } + ; specparam_list : specparam @@ -6178,36 +6187,36 @@ specparam_decl ; spec_polarity - : '+' { $$ = '+'; } - | '-' { $$ = '-'; } - | { $$ = 0; } - ; + : '+' { $$ = '+'; } + | '-' { $$ = '-'; } + | { $$ = 0; } + ; spec_reference_event : K_posedge expression - { delete $2; } + { delete $2; } | K_negedge expression - { delete $2; } + { delete $2; } | K_posedge expr_primary K_TAND expression - { delete $2; - delete $4; - } + { delete $2; + delete $4; + } | K_negedge expr_primary K_TAND expression - { delete $2; - delete $4; - } + { delete $2; + delete $4; + } | K_edge '[' edge_descriptor_list ']' expr_primary - { delete $5; } + { delete $5; } | K_edge '[' edge_descriptor_list ']' expr_primary K_TAND expression - { delete $5; - delete $7; - } + { delete $5; + delete $7; + } | expr_primary K_TAND expression - { delete $1; - delete $3; - } + { delete $1; + delete $3; + } | expr_primary - { delete $1; } + { delete $1; } ; /* The edge_descriptor is detected by the lexor as the various @@ -6220,30 +6229,31 @@ edge_descriptor_list ; spec_notifier_opt - : /* empty */ - { } - | spec_notifier - { } - ; + : /* empty */ + { } + | spec_notifier + { } + ; spec_notifier - : ',' - { args_after_notifier = 0; } - | ',' hierarchy_identifier - { args_after_notifier = 0; delete $2; } - | spec_notifier ',' - { args_after_notifier += 1; } - | spec_notifier ',' hierarchy_identifier - { args_after_notifier += 1; - if (args_after_notifier >= 3) { - cerr << @3 << ": warning: timing checks are not supported " - "and delayed signal \"" << *$3 - << "\" will not be driven." << endl; - } - delete $3; } + : ',' + { args_after_notifier = 0; } + | ',' hierarchy_identifier + { args_after_notifier = 0; delete $2; } + | spec_notifier ',' + { args_after_notifier += 1; } + | spec_notifier ',' hierarchy_identifier + { args_after_notifier += 1; + if (args_after_notifier >= 3) { + cerr << @3 << ": warning: timing checks are not supported " + "and delayed signal \"" << *$3 + << "\" will not be driven." << endl; + } + delete $3; + } /* How do we match this path? */ - | IDENTIFIER - { args_after_notifier = 0; delete[]$1; } - ; + | IDENTIFIER + { args_after_notifier = 0; delete[]$1; } + ; subroutine_call : hierarchy_identifier argument_list_parens_opt @@ -6282,32 +6292,32 @@ statement_item /* This is roughly statement_item in the LRM */ off. This is stronger than any other assign, but weaker than the force assignments. */ - : K_assign lpvalue '=' expression ';' - { PCAssign*tmp = new PCAssign($2, $4); - FILE_NAME(tmp, @1); - $$ = tmp; - } + : K_assign lpvalue '=' expression ';' + { PCAssign*tmp = new PCAssign($2, $4); + FILE_NAME(tmp, @1); + $$ = tmp; + } - | K_deassign lpvalue ';' - { PDeassign*tmp = new PDeassign($2); - FILE_NAME(tmp, @1); - $$ = tmp; - } + | K_deassign lpvalue ';' + { PDeassign*tmp = new PDeassign($2); + FILE_NAME(tmp, @1); + $$ = tmp; + } /* Force and release statements are similar to assignments, syntactically, but they will be elaborated differently. */ - | K_force lpvalue '=' expression ';' - { PForce*tmp = new PForce($2, $4); - FILE_NAME(tmp, @1); - $$ = tmp; - } - | K_release lpvalue ';' - { PRelease*tmp = new PRelease($2); - FILE_NAME(tmp, @1); - $$ = tmp; - } + | K_force lpvalue '=' expression ';' + { PForce*tmp = new PForce($2, $4); + FILE_NAME(tmp, @1); + $$ = tmp; + } + | K_release lpvalue ';' + { PRelease*tmp = new PRelease($2); + FILE_NAME(tmp, @1); + $$ = tmp; + } /* begin-end blocks come in a variety of forms, including named and anonymous. The named blocks can also carry their own reg @@ -6322,28 +6332,28 @@ statement_item /* This is roughly statement_item in the LRM */ } block_item_decls_opt { if (!$2) { - if ($4) { - pform_requires_sv(@4, "Variable declaration in unnamed block"); - } else { - /* If there are no declarations in the scope then just delete it. */ - pform_pop_scope(); - assert(! current_block_stack.empty()); - PBlock*tmp = current_block_stack.top(); - current_block_stack.pop(); - delete tmp; - } + if ($4) { + pform_requires_sv(@4, "Variable declaration in unnamed block"); + } else { + /* If there are no declarations in the scope then just delete it. */ + pform_pop_scope(); + assert(! current_block_stack.empty()); + PBlock*tmp = current_block_stack.top(); + current_block_stack.pop(); + delete tmp; + } } } statement_or_null_list_opt K_end label_opt { PBlock*tmp; if ($2 || $4) { - pform_pop_scope(); - assert(! current_block_stack.empty()); - tmp = current_block_stack.top(); - current_block_stack.pop(); + pform_pop_scope(); + assert(! current_block_stack.empty()); + tmp = current_block_stack.top(); + current_block_stack.pop(); } else { - tmp = new PBlock(PBlock::BL_SEQ); - FILE_NAME(tmp, @1); + tmp = new PBlock(PBlock::BL_SEQ); + FILE_NAME(tmp, @1); } if ($6) tmp->set_statement(*$6); delete $6; @@ -6365,29 +6375,29 @@ statement_item /* This is roughly statement_item in the LRM */ block_item_decls_opt { if (!$2) { - if ($4) { - pform_requires_sv(@4, "Variable declaration in unnamed block"); - } else { - /* If there are no declarations in the scope then just delete it. */ - pform_pop_scope(); - assert(! current_block_stack.empty()); - PBlock*tmp = current_block_stack.top(); - current_block_stack.pop(); - delete tmp; - } + if ($4) { + pform_requires_sv(@4, "Variable declaration in unnamed block"); + } else { + /* If there are no declarations in the scope then just delete it. */ + pform_pop_scope(); + assert(! current_block_stack.empty()); + PBlock*tmp = current_block_stack.top(); + current_block_stack.pop(); + delete tmp; + } } } statement_or_null_list_opt join_keyword label_opt { PBlock*tmp; if ($2 || $4) { - pform_pop_scope(); - assert(! current_block_stack.empty()); - tmp = current_block_stack.top(); - current_block_stack.pop(); - tmp->set_join_type($7); + pform_pop_scope(); + assert(! current_block_stack.empty()); + tmp = current_block_stack.top(); + current_block_stack.pop(); + tmp->set_join_type($7); } else { - tmp = new PBlock($7); - FILE_NAME(tmp, @1); + tmp = new PBlock($7); + FILE_NAME(tmp, @1); } if ($6) tmp->set_statement(*$6); delete $6; @@ -6396,18 +6406,18 @@ statement_item /* This is roughly statement_item in the LRM */ $$ = tmp; } - | K_disable hierarchy_identifier ';' - { PDisable*tmp = new PDisable(*$2); - FILE_NAME(tmp, @1); - delete $2; - $$ = tmp; - } - | K_disable K_fork ';' - { pform_name_t tmp_name; - PDisable*tmp = new PDisable(tmp_name); - FILE_NAME(tmp, @1); - $$ = tmp; - } + | K_disable hierarchy_identifier ';' + { PDisable*tmp = new PDisable(*$2); + FILE_NAME(tmp, @1); + delete $2; + $$ = tmp; + } + | K_disable K_fork ';' + { pform_name_t tmp_name; + PDisable*tmp = new PDisable(tmp_name); + FILE_NAME(tmp, @1); + $$ = tmp; + } | K_TRIGGER hierarchy_identifier ';' { PTrigger*tmp = pform_new_trigger(@2, 0, *$2); delete $2; @@ -6443,11 +6453,14 @@ statement_item /* This is roughly statement_item in the LRM */ yywarn(@1, "Sorry: ->> with repeat event control is not currently supported."); } - | procedural_assertion_statement { $$ = $1; } + | procedural_assertion_statement + { $$ = $1; } - | loop_statement { $$ = $1; } + | loop_statement + { $$ = $1; } - | jump_statement { $$ = $1; } + | jump_statement + { $$ = $1; } | unique_priority K_case '(' expression ')' case_items K_endcase { PCase*tmp = new PCase($1, NetCase::EQ, $4, $6); @@ -6471,24 +6484,24 @@ statement_item /* This is roughly statement_item in the LRM */ | unique_priority K_casez '(' expression ')' error K_endcase { yyerrok; } - | K_if '(' expression ')' statement_or_null %prec less_than_K_else - { PCondit*tmp = new PCondit($3, $5, 0); - FILE_NAME(tmp, @1); - $$ = tmp; - } - | K_if '(' expression ')' statement_or_null K_else statement_or_null - { PCondit*tmp = new PCondit($3, $5, $7); - FILE_NAME(tmp, @1); - $$ = tmp; - } - | K_if '(' error ')' statement_or_null %prec less_than_K_else - { yyerror(@1, "error: Malformed conditional expression."); - $$ = $5; - } - | K_if '(' error ')' statement_or_null K_else statement_or_null - { yyerror(@1, "error: Malformed conditional expression."); - $$ = $5; - } + | K_if '(' expression ')' statement_or_null %prec less_than_K_else + { PCondit*tmp = new PCondit($3, $5, 0); + FILE_NAME(tmp, @1); + $$ = tmp; + } + | K_if '(' expression ')' statement_or_null K_else statement_or_null + { PCondit*tmp = new PCondit($3, $5, $7); + FILE_NAME(tmp, @1); + $$ = tmp; + } + | K_if '(' error ')' statement_or_null %prec less_than_K_else + { yyerror(@1, "error: Malformed conditional expression."); + $$ = $5; + } + | K_if '(' error ')' statement_or_null K_else statement_or_null + { yyerror(@1, "error: Malformed conditional expression."); + $$ = $5; + } /* SystemVerilog adds the compressed_statement */ | compressed_statement ';' @@ -6612,19 +6625,19 @@ statement_item /* This is roughly statement_item in the LRM */ $$ = tmp; } - | K_wait '(' expression ')' statement_or_null - { PEventStatement*tmp; - PEEvent*etmp = new PEEvent(PEEvent::POSITIVE, $3); - tmp = new PEventStatement(etmp); - FILE_NAME(tmp,@1); - tmp->set_statement($5); - $$ = tmp; - } - | K_wait K_fork ';' - { PEventStatement*tmp = new PEventStatement((PEEvent*)0); - FILE_NAME(tmp,@1); - $$ = tmp; - } + | K_wait '(' expression ')' statement_or_null + { PEventStatement*tmp; + PEEvent*etmp = new PEEvent(PEEvent::POSITIVE, $3); + tmp = new PEventStatement(etmp); + FILE_NAME(tmp,@1); + tmp->set_statement($5); + $$ = tmp; + } + | K_wait K_fork ';' + { PEventStatement*tmp = new PEventStatement((PEEvent*)0); + FILE_NAME(tmp,@1); + $$ = tmp; + } | K_void '\'' '(' subroutine_call ')' ';' { $4->void_cast(); $$ = $4; @@ -6660,7 +6673,7 @@ statement_item /* This is roughly statement_item in the LRM */ { PChainConstructor*tmp = new PChainConstructor(*$4); FILE_NAME(tmp, @3); if (peek_head_name(*$1) == THIS_TOKEN) { - yyerror(@1, "error: this.new is invalid syntax. Did you mean super.new?"); + yyerror(@1, "error: this.new is invalid syntax. Did you mean super.new?"); } delete $1; $$ = tmp; @@ -6695,7 +6708,6 @@ compressed_statement } ; - statement_or_null_list_opt : statement_or_null_list { $$ = $1; } @@ -6723,7 +6735,7 @@ analog_statement tf_port_list_opt : tf_port_list { $$ = $1; } - | { $$ = 0; } + | { $$ = 0; } ; /* A task or function prototype can be declared with the task/function name @@ -6731,7 +6743,7 @@ tf_port_list_opt * itself. When a port list is used it might be empty. */ tf_port_list_parens_opt : '(' tf_port_list_opt ')' { $$ = $2; } - | { $$ = 0; } + | { $$ = 0; } /* Note that the lexor notices the "table" keyword and starts the UDPTABLE state. It needs to happen there so that all the @@ -6756,135 +6768,141 @@ udp_body ; udp_entry_list - : udp_comb_entry_list - | udp_sequ_entry_list - ; + : udp_comb_entry_list + | udp_sequ_entry_list + ; udp_comb_entry - : udp_input_list ':' udp_output_sym ';' - { char*tmp = new char[strlen($1)+3]; - strcpy(tmp, $1); - char*tp = tmp+strlen(tmp); - *tp++ = ':'; - *tp++ = $3; - *tp++ = 0; - delete[]$1; - $$ = tmp; - } - ; + : udp_input_list ':' udp_output_sym ';' + { char*tmp = new char[strlen($1)+3]; + strcpy(tmp, $1); + char*tp = tmp+strlen(tmp); + *tp++ = ':'; + *tp++ = $3; + *tp++ = 0; + delete[]$1; + $$ = tmp; + } + ; udp_comb_entry_list - : udp_comb_entry - { std::list*tmp = new std::list; - tmp->push_back($1); - delete[]$1; - $$ = tmp; - } - | udp_comb_entry_list udp_comb_entry - { std::list*tmp = $1; - tmp->push_back($2); - delete[]$2; - $$ = tmp; - } - ; + : udp_comb_entry + { std::list*tmp = new std::list; + tmp->push_back($1); + delete[]$1; + $$ = tmp; + } + | udp_comb_entry_list udp_comb_entry + { std::list*tmp = $1; + tmp->push_back($2); + delete[]$2; + $$ = tmp; + } + ; udp_sequ_entry_list - : udp_sequ_entry - { std::list*tmp = new std::list; - tmp->push_back($1); - delete[]$1; - $$ = tmp; - } - | udp_sequ_entry_list udp_sequ_entry - { std::list*tmp = $1; - tmp->push_back($2); - delete[]$2; - $$ = tmp; - } - ; + : udp_sequ_entry + { std::list*tmp = new std::list; + tmp->push_back($1); + delete[]$1; + $$ = tmp; + } + | udp_sequ_entry_list udp_sequ_entry + { std::list*tmp = $1; + tmp->push_back($2); + delete[]$2; + $$ = tmp; + } + ; udp_sequ_entry - : udp_input_list ':' udp_input_sym ':' udp_output_sym ';' - { char*tmp = new char[strlen($1)+5]; - strcpy(tmp, $1); - char*tp = tmp+strlen(tmp); - *tp++ = ':'; - *tp++ = $3; - *tp++ = ':'; - *tp++ = $5; - *tp++ = 0; - $$ = tmp; - } - ; + : udp_input_list ':' udp_input_sym ':' udp_output_sym ';' + { char*tmp = new char[strlen($1)+5]; + strcpy(tmp, $1); + char*tp = tmp+strlen(tmp); + *tp++ = ':'; + *tp++ = $3; + *tp++ = ':'; + *tp++ = $5; + *tp++ = 0; + $$ = tmp; + } + ; udp_initial - : K_initial IDENTIFIER '=' number ';' - { PExpr*etmp = new PENumber($4); - PEIdent*itmp = new PEIdent(lex_strings.make($2)); - PAssign*atmp = new PAssign(itmp, etmp); - FILE_NAME(atmp, @2); - delete[]$2; - $$ = atmp; - } - ; + : K_initial IDENTIFIER '=' number ';' + { PExpr*etmp = new PENumber($4); + PEIdent*itmp = new PEIdent(lex_strings.make($2)); + PAssign*atmp = new PAssign(itmp, etmp); + FILE_NAME(atmp, @2); + delete[]$2; + $$ = atmp; + } + ; udp_init_opt - : udp_initial { $$ = $1; } - | { $$ = 0; } - ; + : udp_initial { $$ = $1; } + | { $$ = 0; } + ; udp_input_list - : udp_input_sym - { char*tmp = new char[2]; - tmp[0] = $1; - tmp[1] = 0; - $$ = tmp; - } - | udp_input_list udp_input_sym - { char*tmp = new char[strlen($1)+2]; - strcpy(tmp, $1); - char*tp = tmp+strlen(tmp); - *tp++ = $2; - *tp++ = 0; - delete[]$1; - $$ = tmp; - } - ; + : udp_input_sym + { char*tmp = new char[2]; + tmp[0] = $1; + tmp[1] = 0; + $$ = tmp; + } + | udp_input_list udp_input_sym + { char*tmp = new char[strlen($1)+2]; + strcpy(tmp, $1); + char*tp = tmp+strlen(tmp); + *tp++ = $2; + *tp++ = 0; + delete[]$1; + $$ = tmp; + } + ; udp_input_sym - : '0' { $$ = '0'; } - | '1' { $$ = '1'; } - | 'x' { $$ = 'x'; } - | '?' { $$ = '?'; } - | 'b' { $$ = 'b'; } - | '*' { $$ = '*'; } - | '%' { $$ = '%'; } - | 'f' { $$ = 'f'; } - | 'F' { $$ = 'F'; } - | 'l' { $$ = 'l'; } - | 'h' { $$ = 'h'; } - | 'B' { $$ = 'B'; } - | 'r' { $$ = 'r'; } - | 'R' { $$ = 'R'; } - | 'M' { $$ = 'M'; } - | 'n' { $$ = 'n'; } - | 'N' { $$ = 'N'; } - | 'p' { $$ = 'p'; } - | 'P' { $$ = 'P'; } - | 'Q' { $$ = 'Q'; } - | 'q' { $$ = 'q'; } - | '_' { $$ = '_'; } - | '+' { $$ = '+'; } - | DEC_NUMBER { yyerror(@1, "internal error: Input digits parse as decimal number!"); $$ = '0'; } - ; + : '0' { $$ = '0'; } + | '1' { $$ = '1'; } + | 'x' { $$ = 'x'; } + | '?' { $$ = '?'; } + | 'b' { $$ = 'b'; } + | '*' { $$ = '*'; } + | '%' { $$ = '%'; } + | 'f' { $$ = 'f'; } + | 'F' { $$ = 'F'; } + | 'l' { $$ = 'l'; } + | 'h' { $$ = 'h'; } + | 'B' { $$ = 'B'; } + | 'r' { $$ = 'r'; } + | 'R' { $$ = 'R'; } + | 'M' { $$ = 'M'; } + | 'n' { $$ = 'n'; } + | 'N' { $$ = 'N'; } + | 'p' { $$ = 'p'; } + | 'P' { $$ = 'P'; } + | 'Q' { $$ = 'Q'; } + | 'q' { $$ = 'q'; } + | '_' { $$ = '_'; } + | '+' { $$ = '+'; } + | DEC_NUMBER + { yyerror(@1, "internal error: Input digits parse as decimal number!"); + $$ = '0'; + } + ; udp_output_sym - : '0' { $$ = '0'; } - | '1' { $$ = '1'; } - | 'x' { $$ = 'x'; } - | '-' { $$ = '-'; } - | DEC_NUMBER { yyerror(@1, "internal error: Output digits parse as decimal number!"); $$ = '0'; } - ; + : '0' { $$ = '0'; } + | '1' { $$ = '1'; } + | 'x' { $$ = 'x'; } + | '-' { $$ = '-'; } + | DEC_NUMBER + { yyerror(@1, "internal error: Output digits parse as decimal number!"); + $$ = '0'; + } + ; /* Port declarations create wires for the inputs and the output. The makes for these ports are scoped within the UDP, so there is no @@ -6947,57 +6965,57 @@ udp_port_list } ; -udp_reg_opt: K_reg { $$ = true; } | { $$ = false; }; +udp_reg_opt + : K_reg { $$ = true; } + | { $$ = false; }; udp_input_declaration_list - : K_input IDENTIFIER - { std::list*tmp = new std::list; - tmp->push_back(lex_strings.make($2)); - $$ = tmp; - delete[]$2; - } - | udp_input_declaration_list ',' K_input IDENTIFIER - { std::list*tmp = $1; - tmp->push_back(lex_strings.make($4)); - $$ = tmp; - delete[]$4; - } - ; + : K_input IDENTIFIER + { std::list*tmp = new std::list; + tmp->push_back(lex_strings.make($2)); + $$ = tmp; + delete[]$2; + } + | udp_input_declaration_list ',' K_input IDENTIFIER + { std::list*tmp = $1; + tmp->push_back(lex_strings.make($4)); + $$ = tmp; + delete[]$4; + } + ; udp_primitive /* This is the syntax for primitives that uses the IEEE1364-1995 format. The ports are simply names in the port list, and the declarations are in the body. */ - : K_primitive IDENTIFIER '(' udp_port_list ')' ';' - udp_port_decls - udp_init_opt - udp_body - K_endprimitive label_opt - - { perm_string tmp2 = lex_strings.make($2); - pform_make_udp(@2, tmp2, $4, $7, $9, $8); - check_end_label(@11, "primitive", $2, $11); - delete[]$2; - } + : K_primitive IDENTIFIER '(' udp_port_list ')' ';' + udp_port_decls + udp_init_opt + udp_body + K_endprimitive label_opt + { perm_string tmp2 = lex_strings.make($2); + pform_make_udp(@2, tmp2, $4, $7, $9, $8); + check_end_label(@11, "primitive", $2, $11); + delete[]$2; + } /* This is the syntax for IEEE1364-2001 format definitions. The port names and declarations are all in the parameter list. */ - | K_primitive IDENTIFIER - '(' K_output udp_reg_opt IDENTIFIER initializer_opt ',' - udp_input_declaration_list ')' ';' - udp_body - K_endprimitive label_opt - - { perm_string tmp2 = lex_strings.make($2); - perm_string tmp6 = lex_strings.make($6); - pform_make_udp(@2, tmp2, $5, tmp6, $7, $9, $12); - check_end_label(@14, "primitive", $2, $14); - delete[]$2; - delete[]$6; - } - ; + | K_primitive IDENTIFIER + '(' K_output udp_reg_opt IDENTIFIER initializer_opt ',' + udp_input_declaration_list ')' ';' + udp_body + K_endprimitive label_opt + { perm_string tmp2 = lex_strings.make($2); + perm_string tmp6 = lex_strings.make($6); + pform_make_udp(@2, tmp2, $5, tmp6, $7, $9, $12); + check_end_label(@14, "primitive", $2, $14); + delete[]$2; + delete[]$6; + } + ; unique_priority : { $$ = IVL_CASE_QUALITY_BASIC; } @@ -7010,7 +7028,22 @@ unique_priority presence is significant. This is a fairly common pattern so collect those rules here. */ -K_genvar_opt : K_genvar { $$ = true; } | { $$ = false; } ; -K_static_opt : K_static { $$ = true; } | { $$ = false; } ; -K_virtual_opt : K_virtual { $$ = true; } | { $$ = false; } ; -K_var_opt : K_var | ; +K_genvar_opt + : K_genvar { $$ = true; } + | { $$ = false; } + ; + +K_static_opt + : K_static { $$ = true; } + | { $$ = false; } + ; + +K_virtual_opt + : K_virtual { $$ = true; } + | { $$ = false; } + ; + +K_var_opt + : K_var + | + ; From a56ccabf7fdd800d873929a6ba701928ca030222 Mon Sep 17 00:00:00 2001 From: Martin Whitaker Date: Thu, 22 Dec 2022 10:08:31 +0000 Subject: [PATCH 2/8] Use consistent format for compiler parser error messages. Always prefix with "error: " or "sorry: ". Capitalise the first word of the main message unless it's a Verilog keyword. --- ivtest/gold/br1027a.gold | 4 +- ivtest/gold/br1027c.gold | 2 +- ivtest/gold/br1027e.gold | 2 +- ivtest/gold/br_gh79.gold | 16 +++---- ivtest/gold/pr3366217d.gold | 44 +++++++++---------- ivtest/gold/struct_invalid_member.gold | 8 ++-- ivtest/gold/sv_end_labels_unnamed.gold | 6 +-- ivtest/gold/sv_timeunit_prec_fail1.gold | 40 +++++++++--------- ivtest/gold/sv_timeunit_prec_fail2.gold | 40 +++++++++--------- parse.y | 50 +++++++++++----------- pform.cc | 56 +++++++++++++------------ pform_package.cc | 4 +- 12 files changed, 137 insertions(+), 135 deletions(-) diff --git a/ivtest/gold/br1027a.gold b/ivtest/gold/br1027a.gold index dc6440404..f36904c5c 100644 --- a/ivtest/gold/br1027a.gold +++ b/ivtest/gold/br1027a.gold @@ -1,2 +1,2 @@ -./ivltests/br1027a.v:1: error: missing task/function port direction. -./ivltests/br1027a.v:1: error: missing task/function port direction. +./ivltests/br1027a.v:1: error: Missing task/function port direction. +./ivltests/br1027a.v:1: error: Missing task/function port direction. diff --git a/ivtest/gold/br1027c.gold b/ivtest/gold/br1027c.gold index 80d6309f4..8a77a84d7 100644 --- a/ivtest/gold/br1027c.gold +++ b/ivtest/gold/br1027c.gold @@ -1 +1 @@ -./ivltests/br1027c.v:1: error: missing task/function port direction. +./ivltests/br1027c.v:1: error: Missing task/function port direction. diff --git a/ivtest/gold/br1027e.gold b/ivtest/gold/br1027e.gold index 39b8bbdb1..0fd2f25cd 100644 --- a/ivtest/gold/br1027e.gold +++ b/ivtest/gold/br1027e.gold @@ -1 +1 @@ -./ivltests/br1027e.v:1: error: missing task/function port direction. +./ivltests/br1027e.v:1: error: Missing task/function port direction. diff --git a/ivtest/gold/br_gh79.gold b/ivtest/gold/br_gh79.gold index 8f510dc1c..3b6dc8e58 100644 --- a/ivtest/gold/br_gh79.gold +++ b/ivtest/gold/br_gh79.gold @@ -1,16 +1,16 @@ ./ivltests/br_gh79.v:6: syntax error -./ivltests/br_gh79.v:6: error: malformed statement +./ivltests/br_gh79.v:6: error: Malformed statement ./ivltests/br_gh79.v:7: syntax error -./ivltests/br_gh79.v:7: error: malformed statement +./ivltests/br_gh79.v:7: error: Malformed statement ./ivltests/br_gh79.v:9: syntax error -./ivltests/br_gh79.v:9: error: malformed statement +./ivltests/br_gh79.v:9: error: Malformed statement ./ivltests/br_gh79.v:10: syntax error -./ivltests/br_gh79.v:10: error: malformed statement +./ivltests/br_gh79.v:10: error: Malformed statement ./ivltests/br_gh79.v:12: syntax error -./ivltests/br_gh79.v:12: error: malformed statement +./ivltests/br_gh79.v:12: error: Malformed statement ./ivltests/br_gh79.v:13: syntax error -./ivltests/br_gh79.v:13: error: malformed statement +./ivltests/br_gh79.v:13: error: Malformed statement ./ivltests/br_gh79.v:15: syntax error -./ivltests/br_gh79.v:15: error: malformed statement +./ivltests/br_gh79.v:15: error: Malformed statement ./ivltests/br_gh79.v:16: syntax error -./ivltests/br_gh79.v:16: error: malformed statement +./ivltests/br_gh79.v:16: error: Malformed statement diff --git a/ivtest/gold/pr3366217d.gold b/ivtest/gold/pr3366217d.gold index 2c8f41971..08d576716 100644 --- a/ivtest/gold/pr3366217d.gold +++ b/ivtest/gold/pr3366217d.gold @@ -1,22 +1,22 @@ -./ivltests/pr3366217d.v:3: error: undefined value used in enum name sequence. -./ivltests/pr3366217d.v:4: error: undefined value used in enum name sequence. -./ivltests/pr3366217d.v:5: error: undefined value used in enum name sequence. -./ivltests/pr3366217d.v:6: error: undefined value used in enum name sequence. -./ivltests/pr3366217d.v:6: error: undefined value used in enum name sequence. -./ivltests/pr3366217d.v:7: error: undefined value used in enum name sequence. -./ivltests/pr3366217d.v:8: error: undefined value used in enum name sequence. -./ivltests/pr3366217d.v:9: error: undefined value used in enum name sequence. -./ivltests/pr3366217d.v:10: error: undefined value used in enum name sequence. -./ivltests/pr3366217d.v:10: error: undefined value used in enum name sequence. -./ivltests/pr3366217d.v:13: error: zero count used in enum name sequence. -./ivltests/pr3366217d.v:14: error: zero count used in enum name sequence. -./ivltests/pr3366217d.v:17: error: negative value used in enum name sequence. -./ivltests/pr3366217d.v:18: error: negative value used in enum name sequence. -./ivltests/pr3366217d.v:19: error: negative value used in enum name sequence. -./ivltests/pr3366217d.v:20: error: negative value used in enum name sequence. -./ivltests/pr3366217d.v:20: error: negative value used in enum name sequence. -./ivltests/pr3366217d.v:21: error: negative value used in enum name sequence. -./ivltests/pr3366217d.v:22: error: negative value used in enum name sequence. -./ivltests/pr3366217d.v:23: error: negative value used in enum name sequence. -./ivltests/pr3366217d.v:24: error: negative value used in enum name sequence. -./ivltests/pr3366217d.v:24: error: negative value used in enum name sequence. +./ivltests/pr3366217d.v:3: error: Undefined value used in enum name sequence. +./ivltests/pr3366217d.v:4: error: Undefined value used in enum name sequence. +./ivltests/pr3366217d.v:5: error: Undefined value used in enum name sequence. +./ivltests/pr3366217d.v:6: error: Undefined value used in enum name sequence. +./ivltests/pr3366217d.v:6: error: Undefined value used in enum name sequence. +./ivltests/pr3366217d.v:7: error: Undefined value used in enum name sequence. +./ivltests/pr3366217d.v:8: error: Undefined value used in enum name sequence. +./ivltests/pr3366217d.v:9: error: Undefined value used in enum name sequence. +./ivltests/pr3366217d.v:10: error: Undefined value used in enum name sequence. +./ivltests/pr3366217d.v:10: error: Undefined value used in enum name sequence. +./ivltests/pr3366217d.v:13: error: Zero count used in enum name sequence. +./ivltests/pr3366217d.v:14: error: Zero count used in enum name sequence. +./ivltests/pr3366217d.v:17: error: Negative value used in enum name sequence. +./ivltests/pr3366217d.v:18: error: Negative value used in enum name sequence. +./ivltests/pr3366217d.v:19: error: Negative value used in enum name sequence. +./ivltests/pr3366217d.v:20: error: Negative value used in enum name sequence. +./ivltests/pr3366217d.v:20: error: Negative value used in enum name sequence. +./ivltests/pr3366217d.v:21: error: Negative value used in enum name sequence. +./ivltests/pr3366217d.v:22: error: Negative value used in enum name sequence. +./ivltests/pr3366217d.v:23: error: Negative value used in enum name sequence. +./ivltests/pr3366217d.v:24: error: Negative value used in enum name sequence. +./ivltests/pr3366217d.v:24: error: Negative value used in enum name sequence. diff --git a/ivtest/gold/struct_invalid_member.gold b/ivtest/gold/struct_invalid_member.gold index 6fce735b8..166601db0 100644 --- a/ivtest/gold/struct_invalid_member.gold +++ b/ivtest/gold/struct_invalid_member.gold @@ -1,8 +1,8 @@ ./ivltests/struct_invalid_member.v:9: syntax error -./ivltests/struct_invalid_member.v:9: Error in struct/union member. +./ivltests/struct_invalid_member.v:9: error: Error in struct/union member. ./ivltests/struct_invalid_member.v:10: syntax error -./ivltests/struct_invalid_member.v:10: Error in struct/union member. +./ivltests/struct_invalid_member.v:10: error: Error in struct/union member. ./ivltests/struct_invalid_member.v:11: syntax error -./ivltests/struct_invalid_member.v:11: Error in struct/union member. +./ivltests/struct_invalid_member.v:11: error: Error in struct/union member. ./ivltests/struct_invalid_member.v:12: syntax error -./ivltests/struct_invalid_member.v:12: Error in struct/union member. +./ivltests/struct_invalid_member.v:12: error: Error in struct/union member. diff --git a/ivtest/gold/sv_end_labels_unnamed.gold b/ivtest/gold/sv_end_labels_unnamed.gold index 2979cbbc3..32f53a3a5 100644 --- a/ivtest/gold/sv_end_labels_unnamed.gold +++ b/ivtest/gold/sv_end_labels_unnamed.gold @@ -1,3 +1,3 @@ -./ivltests/sv_end_labels_unnamed.v:7: error: unnamed block must not have end label. -./ivltests/sv_end_labels_unnamed.v:11: error: unnamed block must not have end label. -./ivltests/sv_end_labels_unnamed.v:14: error: unnamed fork must not have end label. +./ivltests/sv_end_labels_unnamed.v:7: error: Unnamed block must not have end label. +./ivltests/sv_end_labels_unnamed.v:11: error: Unnamed block must not have end label. +./ivltests/sv_end_labels_unnamed.v:14: error: Unnamed fork must not have end label. diff --git a/ivtest/gold/sv_timeunit_prec_fail1.gold b/ivtest/gold/sv_timeunit_prec_fail1.gold index 398fd2552..30682f076 100644 --- a/ivtest/gold/sv_timeunit_prec_fail1.gold +++ b/ivtest/gold/sv_timeunit_prec_fail1.gold @@ -1,20 +1,20 @@ -./ivltests/sv_timeunit_prec_fail1a.v:9: error: repeat timeunit does not match the initial timeunit for this scope. -./ivltests/sv_timeunit_prec_fail1a.v:10: error: repeat timeprecision does not match the initial timeprecision for this scope. -./ivltests/sv_timeunit_prec_fail1a.v:15: error: repeat timeunit does not match the initial timeunit for this scope. -./ivltests/sv_timeunit_prec_fail1a.v:21: error: repeat timeprecision does not match the initial timeprecision for this scope. -./ivltests/sv_timeunit_prec_fail1a.v:27: error: repeat timeunit found and the initial timeunit for this scope is missing. -./ivltests/sv_timeunit_prec_fail1a.v:33: error: repeat timeprecision found and the initial timeprecision for this scope is missing. -./ivltests/sv_timeunit_prec_fail1a.v:40: error: repeat timeprecision found and the initial timeprecision for this scope is missing. -./ivltests/sv_timeunit_prec_fail1a.v:47: error: repeat timeunit found and the initial timeunit for this scope is missing. -./ivltests/sv_timeunit_prec_fail1a.v:53: Invalid timeunit constant (1st digit). -./ivltests/sv_timeunit_prec_fail1a.v:54: Invalid timeprecision constant (1st digit). -./ivltests/sv_timeunit_prec_fail1a.v:56: Invalid timeunit constant (number of zeros). -./ivltests/sv_timeunit_prec_fail1a.v:57: Invalid timeprecision constant (number of zeros). -./ivltests/sv_timeunit_prec_fail1a.v:59: Invalid timeunit scale '2s'. -./ivltests/sv_timeunit_prec_fail1a.v:60: Invalid timeprecision scale '2s'. -./ivltests/sv_timeunit_prec_fail1a.v:63: Invalid timeunit constant ('_' is not supported). -./ivltests/sv_timeunit_prec_fail1a.v:64: Invalid timeprecision constant ('_' is not supported). -./ivltests/sv_timeunit_prec_fail1b.v:4: error: a timeprecision is missing or is too large! -./ivltests/sv_timeunit_prec_fail1c.v:4: error: a timeprecision is missing or is too large! -./ivltests/sv_timeunit_prec_fail1d.v:5: error: a timeprecision is missing or is too large! -./ivltests/sv_timeunit_prec_fail1e.v:5: error: a timeprecision is missing or is too large! +./ivltests/sv_timeunit_prec_fail1a.v:9: error: Repeat timeunit does not match the initial timeunit for this scope. +./ivltests/sv_timeunit_prec_fail1a.v:10: error: Repeat timeprecision does not match the initial timeprecision for this scope. +./ivltests/sv_timeunit_prec_fail1a.v:15: error: Repeat timeunit does not match the initial timeunit for this scope. +./ivltests/sv_timeunit_prec_fail1a.v:21: error: Repeat timeprecision does not match the initial timeprecision for this scope. +./ivltests/sv_timeunit_prec_fail1a.v:27: error: Repeat timeunit found and the initial timeunit for this scope is missing. +./ivltests/sv_timeunit_prec_fail1a.v:33: error: Repeat timeprecision found and the initial timeprecision for this scope is missing. +./ivltests/sv_timeunit_prec_fail1a.v:40: error: Repeat timeprecision found and the initial timeprecision for this scope is missing. +./ivltests/sv_timeunit_prec_fail1a.v:47: error: Repeat timeunit found and the initial timeunit for this scope is missing. +./ivltests/sv_timeunit_prec_fail1a.v:53: error: Invalid timeunit constant (1st digit). +./ivltests/sv_timeunit_prec_fail1a.v:54: error: Invalid timeprecision constant (1st digit). +./ivltests/sv_timeunit_prec_fail1a.v:56: error: Invalid timeunit constant (number of zeros). +./ivltests/sv_timeunit_prec_fail1a.v:57: error: Invalid timeprecision constant (number of zeros). +./ivltests/sv_timeunit_prec_fail1a.v:59: error: Invalid timeunit scale '2s'. +./ivltests/sv_timeunit_prec_fail1a.v:60: error: Invalid timeprecision scale '2s'. +./ivltests/sv_timeunit_prec_fail1a.v:63: error: Invalid timeunit constant ('_' is not supported). +./ivltests/sv_timeunit_prec_fail1a.v:64: error: Invalid timeprecision constant ('_' is not supported). +./ivltests/sv_timeunit_prec_fail1b.v:4: error: A timeprecision is missing or is too large! +./ivltests/sv_timeunit_prec_fail1c.v:4: error: A timeprecision is missing or is too large! +./ivltests/sv_timeunit_prec_fail1d.v:5: error: A timeprecision is missing or is too large! +./ivltests/sv_timeunit_prec_fail1e.v:5: error: A timeprecision is missing or is too large! diff --git a/ivtest/gold/sv_timeunit_prec_fail2.gold b/ivtest/gold/sv_timeunit_prec_fail2.gold index 7ccd2b8aa..3e4323eab 100644 --- a/ivtest/gold/sv_timeunit_prec_fail2.gold +++ b/ivtest/gold/sv_timeunit_prec_fail2.gold @@ -1,20 +1,20 @@ -./ivltests/sv_timeunit_prec_fail2a.v:8: error: repeat timeunit does not match the initial timeunit for this scope. -./ivltests/sv_timeunit_prec_fail2a.v:8: error: repeat timeprecision does not match the initial timeprecision for this scope. -./ivltests/sv_timeunit_prec_fail2a.v:13: error: repeat timeunit does not match the initial timeunit for this scope. -./ivltests/sv_timeunit_prec_fail2a.v:13: error: repeat timeprecision does not match the initial timeprecision for this scope. -./ivltests/sv_timeunit_prec_fail2a.v:14: error: repeat timeunit does not match the initial timeunit for this scope. -./ivltests/sv_timeunit_prec_fail2a.v:15: error: repeat timeprecision does not match the initial timeprecision for this scope. -./ivltests/sv_timeunit_prec_fail2a.v:21: error: repeat timeunit found and the initial timeunit for this scope is missing. -./ivltests/sv_timeunit_prec_fail2a.v:21: error: repeat timeprecision found and the initial timeprecision for this scope is missing. -./ivltests/sv_timeunit_prec_fail2a.v:27: error: repeat timeprecision found and the initial timeprecision for this scope is missing. -./ivltests/sv_timeunit_prec_fail2a.v:33: error: repeat timeunit found and the initial timeunit for this scope is missing. -./ivltests/sv_timeunit_prec_fail2a.v:39: Invalid timeunit constant (1st digit). -./ivltests/sv_timeunit_prec_fail2a.v:39: Invalid timeprecision constant (1st digit). -./ivltests/sv_timeunit_prec_fail2a.v:41: Invalid timeunit constant (number of zeros). -./ivltests/sv_timeunit_prec_fail2a.v:41: Invalid timeprecision constant (number of zeros). -./ivltests/sv_timeunit_prec_fail2a.v:43: Invalid timeunit scale '2s'. -./ivltests/sv_timeunit_prec_fail2a.v:43: Invalid timeprecision scale '2s'. -./ivltests/sv_timeunit_prec_fail2a.v:46: Invalid timeunit constant ('_' is not supported). -./ivltests/sv_timeunit_prec_fail2a.v:46: Invalid timeprecision constant ('_' is not supported). -./ivltests/sv_timeunit_prec_fail2b.v:4: error: a timeprecision is missing or is too large! -./ivltests/sv_timeunit_prec_fail2c.v:5: error: a timeprecision is missing or is too large! +./ivltests/sv_timeunit_prec_fail2a.v:8: error: Repeat timeunit does not match the initial timeunit for this scope. +./ivltests/sv_timeunit_prec_fail2a.v:8: error: Repeat timeprecision does not match the initial timeprecision for this scope. +./ivltests/sv_timeunit_prec_fail2a.v:13: error: Repeat timeunit does not match the initial timeunit for this scope. +./ivltests/sv_timeunit_prec_fail2a.v:13: error: Repeat timeprecision does not match the initial timeprecision for this scope. +./ivltests/sv_timeunit_prec_fail2a.v:14: error: Repeat timeunit does not match the initial timeunit for this scope. +./ivltests/sv_timeunit_prec_fail2a.v:15: error: Repeat timeprecision does not match the initial timeprecision for this scope. +./ivltests/sv_timeunit_prec_fail2a.v:21: error: Repeat timeunit found and the initial timeunit for this scope is missing. +./ivltests/sv_timeunit_prec_fail2a.v:21: error: Repeat timeprecision found and the initial timeprecision for this scope is missing. +./ivltests/sv_timeunit_prec_fail2a.v:27: error: Repeat timeprecision found and the initial timeprecision for this scope is missing. +./ivltests/sv_timeunit_prec_fail2a.v:33: error: Repeat timeunit found and the initial timeunit for this scope is missing. +./ivltests/sv_timeunit_prec_fail2a.v:39: error: Invalid timeunit constant (1st digit). +./ivltests/sv_timeunit_prec_fail2a.v:39: error: Invalid timeprecision constant (1st digit). +./ivltests/sv_timeunit_prec_fail2a.v:41: error: Invalid timeunit constant (number of zeros). +./ivltests/sv_timeunit_prec_fail2a.v:41: error: Invalid timeprecision constant (number of zeros). +./ivltests/sv_timeunit_prec_fail2a.v:43: error: Invalid timeunit scale '2s'. +./ivltests/sv_timeunit_prec_fail2a.v:43: error: Invalid timeprecision scale '2s'. +./ivltests/sv_timeunit_prec_fail2a.v:46: error: Invalid timeunit constant ('_' is not supported). +./ivltests/sv_timeunit_prec_fail2a.v:46: error: Invalid timeprecision constant ('_' is not supported). +./ivltests/sv_timeunit_prec_fail2b.v:4: error: A timeprecision is missing or is too large! +./ivltests/sv_timeunit_prec_fail2c.v:5: error: A timeprecision is missing or is too large! diff --git a/parse.y b/parse.y index d84f204d7..8da3e535b 100644 --- a/parse.y +++ b/parse.y @@ -250,16 +250,16 @@ static long check_enum_seq_value(const YYLTYPE&loc, verinum *arg, bool zero_ok) // We can never have an undefined value in an enumeration name // declaration sequence. if (! arg->is_defined()) { - yyerror(loc, "error: undefined value used in enum name sequence."); + yyerror(loc, "error: Undefined value used in enum name sequence."); // We can never have a negative value in an enumeration name // declaration sequence. } else if (arg->is_negative()) { - yyerror(loc, "error: negative value used in enum name sequence."); + yyerror(loc, "error: Negative value used in enum name sequence."); } else { value = arg->as_ulong(); // We cannot have a zero enumeration name declaration count. if (! zero_ok && (value == 0)) { - yyerror(loc, "error: zero count used in enum name sequence."); + yyerror(loc, "error: Zero count used in enum name sequence."); value = 1; } } @@ -273,7 +273,7 @@ static void check_end_label(const struct vlltype&loc, const char *type, return; if (!begin) - yyerror(loc, "error: unnamed %s must not have end label.", type); + yyerror(loc, "error: Unnamed %s must not have end label.", type); else if (strcmp(begin, end) != 0) yyerror(loc, "error: %s end label `%s` doesn't match %s name" " `%s`.", type, end, type, begin); @@ -946,7 +946,7 @@ class_item /* IEEE1800-2005: A.1.8 */ | ';' | error ';' - { yyerror(@2, "error: invalid class item."); + { yyerror(@2, "error: Invalid class item."); yyerrok; } @@ -1892,7 +1892,7 @@ modport_ports_list pform_add_modport_port(@3, last_modport_port.direction, lex_strings.make($3), 0); } else if (last_modport_port.type != MP_TF) { - yyerror(@3, "error: list of identifiers not allowed here."); + yyerror(@3, "error: List of identifiers not allowed here."); } delete[] $3; } @@ -2369,7 +2369,7 @@ tf_port_item /* IEEE1800-2005: A.2.7 */ list* port_list = make_port_list($4, $5, 0); if (use_port_type == NetNet::PIMPLICIT) { - yyerror(@1, "error: missing task/function port direction."); + yyerror(@1, "error: Missing task/function port direction."); use_port_type = NetNet::PINPUT; // for error recovery } if (($3 == 0) && ($1==NetNet::PIMPLICIT)) { @@ -2533,7 +2533,7 @@ variable_lifetime_opt : lifetime { if (pform_requires_sv(@1, "Overriding default variable lifetime") && $1 != pform_peek_scope()->default_lifetime) { - yyerror(@1, "sorry: overriding the default variable lifetime " + yyerror(@1, "sorry: Overriding the default variable lifetime " "is not yet supported."); } var_lifetime = $1; @@ -2642,24 +2642,24 @@ block_item_decl trailing semi-colon to resync the parser. */ | K_var variable_lifetime_opt data_type_or_implicit error ';' - { yyerror(@1, "error: syntax error in variable list."); + { yyerror(@1, "error: Syntax error in variable list."); yyerrok; } | variable_lifetime_opt data_type error ';' - { yyerror(@1, "error: syntax error in variable list."); + { yyerror(@1, "error: Syntax error in variable list."); yyerrok; } | K_event error ';' - { yyerror(@1, "error: syntax error in event variable list."); + { yyerror(@1, "error: Syntax error in event variable list."); yyerrok; } | parameter error ';' - { yyerror(@1, "error: syntax error in parameter list."); + { yyerror(@1, "error: Syntax error in parameter list."); yyerrok; } | localparam error ';' - { yyerror(@1, "error: syntax error localparam list."); + { yyerror(@1, "error: Syntax error localparam list."); yyerrok; } ; @@ -2876,7 +2876,7 @@ struct_union_member /* IEEE 1800-2012 A.2.2.1 */ $$ = tmp; } | error ';' - { yyerror(@2, "Error in struct/union member."); + { yyerror(@2, "error: Error in struct/union member."); yyerrok; $$ = 0; } @@ -4591,7 +4591,7 @@ lpvalue } | streaming_concatenation - { yyerror(@1, "sorry: streaming concatenation not supported in l-values."); + { yyerror(@1, "sorry: Streaming concatenation not supported in l-values."); $$ = 0; } ; @@ -4811,7 +4811,7 @@ module_item } pform_set_data_type(@2, data_type, $5, $2, $1); if ($4 != 0) { - yyerror(@2, "sorry: net delays not supported."); + yyerror(@2, "sorry: Net delays not supported."); delete $4; } delete $1; @@ -4821,7 +4821,7 @@ module_item { real_type_t*tmpt = new real_type_t(real_type_t::REAL); pform_set_data_type(@2, tmpt, $4, NetNet::WIRE, $1); if ($3 != 0) { - yyerror(@3, "sorry: net delays not supported."); + yyerror(@3, "sorry: Net delays not supported."); delete $3; } delete $1; @@ -5183,7 +5183,7 @@ module_item specify_item_list_opt K_endspecify | K_specify error K_endspecify - { yyerror(@1, "error: syntax error in specify block"); + { yyerror(@1, "error: Syntax error in specify block"); yyerrok; } @@ -5192,18 +5192,18 @@ module_item reasonable error message can be produced. */ | error ';' - { yyerror(@2, "error: invalid module item."); + { yyerror(@2, "error: Invalid module item."); yyerrok; } | K_assign error '=' expression ';' - { yyerror(@1, "error: syntax error in left side of " + { yyerror(@1, "error: Syntax error in left side of " "continuous assignment."); yyerrok; } | K_assign error ';' - { yyerror(@1, "error: syntax error in continuous assignment"); + { yyerror(@1, "error: Syntax error in continuous assignment"); yyerrok; } @@ -5548,7 +5548,7 @@ parameter_value_opt $$ = lst; } | '#' error - { yyerror(@1, "error: syntax error in parameter value assignment list."); + { yyerror(@1, "error: Syntax error in parameter value assignment list."); $$ = 0; } | @@ -5657,7 +5657,7 @@ port_name $$ = tmp; } | attribute_list_opt '.' IDENTIFIER '(' error ')' - { yyerror(@3, "error: invalid port connection expression."); + { yyerror(@3, "error: Invalid port connection expression."); named_pexpr_t*tmp = new named_pexpr_t; tmp->name = lex_strings.make($3); tmp->parm = 0; @@ -5794,7 +5794,7 @@ port_reference $$ = ptmp; } | IDENTIFIER '[' error ']' - { yyerror(@1, "error: invalid port bit select"); + { yyerror(@1, "error: Invalid port bit select"); Module::port_t*ptmp = new Module::port_t; PEIdent*wtmp = new PEIdent(lex_strings.make($1)); FILE_NAME(wtmp, @1); @@ -6679,7 +6679,7 @@ statement_item /* This is roughly statement_item in the LRM */ $$ = tmp; } | error ';' - { yyerror(@2, "error: malformed statement"); + { yyerror(@2, "error: Malformed statement"); yyerrok; $$ = new PNoop; } diff --git a/pform.cc b/pform.cc index 2e275cc52..fc61b9657 100644 --- a/pform.cc +++ b/pform.cc @@ -569,7 +569,7 @@ void pform_set_scope_timescale(const struct vlltype&loc) if (gn_system_verilog() && (scope->time_unit < scope->time_precision)) { if (scope->time_unit_is_local || scope->time_prec_is_local) { - VLerror("error: a timeprecision is missing or is too large!"); + VLerror("error: A timeprecision is missing or is too large!"); } } else { assert(scope->time_unit >= scope->time_precision); @@ -1093,7 +1093,7 @@ bool get_time_unit(const char*cp, int &unit) bool rc = true; if (strchr(cp, '_')) { - VLerror(yylloc, "Invalid timeunit constant ('_' is not " + VLerror(yylloc, "error: Invalid timeunit constant ('_' is not " "supported)."); return false; } @@ -1118,7 +1118,7 @@ bool get_time_unit(const char*cp, int &unit) rc = false; ostringstream msg; - msg << "Invalid timeunit scale '" << cp << "'."; + msg << "error: Invalid timeunit scale '" << cp << "'."; VLerror(msg.str().c_str()); } @@ -1134,11 +1134,11 @@ static bool get_time_unit_prec(const char*cp, int &res, bool is_unit) /* We do not support a '_' in these time constants. */ if (strchr(cp, '_')) { if (is_unit) { - VLerror(yylloc, "Invalid timeunit constant ('_' is not " - "supported)."); + VLerror(yylloc, "error: Invalid timeunit constant ('_' " + "is not supported)."); } else { - VLerror(yylloc, "Invalid timeprecision constant ('_' is not " - "supported)."); + VLerror(yylloc, "error: Invalid timeprecision constant ('_' " + "is not supported)."); } return true; } @@ -1146,9 +1146,11 @@ static bool get_time_unit_prec(const char*cp, int &res, bool is_unit) /* Check for the 1 digit. */ if (*cp != '1') { if (is_unit) { - VLerror(yylloc, "Invalid timeunit constant (1st digit)."); + VLerror(yylloc, "error: Invalid timeunit constant " + "(1st digit)."); } else { - VLerror(yylloc, "Invalid timeprecision constant (1st digit)."); + VLerror(yylloc, "error: Invalid timeprecision constant " + "(1st digit)."); } return true; } @@ -1158,11 +1160,11 @@ static bool get_time_unit_prec(const char*cp, int &res, bool is_unit) res = strspn(cp, "0"); if (res > 2) { if (is_unit) { - VLerror(yylloc, "Invalid timeunit constant (number of " - "zeros)."); + VLerror(yylloc, "error: Invalid timeunit constant " + "(number of zeros)."); } else { - VLerror(yylloc, "Invalid timeprecision constant (number of " - "zeros)."); + VLerror(yylloc, "error: Invalid timeprecision constant " + "(number of zeros)."); } return true; } @@ -1196,7 +1198,7 @@ static bool get_time_unit_prec(const char*cp, int &res, bool is_unit) } ostringstream msg; - msg << "Invalid "; + msg << "error: Invalid "; if (is_unit) msg << "timeunit"; else msg << "timeprecision"; msg << " scale '" << cp << "'."; @@ -1220,10 +1222,10 @@ void pform_set_timeunit(const char*txt, bool initial_decl) scope->time_unit_is_default = false; allow_timeunit_decl = false; } else if (!scope->time_unit_is_local) { - VLerror(yylloc, "error: repeat timeunit found and the initial " + VLerror(yylloc, "error: Repeat timeunit found and the initial " "timeunit for this scope is missing."); } else if (scope->time_unit != val) { - VLerror(yylloc, "error: repeat timeunit does not match the " + VLerror(yylloc, "error: Repeat timeunit does not match the " "initial timeunit for this scope."); } } @@ -1258,10 +1260,10 @@ void pform_set_timeprec(const char*txt, bool initial_decl) scope->time_prec_is_default = false; allow_timeprec_decl = false; } else if (!scope->time_prec_is_local) { - VLerror(yylloc, "error: repeat timeprecision found and the initial " + VLerror(yylloc, "error: Repeat timeprecision found and the initial " "timeprecision for this scope is missing."); } else if (scope->time_precision != val) { - VLerror(yylloc, "error: repeat timeprecision does not match the " + VLerror(yylloc, "error: Repeat timeprecision does not match the " "initial timeprecision for this scope."); } } @@ -1458,7 +1460,7 @@ void pform_endmodule(const char*name, bool inside_celldefine, perm_string tmp_name = tmp_module->mod_name(); pform_cur_module.pop_front(); ostringstream msg; - msg << "Module " << mod_name + msg << "error: Module " << mod_name << " was nested within " << tmp_name << " but broken."; VLerror(msg.str().c_str()); @@ -1492,7 +1494,7 @@ void pform_endmodule(const char*name, bool inside_celldefine, if (test != use_module_map.end()) { ostringstream msg; - msg << "Module " << name << " was already declared here: " + msg << "error: Module " << name << " was already declared here: " << test->second->get_fileline() << endl; VLerror(msg.str().c_str()); } else { @@ -2127,7 +2129,7 @@ void pform_make_udp(const struct vlltype&loc, perm_string name, // Put the primitive into the primitives table if (pform_primitives[name]) { - VLerror("UDP primitive already exists."); + VLerror("error: UDP primitive already exists."); } else { PUdp*udp = new PUdp(name, pins.size()); @@ -2210,7 +2212,7 @@ static void pform_makegate(PGBuiltin::Type type, list*attr) { if (info.parms_by_name) { - cerr << info.get_fileline() << ": Gates do not have port names." + cerr << info.get_fileline() << ": error: Gates do not have port names." << endl; error_count += 1; return; @@ -2515,7 +2517,7 @@ void pform_make_var_init(const struct vlltype&li, perm_string name, PExpr*expr) { if (! pform_at_module_level() && !gn_system_verilog()) { - VLerror(li, "error: variable declaration assignments are only " + VLerror(li, "error: Variable declaration assignments are only " "allowed at the module level."); delete expr; return; @@ -2678,7 +2680,7 @@ void pform_makewire(const struct vlltype&li, list*attr) { if (is_compilation_unit(lexical_scope) && !gn_system_verilog()) { - VLerror(li, "error: variable declarations must be contained within a module."); + VLerror(li, "error: Variable declarations must be contained within a module."); return; } @@ -2876,7 +2878,7 @@ void pform_set_attrib(perm_string name, perm_string key, char*value) } else { delete[] value; - VLerror("Unable to match name for setting attribute."); + VLerror("error: Unable to match name for setting attribute."); } } @@ -2890,7 +2892,7 @@ void pform_set_type_attrib(perm_string name, const string&key, { map::const_iterator udp = pform_primitives.find(name); if (udp == pform_primitives.end()) { - VLerror("type name is not (yet) defined."); + VLerror("error: Type name is not (yet) defined."); delete[] value; return; } @@ -2923,7 +2925,7 @@ static void pform_set_type_parameter(const struct vlltype&loc, perm_string name, pform_requires_sv(loc, "Type parameter"); if (value_range) - VLerror(loc, "error: type parameter must not have value range."); + VLerror(loc, "error: Type parameter must not have value range."); type_parameter_t *type = new type_parameter_t(name); pform_set_typedef(loc, name, type, 0); diff --git a/pform_package.cc b/pform_package.cc index a772c26ea..856f8c103 100644 --- a/pform_package.cc +++ b/pform_package.cc @@ -60,9 +60,9 @@ void pform_end_package_declaration(const struct vlltype&loc) map::const_iterator test = packages_by_name.find(use_name); if (test != packages_by_name.end()) { ostringstream msg; - msg << "Package " << use_name << " was already declared here: " + msg << "error: Package " << use_name << " was already declared here: " << test->second->get_fileline() << ends; - VLerror(msg.str().c_str()); + VLerror(loc, msg.str().c_str()); } From 2e27b4393da7eb3b233cd5bf355c5e5b8cb5dd61 Mon Sep 17 00:00:00 2001 From: Martin Whitaker Date: Thu, 22 Dec 2022 10:15:09 +0000 Subject: [PATCH 3/8] Use consistent format for compiler lexor error messages. Always prefix with "error: ". Capitalise the first word of the main message unless it's a Verilog keyword. Use VLerror() in preference to direct output to cerr. --- lexor.lex | 74 ++++++++++++++++++++++++------------------------------- 1 file changed, 32 insertions(+), 42 deletions(-) diff --git a/lexor.lex b/lexor.lex index 32ea92d35..d9e02dd96 100644 --- a/lexor.lex +++ b/lexor.lex @@ -827,10 +827,8 @@ TU [munpf] net_type = NetNet::NONE; } else { - cerr << yylloc.text << ":" << yylloc.first_line - << ": error: Net type " << yytext - << " is not a valid (or supported)" - << " default net type." << endl; + VLerror(yylloc, "error: Net type '%s' is not a valid (or supported) " + "default net type.", yytext); net_type = NetNet::WIRE; error_count += 1; } @@ -906,27 +904,21 @@ TU [munpf] } -`{W} { cerr << yylloc.text << ":" << yylloc.first_line << ": error: " - << "Stray tic (`) here. Perhaps you put white space" << endl; - cerr << yylloc.text << ":" << yylloc.first_line << ": : " - << "between the tic and preprocessor directive?" - << endl; - error_count += 1; } +`{W} { VLerror(yylloc, "error: Stray tic (`) here. Perhaps you put white " + "space between the tic and preprocessor directive?"); } . { return yytext[0]; } /* Final catchall. something got lost or mishandled. */ /* XXX Should we tell the user something about the lexical state? */ -<*>.|\n { cerr << yylloc.text << ":" << yylloc.first_line - << ": error: unmatched character ("; +<*>.|\n { if (isprint(yytext[0])) - cerr << yytext[0]; + VLerror(yylloc, "error: Unmatched character (%c).", yytext[0]); else - cerr << "hex " << hex << ((unsigned char) yytext[0]); - - cerr << ")" << endl; - error_count += 1; } + VLerror(yylloc, "error: Unmatched character (0x%x).", + (unsigned char) yytext[0]); +} %% @@ -985,7 +977,7 @@ verinum*make_unsized_binary(const char*txt) if (*idx != '_') size += 1; if (size == 0) { - VLerror(yylloc, "Numeric literal has no digits in it."); + VLerror(yylloc, "error: Numeric literal has no digits in it."); verinum*out = new verinum(); out->has_sign(sign_flag); out->is_single(single_flag); @@ -1431,7 +1423,7 @@ static void process_ucdrive(const char*txt) const char*cp = txt; if (strncmp("pull", cp, 4) != 0) { - VLerror(yylloc, "pull required for `unconnected_drive " + VLerror(yylloc, "error: pull required for `unconnected_drive " "directive."); return; } @@ -1439,16 +1431,14 @@ static void process_ucdrive(const char*txt) if (*cp == '0') ucd = UCD_PULL0; else if (*cp == '1') ucd = UCD_PULL1; else { - cerr << yylloc.text << ":" << yylloc.first_line << ": error: " - "`unconnected_drive does not support 'pull" << *cp - << "'." << endl; - error_count += 1; + VLerror(yylloc, "error: `unconnected_drive does not support " + "'pull%c'.", *cp); return; } cp += 1; if (*cp != '\0') { - VLerror(yylloc, "Invalid `unconnected_drive directive (extra " - "garbage after pull direction)."); + VLerror(yylloc, "error: Invalid `unconnected_drive directive " + "(extra garbage after pull direction)."); return; } @@ -1479,7 +1469,7 @@ static void line_directive() /* Find the starting " and skip it. */ char*fn_start = strchr(cp, '"'); if (cp != fn_start) { - VLerror(yylloc, "Invalid #line directive (file name start)."); + VLerror(yylloc, "error: Invalid #line directive (file name start)."); return; } fn_start += 1; @@ -1487,7 +1477,7 @@ static void line_directive() /* Find the last ". */ char*fn_end = strrchr(fn_start, '"'); if (!fn_end) { - VLerror(yylloc, "Invalid #line directive (file name end)."); + VLerror(yylloc, "error: Invalid #line directive (file name end)."); return; } @@ -1502,8 +1492,8 @@ static void line_directive() cpr = cp; cpr += strspn(cp, " \t"); if (cp == cpr) { - VLerror(yylloc, "Invalid #line directive (missing space after " - "file name)."); + VLerror(yylloc, "error: Invalid #line directive (missing space " + "after file name)."); delete[] buf; return; } @@ -1512,7 +1502,7 @@ static void line_directive() /* Get the line number and verify that it is correct. */ unsigned long lineno = strtoul(cp, &cpr, 10); if (cp == cpr) { - VLerror(yylloc, "Invalid line number for #line directive."); + VLerror(yylloc, "error: Invalid line number for #line directive."); delete[] buf; return; } @@ -1521,8 +1511,8 @@ static void line_directive() /* Verify that only space is left. */ cpr += strspn(cp, " \t"); if ((size_t)(cpr-yytext) != strlen(yytext)) { - VLerror(yylloc, "Invalid #line directive (extra garbage after " - "line number)."); + VLerror(yylloc, "error: Invalid #line directive (extra garbage " + "after line number)."); delete[] buf; return; } @@ -1549,7 +1539,7 @@ static void line_directive2() /* strtoul skips leading space. */ unsigned long lineno = strtoul(cp, &cpr, 10); if (cp == cpr) { - VLerror(yylloc, "Invalid line number for `line directive."); + VLerror(yylloc, "error: Invalid line number for `line directive."); return; } lineno -= 1; @@ -1558,8 +1548,8 @@ static void line_directive2() /* Skip the space between the line number and the file name. */ cpr += strspn(cp, " \t"); if (cp == cpr) { - VLerror(yylloc, "Invalid `line directive (missing space after " - "line number)."); + VLerror(yylloc, "error: Invalid `line directive (missing space " + "after line number)."); return; } cp = cpr; @@ -1567,7 +1557,7 @@ static void line_directive2() /* Find the starting " and skip it. */ char*fn_start = strchr(cp, '"'); if (cp != fn_start) { - VLerror(yylloc, "Invalid `line directive (file name start)."); + VLerror(yylloc, "error: Invalid `line directive (file name start)."); return; } fn_start += 1; @@ -1575,7 +1565,7 @@ static void line_directive2() /* Find the last ". */ char*fn_end = strrchr(fn_start, '"'); if (!fn_end) { - VLerror(yylloc, "Invalid `line directive (file name end)."); + VLerror(yylloc, "error: Invalid `line directive (file name end)."); return; } @@ -1584,15 +1574,15 @@ static void line_directive2() cpr = cp; cpr += strspn(cp, " \t"); if (cp == cpr) { - VLerror(yylloc, "Invalid `line directive (missing space after " - "file name)."); + VLerror(yylloc, "error: Invalid `line directive (missing space " + "after file name)."); return; } cp = cpr; /* Check that the level is correct, we do not need the level. */ if (strspn(cp, "012") != 1) { - VLerror(yylloc, "Invalid level for `line directive."); + VLerror(yylloc, "error: Invalid level for `line directive."); return; } cp += 1; @@ -1601,8 +1591,8 @@ static void line_directive2() cp += strspn(cp, " \t"); if (strncmp(cp, "//", 2) != 0 && (size_t)(cp-yytext) != strlen(yytext)) { - VLerror(yylloc, "Invalid `line directive (extra garbage after " - "level)."); + VLerror(yylloc, "error: Invalid `line directive (extra garbage " + "after level)."); return; } From 3335138d16ed3ee77ee0d2dce87e1d4adb878b57 Mon Sep 17 00:00:00 2001 From: Martin Whitaker Date: Thu, 22 Dec 2022 10:17:46 +0000 Subject: [PATCH 4/8] Remove prototype for unimplemented variant of VLerror(). --- parse_misc.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/parse_misc.h b/parse_misc.h index e9a1477bb..86e86314b 100644 --- a/parse_misc.h +++ b/parse_misc.h @@ -1,7 +1,7 @@ #ifndef IVL_parse_misc_H #define IVL_parse_misc_H /* - * Copyright (c) 1998-2021 Stephen Williams (steve@icarus.com) + * Copyright (c) 1998-2022 Stephen Williams (steve@icarus.com) * * This source code is free software; you can redistribute it * and/or modify it in source code form under the terms of the GNU @@ -57,7 +57,6 @@ extern YYLTYPE yylloc; */ extern int VLlex(); extern void VLerror(const char*msg); -extern void VLerror(const YYLTYPE&loc, va_list ap); extern void VLerror(const YYLTYPE&loc, const char*msg, ...) __attribute__((format(printf,2,3))); #define yywarn VLwarn extern void VLwarn(const char*msg); From bb867480fc2e7b8eded9f5a1bc12ea94bdbfa0ae Mon Sep 17 00:00:00 2001 From: Martin Whitaker Date: Thu, 22 Dec 2022 10:21:25 +0000 Subject: [PATCH 5/8] Use consistent name for all variant implementations of VLwarn(). The function prototypes both use the name VLwarn, with a macro definition providing the alias to yywarn. But one of the variant implementations was named yywarn. Make it consistent with the function prototype. --- parse_misc.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/parse_misc.cc b/parse_misc.cc index 89587c6e2..95c64dbb4 100644 --- a/parse_misc.cc +++ b/parse_misc.cc @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998-2021 Stephen Williams (steve@icarus.com) + * Copyright (c) 1998-2022 Stephen Williams (steve@icarus.com) * * This source code is free software; you can redistribute it * and/or modify it in source code form under the terms of the GNU @@ -67,7 +67,7 @@ void VLerror(const YYLTYPE&loc, const char*msg, ...) based_size = 0; /* Clear the base information if we have an error. */ } -void yywarn(const YYLTYPE&loc, const char*msg) +void VLwarn(const YYLTYPE&loc, const char*msg) { warn_count += 1; cerr << loc << ": warning: " << msg << endl; From 82aedbc36c5782039114742e862b307c24f62166 Mon Sep 17 00:00:00 2001 From: Martin Whitaker Date: Thu, 22 Dec 2022 10:34:56 +0000 Subject: [PATCH 6/8] Don't automatically add the "warning: " prefix in VLwarn(). One variant did, the other variant didn't. As well as being a trap for the unwary, this gets in the way of using yywarn/VLwarn for non-fatal "sorry" messages. --- lexor.lex | 11 ++++++----- parse.y | 8 ++++---- parse_misc.cc | 2 +- pform.cc | 2 +- 4 files changed, 12 insertions(+), 11 deletions(-) diff --git a/lexor.lex b/lexor.lex index d9e02dd96..e30d7deaa 100644 --- a/lexor.lex +++ b/lexor.lex @@ -899,7 +899,7 @@ TU [munpf] } `[a-zA-Z_]+ { - yywarn(yylloc, "macro replacement not supported. " + yywarn(yylloc, "warning: macro replacement not supported. " "Use an external preprocessor."); } @@ -941,7 +941,8 @@ static unsigned truncate_to_integer_width(verinum::V*bits, unsigned size) for (unsigned idx = integer_width; idx < size; idx += 1) { if (bits[idx] != pad) { - yywarn(yylloc, "Unsized numeric constant truncated to integer width."); + yywarn(yylloc, "warning: Unsized numeric constant truncated " + "to integer width."); break; } } @@ -985,7 +986,7 @@ verinum*make_unsized_binary(const char*txt) } if ((based_size > 0) && (size > based_size)) yywarn(yylloc, - "extra digits given for sized binary constant."); + "warning: extra digits given for sized binary constant."); verinum::V*bits = new verinum::V[size]; @@ -1050,7 +1051,7 @@ verinum*make_unsized_octal(const char*txt) int rem = based_size % 3; if (rem != 0) based_size += 3 - rem; if (size > based_size) yywarn(yylloc, - "extra digits given for sized octal constant."); + "warning: extra digits given for sized octal constant."); } verinum::V*bits = new verinum::V[size]; @@ -1119,7 +1120,7 @@ verinum*make_unsized_hex(const char*txt) int rem = based_size % 4; if (rem != 0) based_size += 4 - rem; if (size > based_size) yywarn(yylloc, - "extra digits given for sized hex constant."); + "warning: extra digits given for sized hex constant."); } verinum::V*bits = new verinum::V[size]; diff --git a/parse.y b/parse.y index 8da3e535b..3a1d1cb88 100644 --- a/parse.y +++ b/parse.y @@ -6068,7 +6068,7 @@ specify_path_identifiers } | IDENTIFIER '[' expr_primary ']' { if (gn_specify_blocks_flag) { - yywarn(@4, "Bit selects are not currently supported " + yywarn(@4, "warning: Bit selects are not currently supported " "in path declarations. The declaration " "will be applied to the whole vector."); } @@ -6079,7 +6079,7 @@ specify_path_identifiers } | IDENTIFIER '[' expr_primary polarity_operator expr_primary ']' { if (gn_specify_blocks_flag) { - yywarn(@4, "Part selects are not currently supported " + yywarn(@4, "warning: Part selects are not currently supported " "in path declarations. The declaration " "will be applied to the whole vector."); } @@ -6096,7 +6096,7 @@ specify_path_identifiers } | specify_path_identifiers ',' IDENTIFIER '[' expr_primary ']' { if (gn_specify_blocks_flag) { - yywarn(@4, "Bit selects are not currently supported " + yywarn(@4, "warning: Bit selects are not currently supported " "in path declarations. The declaration " "will be applied to the whole vector."); } @@ -6107,7 +6107,7 @@ specify_path_identifiers } | specify_path_identifiers ',' IDENTIFIER '[' expr_primary polarity_operator expr_primary ']' { if (gn_specify_blocks_flag) { - yywarn(@4, "Part selects are not currently supported " + yywarn(@4, "warning: Part selects are not currently supported " "in path declarations. The declaration " "will be applied to the whole vector."); } diff --git a/parse_misc.cc b/parse_misc.cc index 95c64dbb4..1ffb833f8 100644 --- a/parse_misc.cc +++ b/parse_misc.cc @@ -70,7 +70,7 @@ void VLerror(const YYLTYPE&loc, const char*msg, ...) void VLwarn(const YYLTYPE&loc, const char*msg) { warn_count += 1; - cerr << loc << ": warning: " << msg << endl; + cerr << loc << ": " << msg << endl; } int VLwrap() diff --git a/pform.cc b/pform.cc index fc61b9657..1a13ca249 100644 --- a/pform.cc +++ b/pform.cc @@ -2048,7 +2048,7 @@ void pform_make_udp(const struct vlltype&loc, perm_string name, // Put the primitive into the primitives table if (pform_primitives[name]) { - VLwarn("UDP primitive already exists."); + VLwarn("warning: UDP primitive already exists."); } else { PUdp*udp = new PUdp(name, parms->size()); From 6b04d9795a31fe86c36c0b65550df246030e99a0 Mon Sep 17 00:00:00 2001 From: Martin Whitaker Date: Thu, 22 Dec 2022 10:47:45 +0000 Subject: [PATCH 7/8] Use consistent capitalisation for compiler parser warning messages. --- ivtest/gold/pr1792152.gold | 2 +- parse.y | 12 ++++++------ pform.cc | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/ivtest/gold/pr1792152.gold b/ivtest/gold/pr1792152.gold index 8d42bfcd6..0f639a774 100644 --- a/ivtest/gold/pr1792152.gold +++ b/ivtest/gold/pr1792152.gold @@ -1,2 +1,2 @@ -./ivltests/pr1792152.v:2: warning: choosing typ expression. +./ivltests/pr1792152.v:2: warning: Choosing typ expression. 2 diff --git a/parse.y b/parse.y index 3a1d1cb88..6e633fd7b 100644 --- a/parse.y +++ b/parse.y @@ -3538,7 +3538,7 @@ expr_mintypmax break; } if (min_typ_max_warn > 0) { - cerr << $$->get_fileline() << ": warning: choosing "; + cerr << $$->get_fileline() << ": warning: Choosing "; switch (min_typ_max_flag) { case MIN: cerr << "min"; @@ -5905,7 +5905,7 @@ specify_item pform_module_specify_path(tmp); } | K_ifnone specify_edge_path_decl ';' - { yywarn(@1, "Sorry: ifnone with an edge-sensitive path is not supported."); + { yywarn(@1, "sorry: ifnone with an edge-sensitive path is not supported."); yyerrok; } | K_Sfullskew '(' spec_reference_event ',' spec_reference_event @@ -6144,7 +6144,7 @@ specparam break; } if (min_typ_max_warn > 0) { - cerr << tmp->get_fileline() << ": warning: choosing "; + cerr << tmp->get_fileline() << ": warning: Choosing "; switch (min_typ_max_flag) { case MIN: cerr << "min"; @@ -6244,7 +6244,7 @@ spec_notifier | spec_notifier ',' hierarchy_identifier { args_after_notifier += 1; if (args_after_notifier >= 3) { - cerr << @3 << ": warning: timing checks are not supported " + cerr << @3 << ": warning: Timing checks are not supported " "and delayed signal \"" << *$3 << "\" will not be driven." << endl; } @@ -6444,13 +6444,13 @@ statement_item /* This is roughly statement_item in the LRM */ { PNBTrigger*tmp = pform_new_nb_trigger(@3, 0, *$3); delete $3; $$ = tmp; - yywarn(@1, "Sorry: ->> with event control is not currently supported."); + yywarn(@1, "sorry: ->> with event control is not currently supported."); } | K_NB_TRIGGER K_repeat '(' expression ')' event_control hierarchy_identifier ';' { PNBTrigger*tmp = pform_new_nb_trigger(@7, 0, *$7); delete $7; $$ = tmp; - yywarn(@1, "Sorry: ->> with repeat event control is not currently supported."); + yywarn(@1, "sorry: ->> with repeat event control is not currently supported."); } | procedural_assertion_statement diff --git a/pform.cc b/pform.cc index 1a13ca249..8dd6de9fc 100644 --- a/pform.cc +++ b/pform.cc @@ -1794,7 +1794,7 @@ PExpr* pform_select_mtm_expr(PExpr*min, PExpr*typ, PExpr*max) } if (min_typ_max_warn > 0) { - cerr << res->get_fileline() << ": warning: choosing "; + cerr << res->get_fileline() << ": warning: Choosing "; switch (min_typ_max_flag) { case MIN: cerr << "min"; From 027160226045e483267142fd98584508b2cd8f50 Mon Sep 17 00:00:00 2001 From: Martin Whitaker Date: Thu, 22 Dec 2022 10:58:04 +0000 Subject: [PATCH 8/8] Use consistent format for compiler lexor warning messages. Capitalise the first word of the main message unless it's a Verilog keyword. Use VLwarn() in preference to yywarn or direct output to cerr. --- lexor.lex | 53 ++++++++++++++++++----------------------------------- 1 file changed, 18 insertions(+), 35 deletions(-) diff --git a/lexor.lex b/lexor.lex index e30d7deaa..aca434fe9 100644 --- a/lexor.lex +++ b/lexor.lex @@ -509,9 +509,8 @@ TU [munpf] } \'[01xzXZ] { if (!gn_system_verilog()) { - cerr << yylloc.text << ":" << yylloc.first_line << ": warning: " - << "Using SystemVerilog 'N bit vector. Use at least " - << "-g2005-sv to remove this warning." << endl; + VLwarn(yylloc, "warning: Using SystemVerilog 'N bit vector. " + "Use at least -g2005-sv to remove this warning."); } generation_t generation_save = generation_flag; generation_flag = GN_VER2005_SV; @@ -851,55 +850,39 @@ TU [munpf] been handled by an external preprocessor such as ivlpp. */ ^{W}?`define{W}?.* { - cerr << yylloc.text << ":" << yylloc.first_line << - ": warning: `define not supported. Use an external preprocessor." - << endl; + VLwarn(yylloc, "warning: `define not supported. Use an external preprocessor."); } ^{W}?`else{W}?.* { - cerr << yylloc.text << ":" << yylloc.first_line << - ": warning: `else not supported. Use an external preprocessor." - << endl; + VLwarn(yylloc, "warning: `else not supported. Use an external preprocessor."); } ^{W}?`elsif{W}?.* { - cerr << yylloc.text << ":" << yylloc.first_line << - ": warning: `elsif not supported. Use an external preprocessor." - << endl; + VLwarn(yylloc, "warning: `elsif not supported. Use an external preprocessor."); } ^{W}?`endif{W}?.* { - cerr << yylloc.text << ":" << yylloc.first_line << - ": warning: `endif not supported. Use an external preprocessor." - << endl; + VLwarn(yylloc, "warning: `endif not supported. Use an external preprocessor."); } ^{W}?`ifdef{W}?.* { - cerr << yylloc.text << ":" << yylloc.first_line << - ": warning: `ifdef not supported. Use an external preprocessor." - << endl; + VLwarn(yylloc, "warning: `ifdef not supported. Use an external preprocessor."); } ^{W}?`ifndef{W}?.* { - cerr << yylloc.text << ":" << yylloc.first_line << - ": warning: `ifndef not supported. Use an external preprocessor." - << endl; + VLwarn(yylloc, "warning: `ifndef not supported. Use an external preprocessor."); } ^`include{W}?.* { - cerr << yylloc.text << ":" << yylloc.first_line << - ": warning: `include not supported. Use an external preprocessor." - << endl; + VLwarn(yylloc, "warning: `include not supported. Use an external preprocessor."); } ^`undef{W}?.* { - cerr << yylloc.text << ":" << yylloc.first_line << - ": warning: `undef not supported. Use an external preprocessor." - << endl; + VLwarn(yylloc, "warning: `undef not supported. Use an external preprocessor."); } `[a-zA-Z_]+ { - yywarn(yylloc, "warning: macro replacement not supported. " + VLwarn(yylloc, "warning: Macro replacement not supported. " "Use an external preprocessor."); } @@ -941,7 +924,7 @@ static unsigned truncate_to_integer_width(verinum::V*bits, unsigned size) for (unsigned idx = integer_width; idx < size; idx += 1) { if (bits[idx] != pad) { - yywarn(yylloc, "warning: Unsized numeric constant truncated " + VLwarn(yylloc, "warning: Unsized numeric constant truncated " "to integer width."); break; } @@ -985,8 +968,8 @@ verinum*make_unsized_binary(const char*txt) return out; } - if ((based_size > 0) && (size > based_size)) yywarn(yylloc, - "warning: extra digits given for sized binary constant."); + if ((based_size > 0) && (size > based_size)) VLwarn(yylloc, + "warning: Extra digits given for sized binary constant."); verinum::V*bits = new verinum::V[size]; @@ -1050,8 +1033,8 @@ verinum*make_unsized_octal(const char*txt) if (based_size > 0) { int rem = based_size % 3; if (rem != 0) based_size += 3 - rem; - if (size > based_size) yywarn(yylloc, - "warning: extra digits given for sized octal constant."); + if (size > based_size) VLwarn(yylloc, + "warning: Extra digits given for sized octal constant."); } verinum::V*bits = new verinum::V[size]; @@ -1119,8 +1102,8 @@ verinum*make_unsized_hex(const char*txt) if (based_size > 0) { int rem = based_size % 4; if (rem != 0) based_size += 4 - rem; - if (size > based_size) yywarn(yylloc, - "warning: extra digits given for sized hex constant."); + if (size > based_size) VLwarn(yylloc, + "warning: Extra digits given for sized hex constant."); } verinum::V*bits = new verinum::V[size];