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