Add hooks to print debug information into the graphml file
This commit is contained in:
parent
153178ac4f
commit
d3925f0998
@ -54,7 +54,7 @@ abstract class LazyModule()(implicit val p: Parameters)
|
|||||||
def module: LazyModuleImp
|
def module: LazyModuleImp
|
||||||
|
|
||||||
protected[diplomacy] def instantiate() = {
|
protected[diplomacy] def instantiate() = {
|
||||||
children.reverse.foreach { c =>
|
children.reverse.foreach { c =>
|
||||||
// !!! fix chisel3 so we can pass the desired sourceInfo
|
// !!! fix chisel3 so we can pass the desired sourceInfo
|
||||||
// implicit val sourceInfo = c.module.outer.info
|
// implicit val sourceInfo = c.module.outer.info
|
||||||
Module(c.module)
|
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 ++= "<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=\"node\" id=\"n\" yfiles.type=\"nodegraphics\"/>\n"
|
||||||
buf ++= " <key for=\"edge\" id=\"e\" yfiles.type=\"edgegraphics\"/>\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"
|
buf ++= " <graph id=\"G\" edgedefault=\"directed\">\n"
|
||||||
nodesGraphML(buf, " ")
|
nodesGraphML(buf, " ")
|
||||||
edgesGraphML(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} <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"""
|
buf ++= s"""${pad} <graph id=\"${index}::\" edgedefault=\"directed\">\n"""
|
||||||
nodes.filter(!_.omitGraphML).foreach { 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 + " ") }
|
children.filter(!_.omitGraphML).foreach { _.nodesGraphML(buf, pad + " ") }
|
||||||
buf ++= s"""${pad} </graph>\n"""
|
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) }
|
children.filter(!_.omitGraphML).foreach { c => c.edgesGraphML(buf, pad) }
|
||||||
}
|
}
|
||||||
|
|
||||||
def nodeIterator(iterfunc: (LazyModule) => Unit): Unit = {
|
def nodeIterator(iterfunc: (LazyModule) => Unit): Unit = {
|
||||||
iterfunc(this)
|
iterfunc(this)
|
||||||
children.foreach( _.nodeIterator(iterfunc) )
|
children.foreach( _.nodeIterator(iterfunc) )
|
||||||
|
@ -60,6 +60,7 @@ abstract class BaseNode
|
|||||||
def nodename = getClass.getName.split('.').last
|
def nodename = getClass.getName.split('.').last
|
||||||
def name = lazyModule.name + "." + nodename
|
def name = lazyModule.name + "." + nodename
|
||||||
def omitGraphML = outputs.isEmpty && inputs.isEmpty
|
def omitGraphML = outputs.isEmpty && inputs.isEmpty
|
||||||
|
lazy val nodedebugstring: String = ""
|
||||||
|
|
||||||
protected[diplomacy] def gci: Option[BaseNode] // greatest common inner
|
protected[diplomacy] def gci: Option[BaseNode] // greatest common inner
|
||||||
protected[diplomacy] def gco: Option[BaseNode] // greatest common outer
|
protected[diplomacy] def gco: Option[BaseNode] // greatest common outer
|
||||||
|
Loading…
Reference in New Issue
Block a user