From 3926710fcd4ac55cdc9f6d1a4155cc1400c42527 Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Tue, 9 Apr 2024 16:10:14 -0700 Subject: [PATCH] Fix === for abstract Reset types (backport #3979) (#3980) * Fix === for abstract Reset types (#3979) Previously, the function would infinitely recurse resulting in a stack overflow. (cherry picked from commit ea2d1036588ca63024085f5891cbcfdfc0faf7b0) # Conflicts: # core/src/main/scala/chisel3/Data.scala * Resolve backport conflicts --------- 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 6624bbeac15..c1b045c444f 100644 --- a/core/src/main/scala/chisel3/Data.scala +++ b/core/src/main/scala/chisel3/Data.scala @@ -907,7 +907,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: Interval, that: Interval) => thiz === that case (thiz: FixedPoint, that: FixedPoint) => thiz === that case (thiz: EnumType, that: EnumType) => thiz === that diff --git a/src/test/scala/chiselTests/DataEqualitySpec.scala b/src/test/scala/chiselTests/DataEqualitySpec.scala index 4f533b815fd..8d79dac1cae 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 {