From 15dcd326f8b7da571d6dfbe9806f720277689674 Mon Sep 17 00:00:00 2001 From: Wilson Snyder Date: Sun, 5 Mar 2023 18:30:43 -0500 Subject: [PATCH] Internals: Parse weak/strong but do not lex --- src/verilog.y | 122 +++++++++++++++++++++++++------------------------- 1 file changed, 62 insertions(+), 60 deletions(-) diff --git a/src/verilog.y b/src/verilog.y index 81db2fb99..494b3d532 100644 --- a/src/verilog.y +++ b/src/verilog.y @@ -722,7 +722,7 @@ BISONPRE_VERSION(3.7,%define api.header.include {"V3ParseBison.h"}) %token ySTATIC__ETC "static" %token ySTATIC__LEX "static-in-lex" %token ySTRING "string" -//UNSUP %token ySTRONG "strong" +%token ySTRONG "strong" %token ySTRONG0 "strong0" %token ySTRONG1 "strong1" %token ySTRUCT "struct" @@ -779,7 +779,7 @@ BISONPRE_VERSION(3.7,%define api.header.include {"V3ParseBison.h"}) %token yWAIT "wait" //UNSUP %token yWAIT_ORDER "wait_order" %token yWAND "wand" -//UNSUP %token yWEAK "weak" +%token yWEAK "weak" %token yWEAK0 "weak0" %token yWEAK1 "weak1" %token yWHILE "while" @@ -1005,7 +1005,7 @@ BISONPRE_VERSION(3.7,%define api.header.include {"V3ParseBison.h"}) %token yP_COLON__BEGIN ":-begin" %token yP_COLON__FORK ":-fork" -//UNSUP %token yP_PAR__IGNORE "(-ignored" // Used when sequence_expr:expr:( is ignored +%token yP_PAR__IGNORE "(-ignored" // Used when sequence_expr:expr:( is ignored %token yP_PAR__STRENGTH "(-for-strength" %token yP_LTMINUSGT "<->" @@ -3698,9 +3698,9 @@ finc_or_dec_expression: // ==IEEE: inc_or_dec_expression BISONPRE_COPY(inc_or_dec_expression,{s/~l~/f/g}) // {copied} ; -//UNSUPsinc_or_dec_expression: // IEEE: inc_or_dec_expression (for sequence_expression) -//UNSUP BISONPRE_COPY(inc_or_dec_expression,{s/~l~/s/g}) // {copied} -//UNSUP ; +sinc_or_dec_expression: // IEEE: inc_or_dec_expression (for sequence_expression) + 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} @@ -4931,9 +4931,9 @@ fexprOkLvalue: // exprOkLValue, For use as first part of st BISONPRE_COPY(exprOkLvalue,{s/~l~/f/g}) // {copied} ; -//UNSUPsexprOkLvalue: // exprOkLValue, For use by sequence_expr -//UNSUP BISONPRE_COPY(exprOkLvalue,{s/~l~/s/g}) // {copied} -//UNSUP ; +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} @@ -4974,9 +4974,9 @@ fexprScope: // exprScope, For use as first part of state BISONPRE_COPY(exprScope,{s/~l~/f/g}) // {copied} ; -//UNSUPsexprScope: // exprScope, For use by sequence_expr -//UNSUP BISONPRE_COPY(exprScope,{s/~l~/s/g}) // {copied} -//UNSUP ; +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} @@ -6017,8 +6017,10 @@ complex_pexpr: // IEEE: part of property_expr, see comments there // // Expanded below // | yNOT pexpr %prec prNEGATION { $$ = new AstLogNot{$1, $2}; } - //UNSUP ySTRONG '(' sexpr ')' { } - //UNSUP yWEAK '(' sexpr ')' { } + | ySTRONG '(' sexpr ')' + { $$ = $3; BBUNSUP($2, "Unsupported: strong (in property expression)"); } + | yWEAK '(' sexpr ')' + { $$ = $3; BBUNSUP($2, "Unsupported: weak (in property expression)"); } // // IEEE: pexpr yOR pexpr // // IEEE: pexpr yAND pexpr // // Under ~p~sexpr and/or ~p~sexpr @@ -6072,52 +6074,52 @@ complex_pexpr: // IEEE: part of property_expr, see comments there //UNSUP BISONPRE_COPY_ONCE(expr,{s/~l~/p/g; s/~p~/p/g; s/~noPar__IGNORE~'.'/yP_PAR__IGNORE /g; }) // {copied} ; -//UNSUPsexpr: // ==IEEE: sequence_expr (The name sexpr is important as regexps just add an "s" to expr.) -//UNSUP // // ********* RULES COPIED IN sequence_exprProp -//UNSUP // // For precedence, see IEEE 17.7.1 -//UNSUP // -//UNSUP // // IEEE: "cycle_delay_range sequence_expr { cycle_delay_range sequence_expr }" -//UNSUP // // IEEE: "sequence_expr cycle_delay_range sequence_expr { cycle_delay_range sequence_expr }" -//UNSUP // // 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 { } -//UNSUP // -//UNSUP // // IEEE: expression_or_dist [ boolean_abbrev ] -//UNSUP // // Note expression_or_dist includes "expr"! -//UNSUP // // sexpr/*sexpression_or_dist*/ --- Hardcoded below -//UNSUP | ~p~sexpr/*sexpression_or_dist*/ boolean_abbrev { } -//UNSUP // -//UNSUP // // IEEE: "sequence_instance [ sequence_abbrev ]" -//UNSUP // // version without sequence_abbrev looks just like normal function call -//UNSUP // // version w/sequence_abbrev matches above; -//UNSUP // // expression_or_dist:expr:func boolean_abbrev:sequence_abbrev -//UNSUP // -//UNSUP // // IEEE: '(' expression_or_dist {',' sequence_match_item } ')' [ boolean_abbrev ] -//UNSUP // // IEEE: '(' sexpr {',' sequence_match_item } ')' [ sequence_abbrev ] -//UNSUP // // As sequence_expr includes expression_or_dist, and boolean_abbrev includes sequence_abbrev: -//UNSUP // // '(' sequence_expr {',' sequence_match_item } ')' [ boolean_abbrev ] -//UNSUP // // "'(' sexpr ')' boolean_abbrev" matches "[sexpr:'(' expr ')'] boolean_abbrev" so we can drop it -//UNSUP | '(' ~p~sexpr ')' { $$ = $1; $$ = ...; } -//UNSUP | '(' ~p~sexpr ',' sequence_match_itemList ')' { } -//UNSUP // -//UNSUP // // AND/OR are between pexprs OR sexprs -//UNSUP | ~p~sexpr yAND ~p~sexpr { $$ = $1; $$ = ...; } -//UNSUP | ~p~sexpr yOR ~p~sexpr { $$ = $1; $$ = ...; } -//UNSUP // // Intersect always has an sexpr rhs -//UNSUP | ~p~sexpr yINTERSECT sexpr { $$ = $1; $$ = ...; } -//UNSUP // -//UNSUP | yFIRST_MATCH '(' sexpr ')' { } -//UNSUP | yFIRST_MATCH '(' sexpr ',' sequence_match_itemList ')' { } -//UNSUP | ~p~sexpr/*sexpression_or_dist*/ yTHROUGHOUT sexpr { } -//UNSUP // // Below pexpr's are really sequence_expr, but avoid conflict -//UNSUP // // IEEE: sexpr yWITHIN sexpr -//UNSUP | ~p~sexpr yWITHIN sexpr { $$ = $1; $$ = ...; } -//UNSUP // // Note concurrent_assertion had duplicate rule for below -//UNSUP | clocking_event ~p~sexpr %prec prSEQ_CLOCKING { } -//UNSUP // -//UNSUP //============= expr rules copied for sequence_expr -//UNSUP | BISONPRE_COPY_ONCE(expr,{s/~l~/s/g; s/~p~/s/g; s/~noPar__IGNORE~'.'/yP_PAR__IGNORE /g; }) // {copied} -//UNSUP ; +sexpr: // ==IEEE: sequence_expr (The name sexpr is important as regexps just add an "s" to expr.) + // // ********* RULES COPIED IN sequence_exprProp + // // For precedence, see IEEE 17.7.1 + // + // // 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 { } + // + // // 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 { } + // + // // IEEE: "sequence_instance [ sequence_abbrev ]" + // // version without sequence_abbrev looks just like normal function call + // // version w/sequence_abbrev matches above; + // // expression_or_dist:expr:func boolean_abbrev:sequence_abbrev + // + // // IEEE: '(' expression_or_dist {',' sequence_match_item } ')' [ boolean_abbrev ] + // // IEEE: '(' sexpr {',' sequence_match_item } ')' [ sequence_abbrev ] + // // 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; } + //UNSUP '(' ~p~sexpr ',' sequence_match_itemList ')' { } + // + // // AND/OR are between pexprs OR sexprs + //UNSUP ~p~sexpr yAND ~p~sexpr { $$ = new AstLogAnd{$2, $1, $3}; } + //UNSUP ~p~sexpr yOR ~p~sexpr { $$ = new AstLogOr{$2, $1, $3}; } + // // Intersect always has an sexpr rhs + //UNSUP ~p~sexpr yINTERSECT sexpr { $$ = $1; $$ = ...; } + // + //UNSUP yFIRST_MATCH '(' sexpr ')' { } + //UNSUP yFIRST_MATCH '(' sexpr ',' sequence_match_itemList ')' { } + //UNSUP ~p~sexpr/*sexpression_or_dist*/ yTHROUGHOUT sexpr { } + // // Below pexpr's are really sequence_expr, but avoid conflict + // // IEEE: sexpr yWITHIN sexpr + //UNSUP ~p~sexpr yWITHIN sexpr { $$ = $1; $$ = ...; } + // // Note concurrent_assertion had duplicate rule for below + //UNSUP clocking_event ~p~sexpr %prec prSEQ_CLOCKING { } + // + //============= expr rules copied for sequence_expr + | 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