aboutsummaryrefslogtreecommitdiff
path: root/src/main/antlr4/FIRRTL.g4
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/antlr4/FIRRTL.g4')
-rw-r--r--src/main/antlr4/FIRRTL.g422
1 files changed, 14 insertions, 8 deletions
diff --git a/src/main/antlr4/FIRRTL.g4 b/src/main/antlr4/FIRRTL.g4
index f5116485..d40c6560 100644
--- a/src/main/antlr4/FIRRTL.g4
+++ b/src/main/antlr4/FIRRTL.g4
@@ -99,9 +99,9 @@ stmt
| mdir 'mport' id '=' id '[' exp ']' exp info?
| 'inst' id 'of' id info?
| 'node' id '=' exp info?
- | exp '<=' exp info?
- | exp '<-' exp info?
- | exp 'is' 'invalid' info?
+ | ref '<=' exp info?
+ | ref '<-' exp info?
+ | ref 'is' 'invalid' info?
| when
| 'stop(' exp exp intLit ')' stmtName? info?
| 'printf(' exp exp StringLit ( exp)* ')' stmtName? info?
@@ -167,16 +167,22 @@ ruw
exp
: 'UInt' ('<' intLit '>')? '(' intLit ')'
| 'SInt' ('<' intLit '>')? '(' intLit ')'
- | id // Ref
- | exp '.' fieldId
- | exp '.' DoubleLit // TODO Workaround for #470
- | exp '[' intLit ']'
- | exp '[' exp ']'
+ | ref
| 'mux(' exp exp exp ')'
| 'validif(' exp exp ')'
| primop exp* intLit* ')'
;
+ref
+ : id subref?
+ ;
+
+subref
+ : '.' fieldId subref?
+ | '.' DoubleLit subref? // TODO Workaround for #470
+ | '[' (intLit | exp) ']' subref?
+ ;
+
id
: Id
| keywordAsId