aboutsummaryrefslogtreecommitdiff
path: root/src/main/stanza/ir-parser.stanza
diff options
context:
space:
mode:
authorazidar2015-08-19 17:12:52 -0700
committerazidar2015-08-19 17:12:52 -0700
commit8eec7cf373bdf02f23164cd7bbf0d02354cbc31f (patch)
tree5ec7391c81952d54ac00eff7921af73f786a4b32 /src/main/stanza/ir-parser.stanza
parentb98c942652e5f086ac7b6d777aac012b9bf23a8e (diff)
Check Neg UInt in the parser
Diffstat (limited to 'src/main/stanza/ir-parser.stanza')
-rw-r--r--src/main/stanza/ir-parser.stanza5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/main/stanza/ir-parser.stanza b/src/main/stanza/ir-parser.stanza
index c622104c..76e7f6ca 100644
--- a/src/main/stanza/ir-parser.stanza
+++ b/src/main/stanza/ir-parser.stanza
@@ -281,7 +281,10 @@ defsyntax firrtl :
expterm = (?t:#inttype(?v:#int$)) :
match(t) :
- (t:UIntType) : UIntValue(BigIntLit(v as Int,32), width(t))
+ (t:UIntType) :
+ if (v as Int) < 0 :
+ FPE(form, "UIntValue cannot be negative.")
+ UIntValue(BigIntLit(v as Int,32), width(t))
(t:SIntType) : SIntValue(BigIntLit(v as Int,32), width(t))
expterm = (?op:#sym(?es:#exp ... ?ints:#int ... ?rest ...)) :