1
0
Fork 0

Add hooks to print debug information into the graphml file

This commit is contained in:
Jacob Chang 2017-04-14 14:21:22 -07:00 committed by Wesley W. Terpstra
parent 153178ac4f
commit d3925f0998
2 changed files with 7 additions and 3 deletions

View File

@ -54,7 +54,7 @@ abstract class LazyModule()(implicit val p: Parameters)
def module: LazyModuleImp
protected[diplomacy] def instantiate() = {
children.reverse.foreach { c =>
children.reverse.foreach { c =>
// !!! fix chisel3 so we can pass the desired sourceInfo
// implicit val sourceInfo = c.module.outer.info
Module(c.module)
@ -69,6 +69,7 @@ abstract class LazyModule()(implicit val p: Parameters)
buf ++= "<graphml xmlns=\"http://graphml.graphdrawing.org/xmlns\" xmlns:y=\"http://www.yworks.com/xml/graphml\">\n"
buf ++= " <key for=\"node\" id=\"n\" yfiles.type=\"nodegraphics\"/>\n"
buf ++= " <key for=\"edge\" id=\"e\" yfiles.type=\"edgegraphics\"/>\n"
buf ++= " <key for=\"node\" id=\"d\" attr.name=\"NodeDebugString\" attr.type=\"string\"/>\n"
buf ++= " <graph id=\"G\" edgedefault=\"directed\">\n"
nodesGraphML(buf, " ")
edgesGraphML(buf, " ")
@ -84,7 +85,9 @@ abstract class LazyModule()(implicit val p: Parameters)
buf ++= s"""${pad} <data key=\"n\"><y:ShapeNode><y:NodeLabel modelName=\"sides\" modelPosition=\"w\" rotationAngle=\"270.0\">${module.instanceName}</y:NodeLabel></y:ShapeNode></data>\n"""
buf ++= s"""${pad} <graph id=\"${index}::\" edgedefault=\"directed\">\n"""
nodes.filter(!_.omitGraphML).foreach { n =>
buf ++= s"""${pad} <node id=\"${index}::${n.index}\"/>\n"""
buf ++= s"""${pad} <node id=\"${index}::${n.index}\">\n"""
buf ++= s"""${pad} <data key=\"d\">${n.nodedebugstring}</data>\n"""
buf ++= s"""${pad} </node>\n"""
}
children.filter(!_.omitGraphML).foreach { _.nodesGraphML(buf, pad + " ") }
buf ++= s"""${pad} </graph>\n"""
@ -103,7 +106,7 @@ abstract class LazyModule()(implicit val p: Parameters)
} }
children.filter(!_.omitGraphML).foreach { c => c.edgesGraphML(buf, pad) }
}
def nodeIterator(iterfunc: (LazyModule) => Unit): Unit = {
iterfunc(this)
children.foreach( _.nodeIterator(iterfunc) )

View File

@ -60,6 +60,7 @@ abstract class BaseNode
def nodename = getClass.getName.split('.').last
def name = lazyModule.name + "." + nodename
def omitGraphML = outputs.isEmpty && inputs.isEmpty
lazy val nodedebugstring: String = ""
protected[diplomacy] def gci: Option[BaseNode] // greatest common inner
protected[diplomacy] def gco: Option[BaseNode] // greatest common outer