Skip to content

Commit a58a770

Browse files
committed
SMV: bit selection operator
This adds the [ : ] bit selection operator to the SMV frontend.
1 parent 3f0410b commit a58a770

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/smvlang/parser.y

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -297,6 +297,7 @@ static void new_module(YYSTYPE &module)
297297
%left COLONCOLON_Token
298298
%left UMINUS /* supplies precedence for unary minus */
299299
%left DOT_Token
300+
%nonassoc '['
300301

301302
%%
302303

@@ -690,6 +691,8 @@ term : variable_name
690691
| term mod_Token term { binary($$, $1, ID_mod, $3); }
691692
| term GTGT_Token term { binary($$, $1, ID_shr, $3); }
692693
| term LTLT_Token term { binary($$, $1, ID_shl, $3); }
694+
| term '[' NUMBER_Token ',' NUMBER_Token ']' // bit selection
695+
{ init($$, ID_extractbits); mto($$, $1); mto($$, $3); mto($$, $5); }
693696
| term COLONCOLON_Token term { binary($$, $1, ID_concatenation, $3); }
694697
| term TIMES_Token term { binary($$, $1, ID_mult, $3); }
695698
| term DIVIDE_Token term { binary($$, $1, ID_div, $3); }

0 commit comments

Comments
 (0)