From 994e8780f41cf64c1b9758745c6f81c7e3dd375c Mon Sep 17 00:00:00 2001 From: Jiuyang Liu Date: Mon, 10 May 2021 19:04:23 +0000 Subject: implement equal to BitPat. (#1867) Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>--- src/main/scala/chisel3/util/BitPat.scala | 7 +++++++ 1 file changed, 7 insertions(+) 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 = { -- cgit v1.2.3