diff --git a/src/verilog.l b/src/verilog.l index 07111af8e..3aae01d07 100644 --- a/src/verilog.l +++ b/src/verilog.l @@ -885,8 +885,9 @@ vnum {vnum1}|{vnum2}|{vnum3}|{vnum4}|{vnum5} "|=>" { FL; return yP_OREQGT; } /* Some simulators allow whitespace here. Grr */ "["{ws}*"*" { FL; return yP_BRASTAR; } - "["{ws}*"=" { FL; return yP_BRAEQ; } + "["{ws}*"+"{ws}*"]" { FL; return yP_BRAPLUSKET; } "["{ws}*"->" { FL; return yP_BRAMINUSGT; } + "["{ws}*"=" { FL; return yP_BRAEQ; } } /* SystemVerilog 2009 Operators */ diff --git a/src/verilog.y b/src/verilog.y index 156d4a9b6..bb3f938f8 100644 --- a/src/verilog.y +++ b/src/verilog.y @@ -1030,7 +1030,7 @@ BISONPRE_VERSION(3.7,%define api.header.include {"V3ParseBison.h"}) %token yP_BRASTAR "[*" %token yP_BRAEQ "[=" %token yP_BRAMINUSGT "[->" -//UNSUP %token yP_BRAPLUSKET "[+]" +%token yP_BRAPLUSKET "[+]" %token yP_PLUSPLUS "++" %token yP_MINUSMINUS "--" @@ -1079,9 +1079,9 @@ BISONPRE_VERSION(3.7,%define api.header.include {"V3ParseBison.h"}) %left yINTERSECT %left yWITHIN %right yTHROUGHOUT -//UNSUP %left prPOUNDPOUND_MULTI -//UNSUP %left yP_POUNDPOUND -//UNSUP %left yP_BRASTAR yP_BRAEQ yP_BRAMINUSGT yP_BRAPLUSKET +%left prPOUNDPOUND_MULTI +%left yP_POUNDPOUND +%left yP_BRASTAR yP_BRAEQ yP_BRAMINUSGT yP_BRAPLUSKET // Not specified, but needed higher than yOR, lower than normal non-pexpr expressions //UNSUP %left yPOSEDGE yNEGEDGE yEDGE @@ -5823,12 +5823,12 @@ property_port_list: // ==IEEE: property_port_list ; property_port_item: // IEEE: property_port_item/sequence_port_item -//UNSUP // // Merged in sequence_port_item -//UNSUP // // IEEE: property_lvar_port_direction ::= yINPUT -//UNSUP // // prop IEEE: [ yLOCAL [ yINPUT ] ] property_formal_type -//UNSUP // // id {variable_dimension} [ '=' property_actual_arg ] -//UNSUP // // seq IEEE: [ yLOCAL [ sequence_lvar_port_direction ] ] sequence_formal_type -//UNSUP // // id {variable_dimension} [ '=' sequence_actual_arg ] + // // Merged in sequence_port_item + // // IEEE: property_lvar_port_direction ::= yINPUT + // // prop IEEE: [ yLOCAL [ yINPUT ] ] property_formal_type + // // id {variable_dimension} [ '=' property_actual_arg ] + // // seq IEEE: [ yLOCAL [ sequence_lvar_port_direction ] ] sequence_formal_type + // // id {variable_dimension} [ '=' sequence_actual_arg ] property_port_itemFront property_port_itemAssignment { $$ = $2; } ; @@ -6087,13 +6087,16 @@ sexpr: // ==IEEE: sequence_expr (The name sexpr is important as reg // // IEEE: "cycle_delay_range sequence_expr { cycle_delay_range sequence_expr }" // // IEEE: "sequence_expr cycle_delay_range sequence_expr { cycle_delay_range sequence_expr }" // // Both rules basically mean we can repeat sequences, so make it simpler: - //UNSUP cycle_delay_range sexpr %prec yP_POUNDPOUND { } - //UNSUP ~p~sexpr cycle_delay_range sexpr %prec prPOUNDPOUND_MULTI { } + cycle_delay_range sexpr %prec yP_POUNDPOUND + { $$ = $2; BBUNSUP($2->fileline(), "Unsupported: ## (in sequence expression)"); } + | ~p~sexpr cycle_delay_range sexpr %prec prPOUNDPOUND_MULTI + { $$ = $1; BBUNSUP($2->fileline(), "Unsupported: ## (in sequence expression)"); } // // // IEEE: expression_or_dist [ boolean_abbrev ] // // Note expression_or_dist includes "expr"! // // sexpr/*sexpression_or_dist*/ --- Hardcoded below - //UNSUP ~p~sexpr/*sexpression_or_dist*/ boolean_abbrev { } + | ~p~sexpr/*sexpression_or_dist*/ boolean_abbrev + { $$ = $1; BBUNSUP($2->fileline(), "Unsupported: boolean abbrev (in sequence expression)"); } // // // IEEE: "sequence_instance [ sequence_abbrev ]" // // version without sequence_abbrev looks just like normal function call @@ -6105,7 +6108,7 @@ sexpr: // ==IEEE: sequence_expr (The name sexpr is important as reg // // As sequence_expr includes expression_or_dist, and boolean_abbrev includes sequence_abbrev: // // '(' sequence_expr {',' sequence_match_item } ')' [ boolean_abbrev ] // // "'(' sexpr ')' boolean_abbrev" matches "[sexpr:'(' expr ')'] boolean_abbrev" so we can drop it - '(' ~p~sexpr ')' { $$ = $2; } + | '(' ~p~sexpr ')' { $$ = $2; } //UNSUP '(' ~p~sexpr ',' sequence_match_itemList ')' { } // // // AND/OR are between pexprs OR sexprs @@ -6134,20 +6137,32 @@ sexpr: // ==IEEE: sequence_expr (The name sexpr is important as reg | BISONPRE_COPY_ONCE(expr,{s/~l~/s/g; s/~p~/s/g; s/~noPar__IGNORE~'.'/yP_PAR__IGNORE /g; }) // {copied} ; -//UNSUPcycle_delay_range: // IEEE: ==cycle_delay_range -//UNSUP // // These three terms in 1800-2005 ONLY -//UNSUP yP_POUNDPOUND yaINTNUM { } -//UNSUP | yP_POUNDPOUND id { } -//UNSUP | yP_POUNDPOUND '(' constExpr ')' { } -//UNSUP // // In 1800-2009 ONLY: -//UNSUP // // IEEE: yP_POUNDPOUND constant_primary -//UNSUP // // UNSUP: This causes a big grammer ambiguity -//UNSUP // // as ()'s mismatch between primary and the following statement -//UNSUP // // the sv-ac committee has been asked to clarify (Mantis 1901) -//UNSUP | yP_POUNDPOUND anyrange { } -//UNSUP | yP_POUNDPOUND yP_BRASTAR ']' { } -//UNSUP | yP_POUNDPOUND yP_BRAPLUSKET { } -//UNSUP ; +cycle_delay_range: // IEEE: ==cycle_delay_range + // // These three terms in 1800-2005 ONLY + yP_POUNDPOUND intnumAsConst + { $$ = $2; + BBUNSUP($1, "Unsupported: ## () cycle delay range expression"); } + | yP_POUNDPOUND id + { $$ = new AstConst{$1, AstConst::BitFalse{}}; + BBUNSUP($1, "Unsupported: ## id cycle delay range expression"); } + | yP_POUNDPOUND '(' constExpr ')' + { $$ = $3; + BBUNSUP($1, "Unsupported: ## () cycle delay range expression"); } + // // In 1800-2009 ONLY: + // // IEEE: yP_POUNDPOUND constant_primary + // // UNSUP: This causes a big grammer ambiguity + // // as ()'s mismatch between primary and the following statement + // // the sv-ac committee has been asked to clarify (Mantis 1901) + | yP_POUNDPOUND anyrange + { $$ = new AstConst{$1, AstConst::BitFalse{}}; + BBUNSUP($1, "Unsupported: ## range cycle delay range expression"); } + | yP_POUNDPOUND yP_BRASTAR ']' + { $$ = new AstConst{$1, AstConst::BitFalse{}}; + BBUNSUP($1, "Unsupported: ## [*] cycle delay range expression"); } + | yP_POUNDPOUND yP_BRAPLUSKET + { $$ = new AstConst{$1, AstConst::BitFalse{}}; + BBUNSUP($1, "Unsupported: ## [+] cycle delay range expression"); } + ; //UNSUPsequence_match_itemList: // IEEE: [sequence_match_item] part of sequence_expr //UNSUP sequence_match_item { $$ = $1; } @@ -6162,30 +6177,29 @@ sexpr: // ==IEEE: sequence_expr (The name sexpr is important as reg //UNSUP for_step_assignment { $$ = $1; } //UNSUP ; -//UNSUPboolean_abbrev: // ==IEEE: boolean_abbrev -//UNSUP // // IEEE: consecutive_repetition -//UNSUP yP_BRASTAR const_or_range_expression ']' { } -//UNSUP | yP_BRASTAR ']' { } -//UNSUP | yP_BRAPLUSKET { $$ = $1; } -//UNSUP // // IEEE: non_consecutive_repetition -//UNSUP | yP_BRAEQ const_or_range_expression ']' { } -//UNSUP // // IEEE: goto_repetition -//UNSUP | yP_BRAMINUSGT const_or_range_expression ']' { } -//UNSUP ; - -//UNSUPconst_or_range_expression: // ==IEEE: const_or_range_expression -//UNSUP constExpr { $$ = $1; } -//UNSUP | cycle_delay_const_range_expression { } // Use anyrange removing [] instead -//UNSUP ; - -//UNSUPconstant_range: // ==IEEE: constant_range -//UNSUP constExpr ':' constExpr { } -//UNSUP ; - -//UNSUPcycle_delay_const_range_expression: // ==IEEE: cycle_delay_const_range_expression -//UNSUP // // Note '$' is part of constExpr -//UNSUP constExpr ':' constExpr { } -//UNSUP ; +boolean_abbrev: // ==IEEE: boolean_abbrev + // // IEEE: consecutive_repetition + yP_BRASTAR constExpr ']' { } + { $$ = $2; BBUNSUP($1, "Unsupported: [*] boolean abbrev expression"); } + | yP_BRASTAR constExpr ':' constExpr ']' { } + { $$ = $2; BBUNSUP($1, "Unsupported: [*] boolean abbrev expression"); } + | yP_BRASTAR ']' + { $$ = new AstConst{$1, AstConst::BitFalse{}}; + BBUNSUP($1, "Unsupported: [*] boolean abbrev expression"); } + | yP_BRAPLUSKET + { $$ = new AstConst{$1, AstConst::BitFalse{}}; + BBUNSUP($1, "Unsupported: [+] boolean abbrev expression"); } + // // IEEE: non_consecutive_repetition + | yP_BRAEQ constExpr ']' + { $$ = $2; BBUNSUP($1, "Unsupported: [= boolean abbrev expression"); } + | yP_BRAEQ constExpr ':' constExpr ']' + { $$ = $2; BBUNSUP($1, "Unsupported: [= boolean abbrev expression"); } + // // IEEE: goto_repetition + | yP_BRAMINUSGT constExpr ']' + { $$ = $2; BBUNSUP($1, "Unsupported: [-> boolean abbrev expression"); } + | yP_BRAMINUSGT constExpr ':' constExpr ']' + { $$ = $2; BBUNSUP($1, "Unsupported: [-> boolean abbrev expression"); } + ; //************************************************ // Let diff --git a/test_regress/t/t_sequence_sexpr_unsup.out b/test_regress/t/t_sequence_sexpr_unsup.out index 8e7445790..1f322e376 100644 --- a/test_regress/t/t_sequence_sexpr_unsup.out +++ b/test_regress/t/t_sequence_sexpr_unsup.out @@ -1,32 +1,144 @@ -%Error-UNSUPPORTED: t/t_sequence_sexpr_unsup.v:25:14: Unsupported: within (in sequence expression) - 25 | weak(a within(b)); +%Error-UNSUPPORTED: t/t_sequence_sexpr_unsup.v:27:14: Unsupported: within (in sequence expression) + 27 | weak(a within(b)); | ^~~~~~ ... For error description see https://verilator.org/warn/UNSUPPORTED?v=latest -%Error-UNSUPPORTED: t/t_sequence_sexpr_unsup.v:25:11: Unsupported: weak (in property expression) - 25 | weak(a within(b)); +%Error-UNSUPPORTED: t/t_sequence_sexpr_unsup.v:27:11: Unsupported: weak (in property expression) + 27 | weak(a within(b)); | ^ -%Error-UNSUPPORTED: t/t_sequence_sexpr_unsup.v:29:14: Unsupported: and (in sequence expression) - 29 | weak(a and b); +%Error-UNSUPPORTED: t/t_sequence_sexpr_unsup.v:31:14: Unsupported: and (in sequence expression) + 31 | weak(a and b); | ^~~ -%Error-UNSUPPORTED: t/t_sequence_sexpr_unsup.v:29:11: Unsupported: weak (in property expression) - 29 | weak(a and b); +%Error-UNSUPPORTED: t/t_sequence_sexpr_unsup.v:31:11: Unsupported: weak (in property expression) + 31 | weak(a and b); | ^ -%Error-UNSUPPORTED: t/t_sequence_sexpr_unsup.v:33:14: Unsupported: or (in sequence expression) - 33 | weak(a or b); +%Error-UNSUPPORTED: t/t_sequence_sexpr_unsup.v:35:14: Unsupported: or (in sequence expression) + 35 | weak(a or b); | ^~ -%Error-UNSUPPORTED: t/t_sequence_sexpr_unsup.v:33:11: Unsupported: weak (in property expression) - 33 | weak(a or b); +%Error-UNSUPPORTED: t/t_sequence_sexpr_unsup.v:35:11: Unsupported: weak (in property expression) + 35 | weak(a or b); | ^ -%Error-UNSUPPORTED: t/t_sequence_sexpr_unsup.v:37:14: Unsupported: throughout (in sequence expression) - 37 | weak(a throughout b); +%Error-UNSUPPORTED: t/t_sequence_sexpr_unsup.v:39:14: Unsupported: throughout (in sequence expression) + 39 | weak(a throughout b); | ^~~~~~~~~~ -%Error-UNSUPPORTED: t/t_sequence_sexpr_unsup.v:37:11: Unsupported: weak (in property expression) - 37 | weak(a throughout b); +%Error-UNSUPPORTED: t/t_sequence_sexpr_unsup.v:39:11: Unsupported: weak (in property expression) + 39 | weak(a throughout b); | ^ -%Error-UNSUPPORTED: t/t_sequence_sexpr_unsup.v:41:14: Unsupported: intersect (in sequence expression) - 41 | weak(a intersect b); +%Error-UNSUPPORTED: t/t_sequence_sexpr_unsup.v:43:14: Unsupported: intersect (in sequence expression) + 43 | weak(a intersect b); | ^~~~~~~~~ -%Error-UNSUPPORTED: t/t_sequence_sexpr_unsup.v:41:11: Unsupported: weak (in property expression) - 41 | weak(a intersect b); +%Error-UNSUPPORTED: t/t_sequence_sexpr_unsup.v:43:11: Unsupported: weak (in property expression) + 43 | weak(a intersect b); | ^ -%Error: Exiting due to +%Error-UNSUPPORTED: t/t_sequence_sexpr_unsup.v:47:12: Unsupported: ## () cycle delay range expression + 47 | weak(## 1 b); + | ^~ +%Error-UNSUPPORTED: t/t_sequence_sexpr_unsup.v:47:17: Unsupported: ## (in sequence expression) + 47 | weak(## 1 b); + | ^ +%Error-UNSUPPORTED: t/t_sequence_sexpr_unsup.v:47:11: Unsupported: weak (in property expression) + 47 | weak(## 1 b); + | ^ +%Error-UNSUPPORTED: t/t_sequence_sexpr_unsup.v:50:12: Unsupported: ## id cycle delay range expression + 50 | weak(## DELAY b); + | ^~ +%Error-UNSUPPORTED: t/t_sequence_sexpr_unsup.v:50:21: Unsupported: ## (in sequence expression) + 50 | weak(## DELAY b); + | ^ +%Error-UNSUPPORTED: t/t_sequence_sexpr_unsup.v:50:11: Unsupported: weak (in property expression) + 50 | weak(## DELAY b); + | ^ +%Error-UNSUPPORTED: t/t_sequence_sexpr_unsup.v:53:12: Unsupported: ## () cycle delay range expression + 53 | weak(## ( DELAY ) b); + | ^~ +%Error-UNSUPPORTED: t/t_sequence_sexpr_unsup.v:53:25: Unsupported: ## (in sequence expression) + 53 | weak(## ( DELAY ) b); + | ^ +%Error-UNSUPPORTED: t/t_sequence_sexpr_unsup.v:53:11: Unsupported: weak (in property expression) + 53 | weak(## ( DELAY ) b); + | ^ +%Error-UNSUPPORTED: t/t_sequence_sexpr_unsup.v:56:12: Unsupported: ## range cycle delay range expression + 56 | weak(## [1:2] b); + | ^~ +%Error-UNSUPPORTED: t/t_sequence_sexpr_unsup.v:56:21: Unsupported: ## (in sequence expression) + 56 | weak(## [1:2] b); + | ^ +%Error-UNSUPPORTED: t/t_sequence_sexpr_unsup.v:56:11: Unsupported: weak (in property expression) + 56 | weak(## [1:2] b); + | ^ +%Error-UNSUPPORTED: t/t_sequence_sexpr_unsup.v:59:12: Unsupported: ## [*] cycle delay range expression + 59 | weak(## [*] b); + | ^~ +%Error-UNSUPPORTED: t/t_sequence_sexpr_unsup.v:59:19: Unsupported: ## (in sequence expression) + 59 | weak(## [*] b); + | ^ +%Error-UNSUPPORTED: t/t_sequence_sexpr_unsup.v:59:11: Unsupported: weak (in property expression) + 59 | weak(## [*] b); + | ^ +%Error-UNSUPPORTED: t/t_sequence_sexpr_unsup.v:62:12: Unsupported: ## [+] cycle delay range expression + 62 | weak(## [+] b); + | ^~ +%Error-UNSUPPORTED: t/t_sequence_sexpr_unsup.v:62:19: Unsupported: ## (in sequence expression) + 62 | weak(## [+] b); + | ^ +%Error-UNSUPPORTED: t/t_sequence_sexpr_unsup.v:62:11: Unsupported: weak (in property expression) + 62 | weak(## [+] b); + | ^ +%Error-UNSUPPORTED: t/t_sequence_sexpr_unsup.v:66:14: Unsupported: ## () cycle delay range expression + 66 | weak(a ## 1 b); + | ^~ +%Error-UNSUPPORTED: t/t_sequence_sexpr_unsup.v:66:17: Unsupported: ## (in sequence expression) + 66 | weak(a ## 1 b); + | ^ +%Error-UNSUPPORTED: t/t_sequence_sexpr_unsup.v:66:11: Unsupported: weak (in property expression) + 66 | weak(a ## 1 b); + | ^ +%Error-UNSUPPORTED: t/t_sequence_sexpr_unsup.v:69:14: Unsupported: ## id cycle delay range expression + 69 | weak(a ## DELAY b); + | ^~ +%Error-UNSUPPORTED: t/t_sequence_sexpr_unsup.v:69:14: Unsupported: ## (in sequence expression) + 69 | weak(a ## DELAY b); + | ^~ +%Error-UNSUPPORTED: t/t_sequence_sexpr_unsup.v:69:11: Unsupported: weak (in property expression) + 69 | weak(a ## DELAY b); + | ^ +%Error-UNSUPPORTED: t/t_sequence_sexpr_unsup.v:72:14: Unsupported: ## () cycle delay range expression + 72 | weak(a ## ( DELAY ) b); + | ^~ +%Error-UNSUPPORTED: t/t_sequence_sexpr_unsup.v:72:19: Unsupported: ## (in sequence expression) + 72 | weak(a ## ( DELAY ) b); + | ^~~~~ +%Error-UNSUPPORTED: t/t_sequence_sexpr_unsup.v:72:11: Unsupported: weak (in property expression) + 72 | weak(a ## ( DELAY ) b); + | ^ +%Error-UNSUPPORTED: t/t_sequence_sexpr_unsup.v:75:14: Unsupported: ## range cycle delay range expression + 75 | weak(a ## [1:2] b); + | ^~ +%Error-UNSUPPORTED: t/t_sequence_sexpr_unsup.v:75:14: Unsupported: ## (in sequence expression) + 75 | weak(a ## [1:2] b); + | ^~ +%Error-UNSUPPORTED: t/t_sequence_sexpr_unsup.v:75:11: Unsupported: weak (in property expression) + 75 | weak(a ## [1:2] b); + | ^ +%Error-UNSUPPORTED: t/t_sequence_sexpr_unsup.v:78:14: Unsupported: ## [*] cycle delay range expression + 78 | weak(a ## [*] b); + | ^~ +%Error-UNSUPPORTED: t/t_sequence_sexpr_unsup.v:78:14: Unsupported: ## (in sequence expression) + 78 | weak(a ## [*] b); + | ^~ +%Error-UNSUPPORTED: t/t_sequence_sexpr_unsup.v:78:11: Unsupported: weak (in property expression) + 78 | weak(a ## [*] b); + | ^ +%Error-UNSUPPORTED: t/t_sequence_sexpr_unsup.v:81:14: Unsupported: ## [+] cycle delay range expression + 81 | weak(a ## [+] b); + | ^~ +%Error-UNSUPPORTED: t/t_sequence_sexpr_unsup.v:81:14: Unsupported: ## (in sequence expression) + 81 | weak(a ## [+] b); + | ^~ +%Error-UNSUPPORTED: t/t_sequence_sexpr_unsup.v:81:11: Unsupported: weak (in property expression) + 81 | weak(a ## [+] b); + | ^ +%Error: t/t_sequence_sexpr_unsup.v:85:12: syntax error, unexpected [*, expecting TYPE-IDENTIFIER + 85 | weak([* 1 ] a); + | ^~ +%Error: Cannot continue + ... See the manual at https://verilator.org/verilator_doc.html for more assistance. diff --git a/test_regress/t/t_sequence_sexpr_unsup.v b/test_regress/t/t_sequence_sexpr_unsup.v index eed60e3f0..2f92d7f27 100644 --- a/test_regress/t/t_sequence_sexpr_unsup.v +++ b/test_regress/t/t_sequence_sexpr_unsup.v @@ -14,6 +14,8 @@ module t (/*AUTOARG*/ int b; int cyc = 0; + localparam DELAY = 1; + always @(posedge clk) begin cyc <= cyc + 1; end @@ -41,6 +43,66 @@ module t (/*AUTOARG*/ weak(a intersect b); endproperty + property s_uni_cycdelay_int; + weak(## 1 b); + endproperty + property s_uni_cycdelay_id; + weak(## DELAY b); + endproperty + property s_uni_cycdelay_pid; + weak(## ( DELAY ) b); + endproperty + property s_uni_cycdelay_range; + weak(## [1:2] b); + endproperty + property s_uni_cycdelay_star; + weak(## [*] b); + endproperty + property s_uni_cycdelay_plus; + weak(## [+] b); + endproperty + + property s_cycdelay_int; + weak(a ## 1 b); + endproperty + property s_cycdelay_id; + weak(a ## DELAY b); + endproperty + property s_cycdelay_pid; + weak(a ## ( DELAY ) b); + endproperty + property s_cycdelay_range; + weak(a ## [1:2] b); + endproperty + property s_cycdelay_star; + weak(a ## [*] b); + endproperty + property s_cycdelay_plus; + weak(a ## [+] b); + endproperty + + property s_booleanabbrev_brastar_int; + weak([* 1 ] a); + endproperty + property s_booleanabbrev_brastar; + weak([*] a); + endproperty + property s_booleanabbrev_plus; + weak([+] a); + endproperty + property s_booleanabbrev_eq; + weak([= 1] a); + endproperty + property s_booleanabbrev_eq_range; + weak([= 1:2] a); + endproperty + property s_booleanabbrev_minusgt; + weak([-> 1] a); + endproperty + property s_booleanabbrev_minusgt_range; + weak([-> 1:2] a); + endproperty + always @(posedge clk) begin if (cyc == 10) begin $write("*-* All Finished *-*\n");