From 5587c504b6529c214bcc9c196872f2803d88b624 Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Tue, 9 Apr 2024 15:06:16 -0700 Subject: [PATCH] Fix === for abstract Reset types (#3979) (#3982) Previously, the function would infinitely recurse resulting in a stack overflow. (cherry picked from commit ea2d1036588ca63024085f5891cbcfdfc0faf7b0) Co-authored-by: Jack Koenig --- core/src/main/scala/chisel3/Data.scala | 2 +- src/test/scala/chiselTests/DataEqualitySpec.scala | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/core/src/main/scala/chisel3/Data.scala b/core/src/main/scala/chisel3/Data.scala index aa946bee4e2..116a4d479b2 100644 --- a/core/src/main/scala/chisel3/Data.scala +++ b/core/src/main/scala/chisel3/Data.scala @@ -912,7 +912,7 @@ object Data { case (thiz: UInt, that: UInt) => thiz === that case (thiz: SInt, that: SInt) => thiz === that case (thiz: AsyncReset, that: AsyncReset) => thiz.asBool === that.asBool - case (thiz: Reset, that: Reset) => thiz === that + case (thiz: Reset, that: Reset) => thiz.asBool === that.asBool case (thiz: EnumType, that: EnumType) => thiz === that case (thiz: Clock, that: Clock) => thiz.asUInt === that.asUInt case (thiz: Vec[_], that: Vec[_]) => diff --git a/src/test/scala/chiselTests/DataEqualitySpec.scala b/src/test/scala/chiselTests/DataEqualitySpec.scala index ce1cca94f87..8211a078654 100644 --- a/src/test/scala/chiselTests/DataEqualitySpec.scala +++ b/src/test/scala/chiselTests/DataEqualitySpec.scala @@ -109,6 +109,11 @@ class DataEqualitySpec extends ChiselFlatSpec with Utils { new EqualityTester(true.B, false.B) } } + it should "support abstract reset wires" in { + assertTesterPasses { + new EqualityTester(WireDefault(Reset(), true.B), WireDefault(Reset(), true.B)) + } + } behavior.of("AsyncReset === AsyncReset") it should "pass with equal values" in {