@@ -911,13 +911,6 @@ part_select:
911
911
{ init($$ , ID_part_select); mto($$ , $2 ); mto($$ , $4 ); }
912
912
;
913
913
914
- indexed_part_select :
915
- ' [' const_expression TOK_PLUSCOLON const_expression ' ]'
916
- { init($$ , ID_indexed_part_select_plus); mto($$ , $2 ); mto($$ , $4 ); }
917
- | ' [' const_expression TOK_MINUSCOLON const_expression ' ]'
918
- { init($$ , ID_indexed_part_select_minus); mto($$ , $2 ); mto($$ , $4 ); }
919
- ;
920
-
921
914
// System Verilog standard 1800-2017
922
915
// A.2.1.3 Type declarations
923
916
@@ -2615,15 +2608,30 @@ inc_or_dec_expression:
2615
2608
{ init($$ , ID_postdecrement); mto($$ , $1 ); }
2616
2609
;
2617
2610
2611
+ constant_range :
2612
+ const_expression TOK_COLON const_expression
2613
+ { init($$ , ID_part_select); mto($$ , $1 ); mto($$ , $3 ); }
2614
+ ;
2615
+
2616
+ indexed_range :
2617
+ expression TOK_PLUSCOLON constant_expression
2618
+ { init($$ , ID_indexed_part_select_plus); mto($$ , $1 ); mto($$ , $3 ); }
2619
+ | expression TOK_MINUSCOLON constant_expression
2620
+ { init($$ , ID_indexed_part_select_minus); mto($$ , $1 ); mto($$ , $3 ); }
2621
+ ;
2622
+
2623
+ part_select_range :
2624
+ constant_range
2625
+ | indexed_range
2626
+ ;
2627
+
2618
2628
// System Verilog standard 1800-2017
2619
2629
// A.8.4 Primaries
2620
2630
2621
2631
primary : primary_literal
2622
2632
| indexed_variable_lvalue
2623
- | indexed_variable_lvalue part_select
2624
- { extractbits($$ , $1 , $2 ); }
2625
- | indexed_variable_lvalue indexed_part_select
2626
- { extractbits($$ , $1 , $2 ); }
2633
+ | indexed_variable_lvalue ' [' part_select_range ' ]'
2634
+ { extractbits($$ , $1 , $3 ); }
2627
2635
| concatenation
2628
2636
| replication
2629
2637
| function_subroutine_call
@@ -2650,10 +2658,8 @@ net_lvalue: variable_lvalue;
2650
2658
2651
2659
variable_lvalue :
2652
2660
indexed_variable_lvalue
2653
- | indexed_variable_lvalue part_select
2654
- { extractbits($$ , $1 , $2 ); }
2655
- | indexed_variable_lvalue indexed_part_select
2656
- { extractbits($$ , $1 , $2 ); }
2661
+ | indexed_variable_lvalue ' [' part_select_range ' ]'
2662
+ { extractbits($$ , $1 , $3 ); }
2657
2663
| concatenation
2658
2664
/* more generous than the rule below to avoid conflict */
2659
2665
/*
0 commit comments