aboutsummaryrefslogtreecommitdiff
path: root/src/main/stanza/chirrtl.stanza
diff options
context:
space:
mode:
authorazidar2016-01-24 16:30:50 -0800
committerazidar2016-01-24 16:30:50 -0800
commit8265e2e67e39f2d313a74bccb6dd45d85f706f3a (patch)
tree744a5eea0e86a43aaeb720fc545bcfe80840b139 /src/main/stanza/chirrtl.stanza
parent63b3668414bfea1c3bdd651a552d5fa7b5d6b9c4 (diff)
Added muxing on passive aggregate types
Diffstat (limited to 'src/main/stanza/chirrtl.stanza')
-rw-r--r--src/main/stanza/chirrtl.stanza23
1 files changed, 15 insertions, 8 deletions
diff --git a/src/main/stanza/chirrtl.stanza b/src/main/stanza/chirrtl.stanza
index 2ac76a05..fdd8424b 100644
--- a/src/main/stanza/chirrtl.stanza
+++ b/src/main/stanza/chirrtl.stanza
@@ -99,6 +99,7 @@ defn infer-types (c:Circuit) -> Circuit :
(e:SubIndex) : SubIndex(exp(e),value(e),sub-type(type(exp(e))))
(e:SubAccess) : SubAccess(exp(e),index(e),sub-type(type(exp(e))))
(e:DoPrim) : set-primop-type(e)
+ (e:Mux) : Mux(cond(e),tval(e),fval(e),mux-type(tval(e),tval(e)))
(e:UIntValue|SIntValue) : e
defn infer-types-s (s:Stmt) -> Stmt :
match(s) :
@@ -220,14 +221,20 @@ public val MALE = new Gender
public val FEMALE = new Gender
defn create-exps (e:Expression) -> List<Expression> :
- match(type(e)) :
- (t:UIntType|SIntType|ClockType) : list(e)
- (t:BundleType) :
- for f in fields(t) map-append :
- create-exps(SubField(e,name(f),type(f)))
- (t:VectorType) :
- for i in 0 to size(t) map-append :
- create-exps(SubIndex(e,i,type(t)))
+ match(e) :
+ (e:Mux) :
+ for (e1 in create-exps(tval(e)), e2 in create-exps(fval(e))) map :
+ Mux(cond(e),e1,e2,mux-type(e1,e2))
+ (e) :
+ match(type(e)) :
+ (t:UIntType|SIntType|ClockType) : list(e)
+ (t:BundleType) :
+ for f in fields(t) map-append :
+ create-exps(SubField(e,name(f),type(f)))
+ (t:VectorType) :
+ for i in 0 to size(t) map-append :
+ create-exps(SubIndex(e,i,type(t)))
+ (t:UnknownType) : list(e)
defn remove-chirrtl (c:Circuit) :
defn remove-chirrtl-m (m:InModule) -> InModule :