@@ -2122,17 +2122,22 @@ net_assignment: net_lvalue '=' expression
21222122 { init($$ , ID_equal); mto($$ , $1 ); mto($$ , $3 ); }
21232123 ;
21242124
2125- variable_assignment : net_assignment ;
2126-
21272125// System Verilog standard 1800-2017
21282126// A.6.2 Procedural blocks and assignments
21292127
2130- initial_construct : TOK_INITIAL statement
2128+ initial_construct : TOK_INITIAL statement_or_null
21312129 { init($$ , ID_initial); mto($$ , $2 ); }
21322130 ;
21332131
2134- always_construct : TOK_ALWAYS statement
2135- { init($$ , ID_always); mto($$ , $2 ); }
2132+ always_construct : always_keyword statement
2133+ { $$ =$1 ; mto($$ , $2 ); }
2134+ ;
2135+
2136+ always_keyword :
2137+ TOK_ALWAYS { init($$ , ID_always); }
2138+ | TOK_ALWAYS_COMB { init($$ , ID_always); }
2139+ | TOK_ALWAYS_LATCH { init($$ , ID_always); }
2140+ | TOK_ALWAYS_FF { init($$ , ID_always); }
21362141 ;
21372142
21382143blocking_assignment :
@@ -2169,36 +2174,21 @@ nonblocking_assignment:
21692174 { init($$ , ID_non_blocking_assign); mto($$ , $1 ); mto($$ , $4 ); }
21702175 ;
21712176
2172- // The extra rule to allow block_item_declaration is to avoid an ambiguity
2173- // caused by the attribute_instance_brace.
2174- statement :
2175- /* block_identifier TOK_COLON attribute_instance_brace statement_item
2176- { $$=$4; }
2177- | */
2178- attribute_instance_brace statement_item
2179- { $$ =$2 ; }
2180- | block_item_declaration
2181- ;
2182-
2183- statement_item :
2184- blocking_assignment ' ;' { $$ = $1 ; }
2185- | nonblocking_assignment ' ;' { $$ = $1 ; }
2186- | case_statement
2187- | concurrent_assertion_statement
2188- | conditional_statement
2189- | inc_or_dec_expression ' ;'
2190- | subroutine_call_statement
2191- | disable_statement
2192- | event_trigger
2193- | loop_statement
2194- | par_block
2195- | procedural_timing_control_statement
2196- | procedural_continuous_assignments ' ;'
2197- | seq_block
2198- | wait_statement
2199- | procedural_assertion_statement
2177+ procedural_continuous_assignment :
2178+ TOK_ASSIGN variable_assignment
2179+ { init($$ , ID_continuous_assign); mto($$ , $2 ); }
2180+ | TOK_DEASSIGN variable_lvalue
2181+ { init($$ , ID_deassign); mto($$ , $2 ); }
2182+ | TOK_FORCE variable_assignment
2183+ { init($$ , ID_force); swapop($$ , $2 ); }
2184+ /* | TOK_FORCE net_assignment */
2185+ | TOK_RELEASE variable_lvalue
2186+ { init($$ , ID_release); mto($$ , $2 ); }
2187+ /* | TOK_RELEASE net_lvalue */
22002188 ;
22012189
2190+ variable_assignment : net_assignment ;
2191+
22022192subroutine_call_statement :
22032193 subroutine_call ' ;'
22042194 { $$ =$1 ; }
@@ -2249,13 +2239,48 @@ concurrent_cover_statement: cover_property_statement
22492239// System Verilog standard 1800-2017
22502240// A.6.4 Statements
22512241
2242+ statement_or_null :
2243+ statement
2244+ | attribute_instance_brace ' ;' { init($$ , ID_skip); }
2245+ ;
2246+
22522247statement_or_null_brace :
22532248 /* Optional */
22542249 { init($$ ); }
22552250 | statement_or_null_brace statement_or_null
22562251 { $$ =$1 ; mto($$ , $2 ); }
22572252 ;
22582253
2254+ // The extra rule to allow block_item_declaration is to avoid an ambiguity
2255+ // caused by the attribute_instance_brace.
2256+ statement :
2257+ /* block_identifier TOK_COLON attribute_instance_brace statement_item
2258+ { $$=$4; }
2259+ | */
2260+ attribute_instance_brace statement_item
2261+ { $$ =$2 ; }
2262+ | block_item_declaration
2263+ ;
2264+
2265+ statement_item :
2266+ blocking_assignment ' ;' { $$ = $1 ; }
2267+ | nonblocking_assignment ' ;' { $$ = $1 ; }
2268+ | case_statement
2269+ | concurrent_assertion_statement
2270+ | conditional_statement
2271+ | inc_or_dec_expression ' ;'
2272+ | subroutine_call_statement
2273+ | disable_statement
2274+ | event_trigger
2275+ | loop_statement
2276+ | par_block
2277+ | procedural_timing_control_statement
2278+ | procedural_continuous_assignment ' ;'
2279+ | seq_block
2280+ | wait_statement
2281+ | procedural_assertion_statement
2282+ ;
2283+
22592284system_task_name : TOK_SYSIDENT
22602285 { init($$ , ID_symbol);
22612286 stack_expr ($$).set(ID_identifier, stack_expr($1 ).id());
@@ -2449,19 +2474,6 @@ wait_statement: TOK_WAIT '(' expression ')' statement_or_null
24492474 { init($$ , ID_wait); mto($$ , $3 ); mto($$ , $5 ); }
24502475 ;
24512476
2452- procedural_continuous_assignments :
2453- TOK_ASSIGN variable_assignment
2454- { init($$ , ID_continuous_assign); mto($$ , $2 ); }
2455- | TOK_DEASSIGN variable_lvalue
2456- { init($$ , ID_deassign); mto($$ , $2 ); }
2457- | TOK_FORCE variable_assignment
2458- { init($$ , ID_force); swapop($$ , $2 ); }
2459- /* | TOK_FORCE net_assignment */
2460- | TOK_RELEASE variable_lvalue
2461- { init($$ , ID_release); mto($$ , $2 ); }
2462- /* | TOK_RELEASE net_lvalue */
2463- ;
2464-
24652477procedural_timing_control_statement :
24662478 procedural_timing_control statement_or_null
24672479 { $$ =$1 ; mto($$ , $2 ); }
@@ -2629,11 +2641,6 @@ system_tf_call:
26292641 ;
26302642
26312643
2632- statement_or_null :
2633- statement
2634- | attribute_instance_brace ' ;' { init($$ , ID_skip); }
2635- ;
2636-
26372644event_trigger : TOK_MINUSGREATER hierarchical_event_identifier ' ;'
26382645 ;
26392646
0 commit comments