Skip to content
This repository has been archived by the owner on Apr 20, 2024. It is now read-only.

Commit

Permalink
collect magic
Browse files Browse the repository at this point in the history
  • Loading branch information
donggyukim committed Sep 7, 2018
1 parent d3966db commit d88ef13
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions macros/src/main/scala/MacroCompiler.scala
Original file line number Diff line number Diff line change
Expand Up @@ -298,13 +298,9 @@ class MacroCompilerPass(mems: Option[Seq[Macro]],
val name = s"mem_${i}_${j}"
// Create the instance.
stmts += WDefInstance(NoInfo, name, lib.src.name, lib.tpe)
stmts ++= lib.sortedPorts flatMap { port =>
port.ports flatMap (p => p.direction match {
case Input =>
Some(IsInvalid(NoInfo, WSubField(WRef(name), p.name)))
case Output => None
})
}
stmts ++= lib.sortedPorts flatMap (_.ports collect {
case Port(_, pname, Input, _) => IsInvalid(NoInfo, WSubField(WRef(name), pname))
})
// Connect extra ports of the lib.
stmts ++= lib.extraPorts map { case (portName, portValue) =>
Connect(NoInfo, WSubField(WRef(name), portName), portValue)
Expand Down

0 comments on commit d88ef13

Please sign in to comment.