aboutsummaryrefslogtreecommitdiff
path: root/src/main/antlr4
diff options
context:
space:
mode:
authorAdam Izraelevitz2019-10-18 19:01:19 -0700
committerGitHub2019-10-18 19:01:19 -0700
commitfd981848c7d2a800a15f9acfbf33b57dd1c6225b (patch)
tree3609a301cb0ec867deefea4a0d08425810b00418 /src/main/antlr4
parent973ecf516c0ef2b222f2eb68dc8b514767db59af (diff)
Upstream intervals (#870)
Major features: - Added Interval type, as well as PrimOps asInterval, clip, wrap, and sqz. - Changed PrimOp names: bpset -> setp, bpshl -> incp, bpshr -> decp - Refactored width/bound inferencer into a separate constraint solver - Added transforms to infer, trim, and remove interval bounds - Tests for said features Plan to be released with 1.3
Diffstat (limited to 'src/main/antlr4')
-rw-r--r--src/main/antlr4/FIRRTL.g430
1 files changed, 26 insertions, 4 deletions
diff --git a/src/main/antlr4/FIRRTL.g4 b/src/main/antlr4/FIRRTL.g4
index be15ab7c..518cb698 100644
--- a/src/main/antlr4/FIRRTL.g4
+++ b/src/main/antlr4/FIRRTL.g4
@@ -50,6 +50,7 @@ type
: 'UInt' ('<' intLit '>')?
| 'SInt' ('<' intLit '>')?
| 'Fixed' ('<' intLit '>')? ('<' '<' intLit '>' '>')?
+ | 'Interval' (lowerBound boundValue boundValue upperBound)? ('.' intLit)?
| 'Clock'
| 'AsyncReset'
| 'Reset'
@@ -187,6 +188,23 @@ intLit
| HexLit
;
+lowerBound
+ : '['
+ | '('
+ ;
+
+upperBound
+ : ']'
+ | ')'
+ ;
+
+boundValue
+ : '?'
+ | DoubleLit
+ | UnsignedInt
+ | SignedInt
+ ;
+
// Keywords that are also legal ids
keywordAsId
: 'circuit'
@@ -253,6 +271,8 @@ primop
| 'asAsyncReset('
| 'asSInt('
| 'asClock('
+ | 'asFixedPoint('
+ | 'asInterval('
| 'shl('
| 'shr('
| 'dshl('
@@ -270,10 +290,12 @@ primop
| 'bits('
| 'head('
| 'tail('
- | 'asFixedPoint('
- | 'bpshl('
- | 'bpshr('
- | 'bpset('
+ | 'incp('
+ | 'decp('
+ | 'setp('
+ | 'wrap('
+ | 'clip('
+ | 'squz('
;
/*------------------------------------------------------------------