diff options
Diffstat (limited to 'src/main/scala')
| -rw-r--r-- | src/main/scala/firrtl/graph/DiGraph.scala | 4 | ||||
| -rw-r--r-- | src/main/scala/firrtl/transforms/RemoveWires.scala | 5 |
2 files changed, 5 insertions, 4 deletions
diff --git a/src/main/scala/firrtl/graph/DiGraph.scala b/src/main/scala/firrtl/graph/DiGraph.scala index 450ec4ff..135603ff 100644 --- a/src/main/scala/firrtl/graph/DiGraph.scala +++ b/src/main/scala/firrtl/graph/DiGraph.scala @@ -7,7 +7,7 @@ import scala.collection.mutable import scala.collection.mutable.{LinkedHashSet, LinkedHashMap} /** An exception that is raised when an assumed DAG has a cycle */ -class CyclicException extends Exception("No valid linearization for cyclic graph") +class CyclicException(val node: Any) extends Exception(s"No valid linearization for cyclic graph, found at $node") /** An exception that is raised when attempting to find an unreachable node */ class PathNotFoundException extends Exception("Unreachable node") @@ -79,7 +79,7 @@ class DiGraph[T] private[graph] (private[graph] val edges: LinkedHashMap[T, Link def visit(n: T): Unit = { if (tempMarked.contains(n)) { - throw new CyclicException + throw new CyclicException(n) } if (unmarked.contains(n)) { tempMarked += n diff --git a/src/main/scala/firrtl/transforms/RemoveWires.scala b/src/main/scala/firrtl/transforms/RemoveWires.scala index 931288d9..5ba953cd 100644 --- a/src/main/scala/firrtl/transforms/RemoveWires.scala +++ b/src/main/scala/firrtl/transforms/RemoveWires.scala @@ -111,9 +111,10 @@ class RemoveWires extends Transform { case Success(logic) => Module(info, name, ports, Block(decls ++ logic ++ otherStmts)) // If we hit a CyclicException, just abort removing wires - case Failure(_: CyclicException) => + case Failure(c: CyclicException) => + val problematicNode = c.node logger.warn(s"Cycle found in module $name, " + - "wires will not be removed which can prevent optimizations!") + s"wires will not be removed which can prevent optimizations! Problem node: $problematicNode") mod case Failure(other) => throw other } |
