diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/main/scala/firrtl/passes/ZeroWidth.scala | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/src/main/scala/firrtl/passes/ZeroWidth.scala b/src/main/scala/firrtl/passes/ZeroWidth.scala index 2472a0e5..6d7766d1 100644 --- a/src/main/scala/firrtl/passes/ZeroWidth.scala +++ b/src/main/scala/firrtl/passes/ZeroWidth.scala @@ -40,15 +40,10 @@ object ZeroWidth extends Transform { case VectorType(t, size) => removeZero(t) map (VectorType(_, size)) case x => Some(x) } - private def onExp(e: Expression): Expression = removeZero(e.tpe) match { - case None => e.tpe match { - case UIntType(x) => UIntLiteral(ZERO, IntWidth(BigInt(1))) - case SIntType(x) => SIntLiteral(ZERO, IntWidth(BigInt(1))) - case _ => throwInternalError - } - case Some(t) => - def replaceType(x: Type): Type = t - (e map replaceType) map onExp + private def onExp(e: Expression): Expression = e.tpe match { + case UIntType(IntWidth(ZERO)) => UIntLiteral(ZERO, IntWidth(BigInt(1))) + case SIntType(IntWidth(ZERO)) => SIntLiteral(ZERO, IntWidth(BigInt(1))) + case other => e map onExp } private def onStmt(renames: RenameMap)(s: Statement): Statement = s match { case (_: DefWire| _: DefRegister| _: DefMemory) => |
