From f08f8dbb3c480220f92923a7f3242fcbb644b65e Mon Sep 17 00:00:00 2001 From: Jack Koenig Date: Tue, 13 Aug 2019 12:09:27 +0530 Subject: Infer reset (#1068) * Add abstract "Reset" which can be inferred to AsyncReset or UInt<1> * Enhance async reset initial value literal check to support aggregates--- src/main/scala/firrtl/Utils.scala | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/main/scala/firrtl/Utils.scala') diff --git a/src/main/scala/firrtl/Utils.scala b/src/main/scala/firrtl/Utils.scala index 72003608..206afc09 100644 --- a/src/main/scala/firrtl/Utils.scala +++ b/src/main/scala/firrtl/Utils.scala @@ -445,6 +445,7 @@ object Utils extends LazyLogging { } def get_valid_points(t1: Type, t2: Type, flip1: Orientation, flip2: Orientation): Seq[(Int,Int)] = { + import passes.CheckTypes.legalResetType //;println_all(["Inside with t1:" t1 ",t2:" t2 ",f1:" flip1 ",f2:" flip2]) (t1, t2) match { case (_: UIntType, _: UIntType) => if (flip1 == flip2) Seq((0, 0)) else Nil @@ -474,6 +475,14 @@ object Utils extends LazyLogging { ilen + get_size(t1x.tpe), jlen + get_size(t2x.tpe)) }._1 case (ClockType, ClockType) => if (flip1 == flip2) Seq((0, 0)) else Nil + case (AsyncResetType, AsyncResetType) => if (flip1 == flip2) Seq((0, 0)) else Nil + // The following two cases handle driving ResetType from other legal reset types + // Flippedness is important here because ResetType can be driven by other reset types, but it + // cannot *drive* other reset types + case (ResetType, other) => + if (legalResetType(other) && flip1 == Default && flip1 == flip2) Seq((0, 0)) else Nil + case (other, ResetType) => + if (legalResetType(other) && flip1 == Flip && flip1 == flip2) Seq((0, 0)) else Nil case _ => throwInternalError(s"get_valid_points: shouldn't be here - ($t1, $t2)") } } -- cgit v1.2.3