aboutsummaryrefslogtreecommitdiff
path: root/src/main/stanza/errors.stanza
diff options
context:
space:
mode:
authorazidar2015-05-18 16:04:58 -0700
committerazidar2015-05-18 16:04:58 -0700
commit3336e6beb23e1ba883097eac0c0000269bf8ebfa (patch)
treec97d9ba8d0e50476e2d32a150fe401cc7413cff8 /src/main/stanza/errors.stanza
parent2702e571040e7a07317b79f9c5cfdbd61b9ab2bf (diff)
Big API Change. Pad is no longer supported. Widths of primops can be flexible, and the output is usually the max of the inputs. Removed all u/s variants, which need to be dealt with in backends where it matters
Diffstat (limited to 'src/main/stanza/errors.stanza')
-rw-r--r--src/main/stanza/errors.stanza29
1 files changed, 18 insertions, 11 deletions
diff --git a/src/main/stanza/errors.stanza b/src/main/stanza/errors.stanza
index 06c09522..a1d230c9 100644
--- a/src/main/stanza/errors.stanza
+++ b/src/main/stanza/errors.stanza
@@ -47,6 +47,7 @@ defpackage firrtl/errors :
public defstruct CheckHighForm <: Pass
public defmethod pass (b:CheckHighForm) -> (Circuit -> Circuit) : check-high-form
public defmethod name (b:CheckHighForm) -> String : "High Form Check"
+public defmethod short-name (b:CheckHighForm) -> String : "high-form-check"
;----------------- Errors ------------------------
defn NotUnique (info:FileInfo, name:Symbol) :
@@ -139,7 +140,7 @@ public defn check-high-form (c:Circuit) -> Circuit :
defn check-valid-loc (info:FileInfo,e:Expression) -> False :
match(e) :
- (e:UIntValue|SIntValue|DoPrim|ReadPort|Register|Pad) :
+ (e:UIntValue|SIntValue|DoPrim|ReadPort|Register) :
add(errors,InvalidLOC(info))
(e) : false
@@ -180,10 +181,13 @@ public defn check-high-form (c:Circuit) -> Circuit :
(s:DefInstance) :
if not contains?(name(module(s) as Ref),map(name,modules(c))) :
add(errors, ModuleNotDefined(info(s),name(module(s) as Ref)))
+ check-name(info(s),name(s))
add(names,name(s))
(s:DefNode) :
+ check-name(info(s),name(s))
add(names,name(s))
(s:DefAccessor) :
+ check-name(info(s),name(s))
add(names,name(s))
(s:Connect) :
check-valid-loc(info(s),loc(s))
@@ -227,6 +231,7 @@ public defn check-high-form (c:Circuit) -> Circuit :
public defstruct CheckKinds <: Pass
public defmethod pass (b:CheckKinds) -> (Circuit -> Circuit) : check-kinds
public defmethod name (b:CheckKinds) -> String : "Check Kinds"
+public defmethod short-name (b:CheckKinds) -> String : "check-kinds"
;----------------- Errors ---------------------
defn NotMem (info:FileInfo, name:Symbol) :
@@ -279,8 +284,8 @@ public defn check-kinds (c:Circuit) -> Circuit :
check-is-mem(info,mem(e))
check-not-mem(info,index(e))
check-not-mem(info,enable(e))
- (e:Pad) :
- check-not-mem(info,value(e))
+ ;(e:Pad) :
+ ;check-not-mem(info,value(e))
(e) : do(check-not-mem{info,_},e)
defn check-kinds-s (s:Stmt) -> False :
do(check-kinds-e{info(s),_:Expression},s)
@@ -316,6 +321,7 @@ public defn check-kinds (c:Circuit) -> Circuit :
public defstruct CheckTypes <: Pass
public defmethod pass (b:CheckTypes) -> (Circuit -> Circuit) : check-types
public defmethod name (b:CheckTypes) -> String : "Check Types"
+public defmethod short-name (b:CheckTypes) -> String : "check-types"
;----------------- Errors ---------------------
defn SubfieldNotInBundle (info:FileInfo, name:Symbol) :
@@ -342,9 +348,9 @@ defn EnableNotUInt (info:FileInfo) :
PassException $ string-join $
[info ": Enable is not of UIntType."]
-defn PadNotGround (info:FileInfo) :
- PassException $ string-join $
- [info ": Illegal Pad on non-ground type."]
+;defn PadNotGround (info:FileInfo) :
+ ;PassException $ string-join $
+ ;[info ": Illegal Pad on non-ground type."]
defn InvalidConnect (info:FileInfo) :
PassException $ string-join $
@@ -397,9 +403,9 @@ public defn check-types (c:Circuit) -> Circuit :
if type(enable(e)) != u() : add(errors,EnableNotUInt(info))
(e:Register) :
if type(enable(e)) != u() : add(errors,EnableNotUInt(info))
- (e:Pad) :
- val t = type(value(e))
- if not (t == u() or t == s()) : add(errors,PadNotGround(info))
+ ;(e:Pad) :
+ ;val t = type(value(e))
+ ;if not (t == u() or t == s()) : add(errors,PadNotGround(info))
(e:UIntValue|SIntValue) : false
e
defn check-types-s (s:Stmt) -> Stmt :
@@ -430,6 +436,7 @@ public defn check-types (c:Circuit) -> Circuit :
public defstruct CheckGenders <: Pass
public defmethod pass (b:CheckGenders) -> (Circuit -> Circuit) : check-genders
public defmethod name (b:CheckGenders) -> String : "Check Genders"
+public defmethod short-name (b:CheckGenders) -> String : "check-genders"
;----------------- Errors ---------------------
defn WrongGender (info:FileInfo,expr:Symbol,wrong:Symbol,right:Symbol) :
@@ -462,7 +469,7 @@ public defn check-genders (c:Circuit) -> Circuit :
val f = {_ as Field} $ for f in fields(type(exp(e)) as BundleType) find : name(f) == name(e)
get-gender(exp(e),genders) * flip(f)
(e:WIndex) : get-gender(exp(e),genders)
- (e:Pad) : MALE
+ ;(e:Pad) : MALE
(e:DoPrim) : MALE
(e:UIntValue) : MALE
(e:SIntValue) : MALE
@@ -476,7 +483,7 @@ public defn check-genders (c:Circuit) -> Circuit :
(e:WRef) : false
(e:WSubfield) : false
(e:WIndex) : false
- (e:Pad) : check-gender(info,genders,value(e),MALE)
+ ;(e:Pad) : check-gender(info,genders,value(e),MALE)
(e:DoPrim) :
for e in args(e) do :
check-gender(info,genders,e,MALE)