From fd981848c7d2a800a15f9acfbf33b57dd1c6225b Mon Sep 17 00:00:00 2001 From: Adam Izraelevitz Date: Fri, 18 Oct 2019 19:01:19 -0700 Subject: 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--- src/main/antlr4/FIRRTL.g4 | 30 ++++++++++++++++++++++++++---- 1 file changed, 26 insertions(+), 4 deletions(-) (limited to 'src/main/antlr4') 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(' ; /*------------------------------------------------------------------ -- cgit v1.2.3