diff options
| author | Angie Wang | 2016-09-14 21:42:45 -0700 |
|---|---|---|
| committer | Donggyu | 2016-09-14 21:42:45 -0700 |
| commit | 92c31ab4ff941289b6f5c79a06f00907bb32c638 (patch) | |
| tree | 853b1e24315099c9788334a578747d030fcd2c55 /src | |
| parent | 1fe291cb9a08fb62e55e2d8c16f5b011af83cb44 (diff) | |
Fix for more general case of getConnectOrigin with reg feedback (#301)
Diffstat (limited to 'src')
| -rw-r--r-- | src/main/scala/firrtl/passes/AnnotateMemMacros.scala | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/src/main/scala/firrtl/passes/AnnotateMemMacros.scala b/src/main/scala/firrtl/passes/AnnotateMemMacros.scala index 1d415529..58e10a66 100644 --- a/src/main/scala/firrtl/passes/AnnotateMemMacros.scala +++ b/src/main/scala/firrtl/passes/AnnotateMemMacros.scala @@ -45,12 +45,7 @@ object AnalysisUtils { // limitation: only works in a module (stops @ module inputs) // TODO: more thorough (i.e. a + 0 = a) def getConnectOrigin(connects: Map[String, Expression], node: String): Expression = { - if (connects contains node) { - val exp = connects(node) - // handles case when a node is connected to itself (connecting reg output back to input) - if (exp.serialize == node) exp - else getOrigin(connects, exp) - } + if (connects contains node) getOrigin(connects, connects(node)) else EmptyExpression } @@ -75,7 +70,8 @@ object AnalysisUtils { else e case DoPrim((PrimOps.AsUInt | PrimOps.AsSInt | PrimOps.AsClock), args, _, _) => getOrigin(connects, args.head) - case _: WRef | _: SubField | _: SubIndex | _: SubAccess if connects contains e.serialize => + // note: this should stop on a reg, but will stack overflow for combinational loops (not allowed) + case _: WRef | _: SubField | _: SubIndex | _: SubAccess if connects.contains(e.serialize) && kind(e) != RegKind => getConnectOrigin(connects, e.serialize) case _ => e } |
