aboutsummaryrefslogtreecommitdiff
path: root/src/main/scala/firrtl/Utils.scala
diff options
context:
space:
mode:
authorJack Koenig2019-08-13 12:09:27 +0530
committerGitHub2019-08-13 12:09:27 +0530
commitf08f8dbb3c480220f92923a7f3242fcbb644b65e (patch)
tree45cdb7543f6252ad2feb5aaf4e0e0580d3d27565 /src/main/scala/firrtl/Utils.scala
parent63e88b6e1696e2c8d6da91f6f5eb128a9d0395ae (diff)
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
Diffstat (limited to 'src/main/scala/firrtl/Utils.scala')
-rw-r--r--src/main/scala/firrtl/Utils.scala9
1 files changed, 9 insertions, 0 deletions
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)")
}
}