diff options
| author | Richard Lin | 2016-03-14 12:22:32 -0700 |
|---|---|---|
| committer | Richard Lin | 2016-03-14 12:22:32 -0700 |
| commit | 291a275abdfec9b5fc4e23f653742080cdc5d351 (patch) | |
| tree | 9ded3b0ad45f78d0b47e5e6b9419a8a0f3b2165e /src/main/scala/Chisel/internal | |
| parent | 62794befadd8477af26919e453d4bdbbad83dd1f (diff) | |
| parent | 541b2d4cb0b3e01d22f442b4cae7dcc6f910af41 (diff) | |
Merge pull request #119 from ucb-bar/scalastyle
Scalastyle cleanup - no functional differences.
Diffstat (limited to 'src/main/scala/Chisel/internal')
| -rw-r--r-- | src/main/scala/Chisel/internal/firrtl/IR.scala | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/src/main/scala/Chisel/internal/firrtl/IR.scala b/src/main/scala/Chisel/internal/firrtl/IR.scala index d53807c6..8a937419 100644 --- a/src/main/scala/Chisel/internal/firrtl/IR.scala +++ b/src/main/scala/Chisel/internal/firrtl/IR.scala @@ -57,7 +57,8 @@ abstract class LitArg(val num: BigInt, widthArg: Width) extends Arg { protected def minWidth: Int if (forcedWidth) { - require(widthArg.get >= minWidth, s"The literal value ${num} was elaborated with a specificed width of ${widthArg.get} bits, but at least ${minWidth} bits are required.") + require(widthArg.get >= minWidth, + s"The literal value ${num} was elaborated with a specificed width of ${widthArg.get} bits, but at least ${minWidth} bits are required.") } } @@ -165,12 +166,17 @@ case class Component(id: Module, name: String, ports: Seq[Port], commands: Seq[C case class Port(id: Data, dir: Direction) case class Printf(clk: Arg, formatIn: String, ids: Seq[Arg]) extends Command { require(formatIn.forall(c => c.toInt > 0 && c.toInt < 128), "format strings must comprise non-null ASCII values") - def format = { + def format: String = { def escaped(x: Char) = - if (x == '"' || x == '\\' || x == '?') "\\" + x - else if (x == '\n') "\\n" - else if (x.toInt < 32) s"\\x${BigInt(x.toInt).toString(16)}" - else x + if (x == '"' || x == '\\' || x == '?') { + "\\" + x + } else if (x == '\n') { + "\\n" + } else if (x.toInt < 32) { + s"\\x${BigInt(x.toInt).toString(16)}" + } else { + x + } formatIn.map(escaped _).mkString } } |
