summaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
authorJim Lawson2017-08-01 14:11:03 -0700
committerGitHub2017-08-01 14:11:03 -0700
commit661aa017446693077670ab3d14a30e4804a5c1af (patch)
treeae5dbb532b3bbdae060e10193a1eeb8dda0baa22 /src/main
parent004938693112b2be268b0ee8d91874ba2d993ec3 (diff)
Address scalastyle issues, out of date comments, extraneous imports. (#658)
No functional changes
Diffstat (limited to 'src/main')
-rw-r--r--src/main/scala/chisel3/compatibility.scala10
-rw-r--r--src/main/scala/chisel3/package.scala39
-rw-r--r--src/main/scala/chisel3/util/BitPat.scala12
-rw-r--r--src/main/scala/chisel3/util/Valid.scala8
4 files changed, 40 insertions, 29 deletions
diff --git a/src/main/scala/chisel3/compatibility.scala b/src/main/scala/chisel3/compatibility.scala
index 4223d63b..8fa995e4 100644
--- a/src/main/scala/chisel3/compatibility.scala
+++ b/src/main/scala/chisel3/compatibility.scala
@@ -156,8 +156,8 @@ package object Chisel { // scalastyle:ignore package.object.name
/** Create an SInt literal with specified width. */
def apply(value: BigInt, width: Width): SInt = value.asSInt(width)
- def Lit(value: BigInt): SInt = value.asSInt
- def Lit(value: BigInt, width: Int): SInt = value.asSInt(width.W)
+ def Lit(value: BigInt): SInt = value.asSInt // scalastyle:ignore method.name
+ def Lit(value: BigInt, width: Int): SInt = value.asSInt(width.W) // scalastyle:ignore method.name
/** Create a SInt with a specified width - compatibility with Chisel2. */
def apply(dir: Option[Direction] = None, width: Int): SInt = apply(width.W)
@@ -209,7 +209,7 @@ package object Chisel { // scalastyle:ignore package.object.name
abstract class BlackBox(params: Map[String, Param] = Map.empty[String, Param]) extends chisel3.core.BlackBox(params) {
// This class auto-wraps the BlackBox with IO(...), allowing legacy code (where IO(...) wasn't
// required) to build.
- override def _autoWrapPorts() = {
+ override def _autoWrapPorts(): Unit = { // scalastyle:ignore method.name
if (!_ioPortBound()) {
IO(io)
}
@@ -237,7 +237,7 @@ package object Chisel { // scalastyle:ignore package.object.name
def this(_clock: Clock, _reset: Bool)(implicit moduleCompileOptions: CompileOptions) =
this(Option(_clock), Option(_reset))(moduleCompileOptions)
- override def _autoWrapPorts() = {
+ override def _autoWrapPorts(): Unit = { // scalastyle:ignore method.name
if (!_ioPortBound() && io != null) {
IO(io)
}
@@ -487,7 +487,7 @@ package object Chisel { // scalastyle:ignore package.object.name
* Because its contents won't necessarily have the same level of stability and support as
* non-experimental, you must explicitly import this package to use its contents.
*/
- object experimental {
+ object experimental { // scalastyle:ignore object.name
import scala.annotation.compileTimeOnly
class dump extends chisel3.internal.naming.dump
diff --git a/src/main/scala/chisel3/package.scala b/src/main/scala/chisel3/package.scala
index d2f11f3d..d0d3a937 100644
--- a/src/main/scala/chisel3/package.scala
+++ b/src/main/scala/chisel3/package.scala
@@ -1,6 +1,7 @@
-import chisel3.core.CompileOptions
// See LICENSE for license details.
+import chisel3.core.CompileOptions
+
/** The chisel3 package contains the chisel3 API.
* It maps core components into the public chisel3 namespace.
*/
@@ -76,30 +77,30 @@ package object chisel3 { // scalastyle:ignore package.object.name
*/
trait UIntFactory extends chisel3.core.UIntFactory {
/** Create a UInt literal with inferred width. */
- @deprecated("use n.U", "chisel3, will be removed by end of 2016")
+ @deprecated("use n.U", "chisel3, will be removed by end of 2017")
def apply(n: String): UInt = n.asUInt
/** Create a UInt literal with fixed width. */
- @deprecated("use n.U(width.W)", "chisel3, will be removed by end of 2016")
+ @deprecated("use n.U(width.W)", "chisel3, will be removed by end of 2017")
def apply(n: String, width: Int): UInt = n.asUInt(width.W)
/** Create a UInt literal with specified width. */
- @deprecated("use value.U(width)", "chisel3, will be removed by end of 2016")
+ @deprecated("use value.U(width)", "chisel3, will be removed by end of 2017")
def apply(value: BigInt, width: Width): UInt = value.asUInt(width)
/** Create a UInt literal with fixed width. */
- @deprecated("use value.U(width.W)", "chisel3, will be removed by end of 2016")
+ @deprecated("use value.U(width.W)", "chisel3, will be removed by end of 2017")
def apply(value: BigInt, width: Int): UInt = value.asUInt(width.W)
/** Create a UInt literal with inferred width.- compatibility with Chisel2. */
- @deprecated("use value.U", "chisel3, will be removed by end of 2016")
+ @deprecated("use value.U", "chisel3, will be removed by end of 2017")
def apply(value: BigInt): UInt = value.asUInt
/** Create a UInt with a specified width */
- @deprecated("use UInt(width.W)", "chisel3, will be removed by end of 2016")
+ @deprecated("use UInt(width.W)", "chisel3, will be removed by end of 2017")
def width(width: Int): UInt = apply(width.W)
/** Create a UInt port with specified width. */
- @deprecated("use UInt(width)", "chisel3, will be removed by end of 2016")
+ @deprecated("use UInt(width)", "chisel3, will be removed by end of 2017")
def width(width: Width): UInt = apply(width)
}
@@ -108,28 +109,28 @@ package object chisel3 { // scalastyle:ignore package.object.name
*/
trait SIntFactory extends chisel3.core.SIntFactory {
/** Create a SInt type or port with fixed width. */
- @deprecated("use SInt(width.W)", "chisel3, will be removed by end of 2016")
+ @deprecated("use SInt(width.W)", "chisel3, will be removed by end of 2017")
def width(width: Int): SInt = apply(width.W)
/** Create an SInt type with specified width. */
- @deprecated("use SInt(width)", "chisel3, will be removed by end of 2016")
+ @deprecated("use SInt(width)", "chisel3, will be removed by end of 2017")
def width(width: Width): SInt = apply(width)
/** Create an SInt literal with inferred width. */
- @deprecated("use value.S", "chisel3, will be removed by end of 2016")
+ @deprecated("use value.S", "chisel3, will be removed by end of 2017")
def apply(value: BigInt): SInt = value.asSInt
/** Create an SInt literal with fixed width. */
- @deprecated("use value.S(width.W)", "chisel3, will be removed by end of 2016")
+ @deprecated("use value.S(width.W)", "chisel3, will be removed by end of 2017")
def apply(value: BigInt, width: Int): SInt = value.asSInt(width.W)
/** Create an SInt literal with specified width. */
- @deprecated("use value.S(width)", "chisel3, will be removed by end of 2016")
+ @deprecated("use value.S(width)", "chisel3, will be removed by end of 2017")
def apply(value: BigInt, width: Width): SInt = value.asSInt(width)
- @deprecated("use value.S", "chisel3, will be removed by end of 2016")
- def Lit(value: BigInt): SInt = value.asSInt
+ @deprecated("use value.S", "chisel3, will be removed by end of 2017")
+ def Lit(value: BigInt): SInt = value.asSInt // scalastyle:ignore method.name
- @deprecated("use value.S(width)", "chisel3, will be removed by end of 2016")
- def Lit(value: BigInt, width: Int): SInt = value.asSInt(width.W)
+ @deprecated("use value.S(width)", "chisel3, will be removed by end of 2017")
+ def Lit(value: BigInt, width: Int): SInt = value.asSInt(width.W) // scalastyle:ignore method.name
}
/** This contains literal constructor factory methods that are deprecated as of Chisel3.
@@ -138,7 +139,7 @@ package object chisel3 { // scalastyle:ignore package.object.name
trait BoolFactory extends chisel3.core.BoolFactory {
/** Creates Bool literal.
*/
- @deprecated("use x.B", "chisel3, will be removed by end of 2016")
+ @deprecated("use x.B", "chisel3, will be removed by end of 2017")
def apply(x: Boolean): Bool = x.B
}
@@ -300,7 +301,7 @@ package object chisel3 { // scalastyle:ignore package.object.name
* Because its contents won't necessarily have the same level of stability and support as
* non-experimental, you must explicitly import this package to use its contents.
*/
- object experimental {
+ object experimental { // scalastyle:ignore object.name
type Param = chisel3.core.Param
type IntParam = chisel3.core.IntParam
val IntParam = chisel3.core.IntParam
diff --git a/src/main/scala/chisel3/util/BitPat.scala b/src/main/scala/chisel3/util/BitPat.scala
index 33b9f173..54ded155 100644
--- a/src/main/scala/chisel3/util/BitPat.scala
+++ b/src/main/scala/chisel3/util/BitPat.scala
@@ -94,7 +94,13 @@ sealed class BitPat(val value: BigInt, val mask: BigInt, width: Int) {
@deprecated("Use '=/=', which avoids potential precedence problems", "chisel3")
def != (that: UInt): Bool = macro SourceInfoTransform.thatArg
- def do_=== (that: UInt)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): Bool = value.asUInt === (that & mask.asUInt) // scalastyle:ignore method.name
- def do_=/= (that: UInt)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): Bool = !(this === that) // scalastyle:ignore method.name
- def do_!= (that: UInt)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): Bool = this =/= that // scalastyle:ignore method.name
+ def do_=== (that: UInt)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): Bool = { // scalastyle:ignore method.name
+ value.asUInt === (that & mask.asUInt)
+ }
+ def do_=/= (that: UInt)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): Bool = { // scalastyle:ignore method.name
+ !(this === that)
+ }
+ def do_!= (that: UInt)(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): Bool = { // scalastyle:ignore method.name
+ this =/= that
+ }
}
diff --git a/src/main/scala/chisel3/util/Valid.scala b/src/main/scala/chisel3/util/Valid.scala
index 6fb67585..7017b7a1 100644
--- a/src/main/scala/chisel3/util/Valid.scala
+++ b/src/main/scala/chisel3/util/Valid.scala
@@ -47,8 +47,12 @@ object Pipe
apply(v, b, latency-1)(compileOptions)
}
}
- def apply[T <: Data](enqValid: Bool, enqBits: T)(implicit compileOptions: CompileOptions): Valid[T] = apply(enqValid, enqBits, 1)(compileOptions)
- def apply[T <: Data](enq: Valid[T], latency: Int = 1)(implicit compileOptions: CompileOptions): Valid[T] = apply(enq.valid, enq.bits, latency)(compileOptions)
+ def apply[T <: Data](enqValid: Bool, enqBits: T)(implicit compileOptions: CompileOptions): Valid[T] = {
+ apply(enqValid, enqBits, 1)(compileOptions)
+ }
+ def apply[T <: Data](enq: Valid[T], latency: Int = 1)(implicit compileOptions: CompileOptions): Valid[T] = {
+ apply(enq.valid, enq.bits, latency)(compileOptions)
+ }
}
class Pipe[T <: Data](gen: T, latency: Int = 1)(implicit compileOptions: CompileOptions) extends Module