From a0834153e1e5a506dc66d8d792f6f9594052b546 Mon Sep 17 00:00:00 2001 From: azidar Date: Thu, 30 Apr 2015 10:48:19 -0700 Subject: Fixed assignment to outputs not getting emitted from Expand When pass --- src/main/stanza/passes.stanza | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/main/stanza/passes.stanza b/src/main/stanza/passes.stanza index 5d1848f0..4c706087 100644 --- a/src/main/stanza/passes.stanza +++ b/src/main/stanza/passes.stanza @@ -1088,7 +1088,17 @@ defn reduce-or (l:List) -> Expression : ; kinds: Used to know the kind of reference, so we know whether we should error if it isn't initialized. We also know how we should declare the refernce. ; enables:Calculated off of assigns. -; I think I'm going to restructure this so that not all information is held in the tables, but instead, we walk the graph again, and do stuff on declarations, and delete other stuff + +defn expand-whens (ports:List, table:HashTable,cons:Vector) -> False : + for p in ports do : + if direction(p) == OUTPUT : + val ref = WRef(name(p),type(p),PortKind(),FEMALE) + add{cons,_} $ + if has-nul?(table[name(p)]) : + println("Uninitialized: ~" % [to-string(name(p))]);TODO actually collect error + EmptyStmt() + else : Connect(ref,to-exp(table[name(p)]) as Expression) + defn expand-whens (s:Stmt, table:HashTable,decs:Vector,cons:Vector) -> Stmt : match(map(expand-whens{_,table,decs,cons},s)) : (s:DefNode|DefMemory) : add(decs,s) @@ -1277,6 +1287,7 @@ defn expand-whens (m:Module) -> Module : for x in table do : println-debug(x) val decs = Vector() val cons = Vector() + expand-whens(ports(m),table,cons) expand-whens(body(m),table,decs,cons) Module(name(m),ports(m),Begin(append(to-list(decs),to-list(cons)))) -- cgit v1.2.3