aboutsummaryrefslogtreecommitdiff
path: root/src/main/antlr4/FIRRTL.g4
diff options
context:
space:
mode:
authorJack2015-10-12 16:45:21 -0700
committerJack2015-10-12 16:45:21 -0700
commit0c288c48382f1b31fbfb1c202867fb444e46136c (patch)
tree6b3498b1ebae1cbd3f7298165cae631a7f6c6bd1 /src/main/antlr4/FIRRTL.g4
parentd1295b29d89e07645c3a4e08f2f923455a868482 (diff)
Added support for no width to mean unknown, and print nothing instead of <?> for unknown width. Also added test to check this
Diffstat (limited to 'src/main/antlr4/FIRRTL.g4')
-rw-r--r--src/main/antlr4/FIRRTL.g412
1 files changed, 4 insertions, 8 deletions
diff --git a/src/main/antlr4/FIRRTL.g4 b/src/main/antlr4/FIRRTL.g4
index 08697bb1..d9f3d18f 100644
--- a/src/main/antlr4/FIRRTL.g4
+++ b/src/main/antlr4/FIRRTL.g4
@@ -1,7 +1,3 @@
-// Jack Koenig
-// UC Berkeley ASPIRE Lab
-// July 9, 2015
-
grammar FIRRTL;
/*------------------------------------------------------------------
@@ -33,8 +29,8 @@ portKind
;
type
- : 'UInt' '<' width '>'
- | 'SInt' '<' width '>'
+ : 'UInt' ('<' width '>')?
+ | 'SInt' ('<' width '>')?
| 'Clock'
| '{' field* '}' // Bundle
| type '[' IntLit ']' // Vector
@@ -93,8 +89,8 @@ dir
// TODO implement
// What is exp?
exp
- : 'UInt' '<' width '>' '(' (IntLit) ')' // FIXME what does "ints" mean?
- | 'SInt' '<' width '>' '(' (IntLit) ')' // FIXME same
+ : 'UInt' ('<' width '>')? '(' (IntLit) ')' // FIXME what does "ints" mean?
+ | 'SInt' ('<' width '>')? '(' (IntLit) ')' // FIXME same
| id // Ref
| exp '.' id // FIXME Does this work for no space?
| exp '[' IntLit ']'