diff options
| author | azidar | 2016-01-20 09:53:05 -0800 |
|---|---|---|
| committer | azidar | 2016-01-20 09:53:05 -0800 |
| commit | a94299f2feeba75923fb3f3039f1063eaa730730 (patch) | |
| tree | efb572938234d8fccef4b3534d94d75e8b7c2904 /src/main/stanza/errors.stanza | |
| parent | 263559753a0584ca7896607e643d9e6348811dff (diff) | |
WIP, need to update chirrtl with new mask syntax
Diffstat (limited to 'src/main/stanza/errors.stanza')
| -rw-r--r-- | src/main/stanza/errors.stanza | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/src/main/stanza/errors.stanza b/src/main/stanza/errors.stanza index 97660b46..67dfef8d 100644 --- a/src/main/stanza/errors.stanza +++ b/src/main/stanza/errors.stanza @@ -654,11 +654,18 @@ public defn check-genders (c:Circuit) -> Circuit : defn check-gender (info:FileInfo,genders:HashTable<Symbol,Gender>,e:Expression,desired:Gender) -> False : val gender = get-gender(e,genders) val kind* = get-kind(e) - val flip? = - match(type(e)) : - (t:BundleType) : - for f in fields(t) any? : flip(f) == REVERSE - (t) : false + defn flip? (t:Type) -> True|False : + var f? = false + defn flip-rec (t:Type,f:Flip) -> Type : + match(t) : + (t:BundleType) : + for field in fields(t) do : + flip-rec(type(field),f * flip(field)) + (t:VectorType) : flip-rec(type(t),f) + (t) : if f == REVERSE : f? = true + t + flip-rec(t,DEFAULT) + val has-flip? = flip?(t) ;println(e) ;println(gender) @@ -670,7 +677,7 @@ public defn check-genders (c:Circuit) -> Circuit : [MALE, FEMALE] : add(errors,WrongGender(info,to-symbol(e),as-srcsnk(desired),as-srcsnk(gender))) [FEMALE, MALE] : - if (kind* == PortKind() or kind* == InstanceKind()) and flip? == false : + if (kind* == PortKind() or kind* == InstanceKind()) and has-flip? == false : ; OK! false else : |
