From 90360d40fd6f6d0d6e26ab51d03415cf2ae6d9b4 Mon Sep 17 00:00:00 2001 From: Wilson Snyder Date: Sun, 5 Mar 2023 18:52:55 -0500 Subject: [PATCH] Change property expression handling towards eventual more general expressions. --- src/verilog.y | 41 ++++++++++++----------------------------- 1 file changed, 12 insertions(+), 29 deletions(-) diff --git a/src/verilog.y b/src/verilog.y index 494b3d532..854136a24 100644 --- a/src/verilog.y +++ b/src/verilog.y @@ -3702,9 +3702,9 @@ sinc_or_dec_expression: // IEEE: inc_or_dec_expression (for sequence BISONPRE_COPY(inc_or_dec_expression,{s/~l~/s/g}) // {copied} ; -//UNSUPpinc_or_dec_expression: // IEEE: inc_or_dec_expression (for property_expression) -//UNSUP BISONPRE_COPY(inc_or_dec_expression,{s/~l~/p/g}) // {copied} -//UNSUP ; +pinc_or_dec_expression: // IEEE: inc_or_dec_expression (for property_expression) + BISONPRE_COPY(inc_or_dec_expression,{s/~l~/p/g}) // {copied} + ; //UNSUPev_inc_or_dec_expression: // IEEE: inc_or_dec_expression (for ev_expr) //UNSUP BISONPRE_COPY(inc_or_dec_expression,{s/~l~/ev_/g}) // {copied} @@ -4935,9 +4935,9 @@ sexprOkLvalue: // exprOkLValue, For use by sequence_expr BISONPRE_COPY(exprOkLvalue,{s/~l~/s/g}) // {copied} ; -//UNSUPpexprOkLvalue: // exprOkLValue, For use by property_expr -//UNSUP BISONPRE_COPY(exprOkLvalue,{s/~l~/p/g}) // {copied} -//UNSUP ; +pexprOkLvalue: // exprOkLValue, For use by property_expr + BISONPRE_COPY(exprOkLvalue,{s/~l~/p/g}) // {copied} + ; //UNSUPev_exprOkLvalue: // exprOkLValue, For use by ev_expr //UNSUP BISONPRE_COPY(exprOkLvalue,{s/~l~/ev_/g}) // {copied} @@ -4978,9 +4978,9 @@ sexprScope: // exprScope, For use by sequence_expr BISONPRE_COPY(exprScope,{s/~l~/s/g}) // {copied} ; -//UNSUPpexprScope: // exprScope, For use by property_expr -//UNSUP BISONPRE_COPY(exprScope,{s/~l~/p/g}) // {copied} -//UNSUP ; +pexprScope: // exprScope, For use by property_expr + BISONPRE_COPY(exprScope,{s/~l~/p/g}) // {copied} + ; //UNSUPev_exprScope: // exprScope, For use by ev_expr //UNSUP BISONPRE_COPY(exprScope,{s/~l~/ev_/g}) // {copied} @@ -5992,23 +5992,6 @@ property_spec: // IEEE: property_spec //UNSUP ; pexpr: // IEEE: property_expr (The name pexpr is important as regexps just add an "p" to expr.) - //UNSUP: This rule has been super-specialized to what is supported now - //UNSUP remove below - // - // This rule is divided between expr and complex_pexpr to avoid an ambiguity in SystemVerilog grammar. - // Both pexpr and expr can consist of parentheses, and so a pexpr "((expr))" can be reduced in two ways: - // 1. ((expr)) -> (pexpr) -> pexpr - // 2. ((expr)) -> (expr) -> pexpr - // The division below forces YACC to always assume the parentheses reduce to expr, unless they enclose - // operators that can only appear in a pexpr. - // - complex_pexpr { $$ = $1; } - | expr { $$ = $1; } - ; - -complex_pexpr: // IEEE: part of property_expr, see comments there - '(' complex_pexpr ')' { $$ = $2; } - //UNSUP remove above, use below: // // // IEEE: sequence_expr // // Expanded below @@ -6016,7 +5999,7 @@ complex_pexpr: // IEEE: part of property_expr, see comments there // // IEEE: '(' pexpr ')' // // Expanded below // - | yNOT pexpr %prec prNEGATION { $$ = new AstLogNot{$1, $2}; } + yNOT pexpr %prec prNEGATION { $$ = new AstLogNot{$1, $2}; } | ySTRONG '(' sexpr ')' { $$ = $3; BBUNSUP($2, "Unsupported: strong (in property expression)"); } | yWEAK '(' sexpr ')' @@ -6068,10 +6051,10 @@ complex_pexpr: // IEEE: part of property_expr, see comments there //UNSUP clocking_event yDISABLE yIFF '(' expr ')' pexpr %prec prSEQ_CLOCKING { } // //============= sexpr rules copied for property_expr - //UNSUP BISONPRE_COPY_ONCE(sexpr,{s/~p~s/p/g; }) // {copied} + | BISONPRE_COPY_ONCE(sexpr,{s/~p~s/p/g; }) // {copied} // //============= expr rules copied for property_expr - //UNSUP BISONPRE_COPY_ONCE(expr,{s/~l~/p/g; s/~p~/p/g; s/~noPar__IGNORE~'.'/yP_PAR__IGNORE /g; }) // {copied} + | BISONPRE_COPY_ONCE(expr,{s/~l~/p/g; s/~p~/p/g; s/~noPar__IGNORE~'.'/yP_PAR__IGNORE /g; }) // {copied} ; sexpr: // ==IEEE: sequence_expr (The name sexpr is important as regexps just add an "s" to expr.)