@@ -375,6 +375,10 @@ int yyverilogerror(const char *error)
375375%token TOK_HASHMINUSHASH " #-#"
376376%token TOK_HASHEQUALHASH " #=#"
377377%token TOK_COLONCOLON " ::"
378+ %token TOK_LSQASTERIC " [*"
379+ %token TOK_LSQPLUS " [+"
380+ %token TOK_LSQEQUAL " [="
381+ %token TOK_LSQMINUSGREATER " [->"
378382
379383/* System Verilog Keywords */
380384%token TOK_ACCEPT_ON " accept_on"
@@ -538,7 +542,7 @@ int yyverilogerror(const char *error)
538542%left " and"
539543%nonassoc " not" " nexttime" " s_nexttime"
540544%left " ##"
541- %nonassoc " [*] " " [=] " " [->] "
545+ %nonassoc " [*" " [=" " [->"
542546
543547// Precendence of Verilog operators,
544548// following System Verilog 1800-2017 Table 11-2.
@@ -2184,7 +2188,9 @@ expression_or_dist_brace:
21842188 ;
21852189
21862190sequence_expr :
2187- expression
2191+ expression_or_dist
2192+ | expression_or_dist boolean_abbrev
2193+ { $$ = $2 ; mto($$ , $1 ); }
21882194 | cycle_delay_range sequence_expr
21892195 { $$ =$1 ; mto($$ , $2 ); }
21902196 | expression cycle_delay_range sequence_expr
@@ -2199,17 +2205,51 @@ sequence_expr:
21992205 { init($$ , ID_sva_sequence_within); mto($$ , $1 ); mto($$ , $3 ); }
22002206 ;
22012207
2208+ boolean_abbrev :
2209+ consecutive_repetition
2210+ | non_consecutive_repetition
2211+ | goto_repetition
2212+ ;
2213+
2214+ sequence_abbrev :
2215+ consecutive_repetition
2216+ ;
2217+
2218+ consecutive_repetition :
2219+ " [*" const_or_range_expression ' ]'
2220+ { init($$ , ID_sva_sequence_consecutive_repetition); mto($$ , $2 ); }
2221+ | " [*" ' ]'
2222+ { init($$ , ID_sva_sequence_repetition_star); }
2223+ | " [+" ' ]'
2224+ { init($$ , ID_sva_sequence_repetition_plus); }
2225+ ;
2226+
2227+ non_consecutive_repetition :
2228+ " [=" const_or_range_expression ' ]'
2229+ { init($$ , ID_sva_sequence_non_consecutive_repetition); mto($$ , $2 ); }
2230+ ;
2231+
2232+ goto_repetition :
2233+ " [->" const_or_range_expression ' ]'
2234+ { init($$ , ID_sva_sequence_goto_repetition); mto($$ , $2 ); }
2235+ ;
2236+
22022237cycle_delay_range :
22032238 " ##" number
22042239 { init($$ , ID_sva_cycle_delay); mto($$ , $2 ); stack_expr($$ ).operands().push_back(nil_exprt()); }
22052240 | " ##" ' [' cycle_delay_const_range_expression ' ]'
22062241 { $$ = $3 ; }
2207- | " ##" ' [ ' TOK_ASTERIC ' ]'
2242+ | " ##" " [* " ' ]'
22082243 { init($$ , ID_sva_cycle_delay_star); }
2209- | " ##" ' [ ' TOK_PLUS ' ]'
2244+ | " ##" " [+ " ' ]'
22102245 { init($$ , ID_sva_cycle_delay_plus); }
22112246 ;
22122247
2248+ const_or_range_expression :
2249+ constant_expression
2250+ | cycle_delay_const_range_expression
2251+ ;
2252+
22132253cycle_delay_const_range_expression :
22142254 constant_expression TOK_COLON constant_expression
22152255 { init($$ , ID_sva_cycle_delay); mto($$ , $1 ); mto($$ , $3 ); }
0 commit comments