diff options
| author | azidar | 2015-08-19 17:12:52 -0700 |
|---|---|---|
| committer | azidar | 2015-08-19 17:12:52 -0700 |
| commit | 8eec7cf373bdf02f23164cd7bbf0d02354cbc31f (patch) | |
| tree | 5ec7391c81952d54ac00eff7921af73f786a4b32 /src | |
| parent | b98c942652e5f086ac7b6d777aac012b9bf23a8e (diff) | |
Check Neg UInt in the parser
Diffstat (limited to 'src')
| -rw-r--r-- | src/main/stanza/custom-passes.stanza | 2 | ||||
| -rw-r--r-- | src/main/stanza/errors.stanza | 6 | ||||
| -rw-r--r-- | src/main/stanza/ir-parser.stanza | 5 |
3 files changed, 8 insertions, 5 deletions
diff --git a/src/main/stanza/custom-passes.stanza b/src/main/stanza/custom-passes.stanza index ecd7aed1..30f0b6c5 100644 --- a/src/main/stanza/custom-passes.stanza +++ b/src/main/stanza/custom-passes.stanza @@ -3,7 +3,7 @@ defpackage firrtl/custom-passes : import verse import firrtl/ir-utils import firrtl/ir2 - import bigint + import bigint2 ;============ When Coverage ============= public defstruct WhenCoverage <: Pass : diff --git a/src/main/stanza/errors.stanza b/src/main/stanza/errors.stanza index bfeb980b..5c77c2a4 100644 --- a/src/main/stanza/errors.stanza +++ b/src/main/stanza/errors.stanza @@ -6,7 +6,7 @@ defpackage firrtl/errors : import firrtl/primops import firrtl/passes import firrtl-main - import bigint + import bigint2 ; TODO ; make sure it compiles, write tests, look over code to make sure its right @@ -281,8 +281,8 @@ public defn check-high-form (c:Circuit) -> Circuit : (e:Ref|Subfield|Index) : false (e) : add(errors,InvalidIndex(info)) (e:DoPrim) : check-high-form-primop(e,errors,info) - (e:UIntValue) : - if neg?(value(e)) : add(errors,NegUInt(info)) + (e:UIntValue) : false + ;if neg?(value(e)) : add(errors,NegUInt(info)) (e) : false map(check-high-form-w{info,_:Width},e) map(check-high-form-t{info,_:Type},e) 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 ...)) : |
