From a51e26e62d6d40118026564cb30df246f00cfc53 Mon Sep 17 00:00:00 2001 From: Wilson Snyder Date: Sat, 30 Nov 2024 20:09:05 -0500 Subject: [PATCH] Internals: Some V3LinkCells debug improvements. No functional change. --- src/V3LinkCells.cpp | 19 +++++++++++-------- src/V3LinkDot.cpp | 1 - 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/src/V3LinkCells.cpp b/src/V3LinkCells.cpp index becf8b566..718541db7 100644 --- a/src/V3LinkCells.cpp +++ b/src/V3LinkCells.cpp @@ -56,7 +56,7 @@ public: , m_modp{modp} {} ~LinkCellsVertex() override = default; AstNodeModule* modp() const VL_MT_STABLE { return m_modp; } - string name() const override VL_MT_STABLE { return modp()->name(); } + string name() const override VL_MT_STABLE { return cvtToHex(modp()) + ' ' + modp()->name(); } FileLine* fileline() const override { return modp()->fileline(); } // Recursive modules get space for maximum recursion uint32_t rankAdder() const override { @@ -124,6 +124,10 @@ class LinkCellsVisitor final : public VNVisitor { if (!nodep->user1p()) nodep->user1p(new LinkCellsVertex{&m_graph, nodep}); return nodep->user1u().toGraphVertex(); } + void newEdge(V3GraphVertex* fromp, V3GraphVertex* top, int weight, bool cuttable) { + UINFO(9, "newEdge " << fromp->name() << " -> " << top->name() << endl); + new V3GraphEdge{&m_graph, fromp, top, weight, cuttable}; + } AstNodeModule* findModuleSym(const string& modName) { const VSymEnt* const foundp = m_mods.rootp()->findIdFallback(modName); @@ -184,7 +188,7 @@ class LinkCellsVisitor final : public VNVisitor { VL_RESTORER(m_modp); { // For nested modules/classes, child below parent - if (m_modp) new V3GraphEdge{&m_graph, vertex(m_modp), vertex(nodep), 1}; + if (m_modp) newEdge(vertex(m_modp), vertex(nodep), 1, false); // m_modp = nodep; UINFO(4, "Link Module: " << nodep << endl); @@ -216,7 +220,7 @@ class LinkCellsVisitor final : public VNVisitor { // Put under a fake vertex so that the graph ranking won't indicate // this is a top level module if (!m_libVertexp) m_libVertexp = new LibraryVertex{&m_graph}; - new V3GraphEdge{&m_graph, m_libVertexp, vertex(nodep), 1, false}; + newEdge(m_libVertexp, vertex(nodep), 1, false); } // Note AstBind also has iteration on cells iterateChildren(nodep); @@ -233,7 +237,7 @@ class LinkCellsVisitor final : public VNVisitor { if (modp) { if (VN_IS(modp, Iface)) { // Track module depths, so can sort list from parent down to children - new V3GraphEdge{&m_graph, vertex(m_modp), vertex(modp), 1, false}; + newEdge(vertex(m_modp), vertex(modp), 1, false); if (!nodep->cellp()) nodep->ifacep(VN_AS(modp, Iface)); } else if (VN_IS(modp, NotFoundModule)) { // Will error out later } else { @@ -279,7 +283,7 @@ class LinkCellsVisitor final : public VNVisitor { return; } } - new V3GraphEdge{&m_graph, vertex(m_modp), vertex(nodep->packagep()), 1, false}; + newEdge(vertex(m_modp), vertex(nodep->packagep()), 1, false); } void visit(AstBind* nodep) override { @@ -349,8 +353,7 @@ class LinkCellsVisitor final : public VNVisitor { // user1 etc will retain its pre-clone value cellmodp->user2p(otherModp); v3Global.rootp()->addModulesp(otherModp); - new V3GraphEdge{&m_graph, vertex(cellmodp), vertex(otherModp), 1, - false}; + newEdge(vertex(cellmodp), vertex(otherModp), 1, false); } cellmodp = otherModp; nodep->modp(cellmodp); @@ -363,7 +366,7 @@ class LinkCellsVisitor final : public VNVisitor { } else { // Non-recursive // Track module depths, so can sort list from parent down to children nodep->modp(cellmodp); - new V3GraphEdge{&m_graph, vertex(m_modp), vertex(cellmodp), 1, false}; + newEdge(vertex(m_modp), vertex(cellmodp), 1, false); } } } diff --git a/src/V3LinkDot.cpp b/src/V3LinkDot.cpp index dceba9722..304bd4529 100644 --- a/src/V3LinkDot.cpp +++ b/src/V3LinkDot.cpp @@ -3134,7 +3134,6 @@ class LinkDotResolveVisitor final : public VNVisitor { if (m_ds.m_dotText != "") m_ds.m_dotText += "." + nodep->name(); ok = m_ds.m_dotPos == DP_SCOPE || m_ds.m_dotPos == DP_FIRST; } else if (const AstNodeFTask* const ftaskp = VN_CAST(foundp->nodep(), NodeFTask)) { - if (!ftaskp->isFunction() || ftaskp->classMethod()) { ok = m_ds.m_dotPos == DP_NONE; if (ok) {