diff options
Diffstat (limited to 'src/main/scala/firrtl/passes/SplitExpressions.scala')
| -rw-r--r-- | src/main/scala/firrtl/passes/SplitExpressions.scala | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/src/main/scala/firrtl/passes/SplitExpressions.scala b/src/main/scala/firrtl/passes/SplitExpressions.scala index a66f7152..973e1be9 100644 --- a/src/main/scala/firrtl/passes/SplitExpressions.scala +++ b/src/main/scala/firrtl/passes/SplitExpressions.scala @@ -3,6 +3,7 @@ package passes import firrtl.Mappers.{ExpMap, StmtMap} import firrtl.Utils.{tpe, kind, gender, info} +import firrtl.ir._ import scala.collection.mutable @@ -10,10 +11,10 @@ import scala.collection.mutable // and named intermediate nodes object SplitExpressions extends Pass { def name = "Split Expressions" - private def onModule(m: InModule): InModule = { + private def onModule(m: Module): Module = { val namespace = Namespace(m) - def onStmt(s: Stmt): Stmt = { - val v = mutable.ArrayBuffer[Stmt]() + def onStmt(s: Statement): Statement = { + val v = mutable.ArrayBuffer[Statement]() // Splits current expression if needed // Adds named temporaries to v def split(e: Expression): Expression = e match { @@ -45,7 +46,7 @@ object SplitExpressions extends Pass { val x = s map onExp x match { case x: Begin => x map onStmt - case x: Empty => x + case EmptyStmt => x case x => { v += x if (v.size > 1) Begin(v.toVector) @@ -53,12 +54,12 @@ object SplitExpressions extends Pass { } } } - InModule(m.info, m.name, m.ports, onStmt(m.body)) + Module(m.info, m.name, m.ports, onStmt(m.body)) } def run(c: Circuit): Circuit = { val modulesx = c.modules.map( _ match { - case (m:InModule) => onModule(m) - case (m:ExModule) => m + case m: Module => onModule(m) + case m: ExtModule => m }) Circuit(c.info, modulesx, c.main) } |
