aboutsummaryrefslogtreecommitdiff
path: root/src/main/scala/firrtl/passes/PadWidths.scala
diff options
context:
space:
mode:
authorChick Markley2016-10-11 15:53:40 -0700
committerAdam Izraelevitz2016-10-11 15:53:40 -0700
commit2848d87721df110d0425114283cb5fa7e6c2ee03 (patch)
treed76dd381fb77d63b8509a69063ace380f3209f33 /src/main/scala/firrtl/passes/PadWidths.scala
parent515f29f5993abb399db43b04e9a63c0fdf347ecc (diff)
Scala style cleanup take 5 (#324)
* working through variable shrouding * working through variable shrouding * working through variable shadowing * working through variable shadowing hmm there are some very fragile match {} in Passes * working through variable shadowing hmm there are some very fragile match {} in Passes * working through variable shadowing * working through variable shadowing * working through variable shadowing * working through variable shadowing * working through variable shadowing * working through variable shadowing * working through variable shadowing * working through variable shadowing * Fixes suggested by Adam
Diffstat (limited to 'src/main/scala/firrtl/passes/PadWidths.scala')
-rw-r--r--src/main/scala/firrtl/passes/PadWidths.scala24
1 files changed, 12 insertions, 12 deletions
diff --git a/src/main/scala/firrtl/passes/PadWidths.scala b/src/main/scala/firrtl/passes/PadWidths.scala
index 55e7f79b..6564570f 100644
--- a/src/main/scala/firrtl/passes/PadWidths.scala
+++ b/src/main/scala/firrtl/passes/PadWidths.scala
@@ -34,30 +34,30 @@ object PadWidths extends Pass {
private def onExp(e: Expression): Expression = e map onExp match {
case Mux(cond, tval, fval, tpe) =>
Mux(cond, fixup(width(tpe))(tval), fixup(width(tpe))(fval), tpe)
- case e: ValidIf => e copy (value = fixup(width(e.tpe))(e.value))
- case e: DoPrim => e.op match {
+ case ex: ValidIf => ex copy (value = fixup(width(ex.tpe))(ex.value))
+ case ex: DoPrim => ex.op match {
case Lt | Leq | Gt | Geq | Eq | Neq | Not | And | Or | Xor |
Add | Sub | Mul | Div | Rem | Shr =>
// sensitive ops
- e map fixup((e.args map width foldLeft 0)(math.max))
+ ex map fixup((ex.args map width foldLeft 0)(math.max))
case Dshl =>
// special case as args aren't all same width
- e copy (op = Dshlw, args = Seq(fixup(width(e.tpe))(e.args.head), e.args(1)))
+ ex copy (op = Dshlw, args = Seq(fixup(width(ex.tpe))(ex.args.head), ex.args(1)))
case Shl =>
// special case as arg should be same width as result
- e copy (op = Shlw, args = Seq(fixup(width(e.tpe))(e.args.head)))
- case _ => e
+ ex copy (op = Shlw, args = Seq(fixup(width(ex.tpe))(ex.args.head)))
+ case _ => ex
}
- case e => e
+ case ex => ex
}
// Recursive. Fixes assignments and register initialization widths
private def onStmt(s: Statement): Statement = s map onExp match {
- case s: Connect =>
- s copy (expr = fixup(width(s.loc))(s.expr))
- case s: DefRegister =>
- s copy (init = fixup(width(s.tpe))(s.init))
- case s => s map onStmt
+ case sx: Connect =>
+ sx copy (expr = fixup(width(sx.loc))(sx.expr))
+ case sx: DefRegister =>
+ sx copy (init = fixup(width(sx.tpe))(sx.init))
+ case sx => sx map onStmt
}
def run(c: Circuit): Circuit = c copy (modules = c.modules map (_ map onStmt))