summaryrefslogtreecommitdiff
path: root/src/main/scala/chisel3/util/BitPat.scala
diff options
context:
space:
mode:
authorducky2018-05-09 17:07:13 -0700
committerRichard Lin2018-07-04 18:39:28 -0500
commit7834f0ada9f8bcfc28c1d6124f63acdcaa2d4755 (patch)
treef086a643a249a04e4929bf12c9d508cf3fea2087 /src/main/scala/chisel3/util/BitPat.scala
parentb74034446223db6731c7e4f2eb362b3349efc8be (diff)
work on new style literal accessors
Diffstat (limited to 'src/main/scala/chisel3/util/BitPat.scala')
-rw-r--r--src/main/scala/chisel3/util/BitPat.scala7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/main/scala/chisel3/util/BitPat.scala b/src/main/scala/chisel3/util/BitPat.scala
index 8d6565fb..3a3a7061 100644
--- a/src/main/scala/chisel3/util/BitPat.scala
+++ b/src/main/scala/chisel3/util/BitPat.scala
@@ -74,9 +74,8 @@ object BitPat {
* @note the UInt must be a literal
*/
def apply(x: UInt): BitPat = {
- require(x.isLit)
val len = if (x.isWidthKnown) x.getWidth else 0
- apply("b" + x.litValue.toString(2).reverse.padTo(len, "0").reverse.mkString)
+ apply("b" + x.litToBigInt.toString(2).reverse.padTo(len, "0").reverse.mkString)
}
}
@@ -93,7 +92,7 @@ sealed class BitPat(val value: BigInt, val mask: BigInt, width: Int) {
def getWidth: Int = width
def === (that: UInt): Bool = macro SourceInfoTransform.thatArg
def =/= (that: UInt): Bool = macro SourceInfoTransform.thatArg
-
+
def do_=== (that: UInt) // scalastyle:ignore method.name
(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): Bool = {
value.asUInt === (that & mask.asUInt)
@@ -102,7 +101,7 @@ sealed class BitPat(val value: BigInt, val mask: BigInt, width: Int) {
(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): Bool = {
!(this === that)
}
-
+
def != (that: UInt): Bool = macro SourceInfoTransform.thatArg
@chiselRuntimeDeprecated
@deprecated("Use '=/=', which avoids potential precedence problems", "chisel3")