summaryrefslogtreecommitdiff
path: root/src/main/scala/chisel3/util/BitPat.scala
diff options
context:
space:
mode:
authorJiuyang Liu2021-05-10 19:04:23 +0000
committerGitHub2021-05-10 19:04:23 +0000
commit994e8780f41cf64c1b9758745c6f81c7e3dd375c (patch)
tree2dedf965e4e6ca7d1de9fd88c011f8a997f0fa8f /src/main/scala/chisel3/util/BitPat.scala
parentc118facb82e43c010a6333c5281b956a7c9c7e20 (diff)
implement equal to BitPat. (#1867)
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Diffstat (limited to 'src/main/scala/chisel3/util/BitPat.scala')
-rw-r--r--src/main/scala/chisel3/util/BitPat.scala7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/main/scala/chisel3/util/BitPat.scala b/src/main/scala/chisel3/util/BitPat.scala
index 5a40d312..88e46e3c 100644
--- a/src/main/scala/chisel3/util/BitPat.scala
+++ b/src/main/scala/chisel3/util/BitPat.scala
@@ -108,6 +108,13 @@ sealed class BitPat(val value: BigInt, val mask: BigInt, width: Int) extends Sou
def === (that: UInt): Bool = macro SourceInfoTransform.thatArg
def =/= (that: UInt): Bool = macro SourceInfoTransform.thatArg
+ override def equals(obj: Any): Boolean = {
+ obj match {
+ case y: BitPat => value == y.value && mask == y.mask && getWidth == y.getWidth
+ case _ => false
+ }
+ }
+
/** @group SourceInfoTransformMacro */
def do_=== (that: UInt)
(implicit sourceInfo: SourceInfo, compileOptions: CompileOptions): Bool = {