From 584f8cc9e7f09c88bba1d771d29cd59b3f9a8860 Mon Sep 17 00:00:00 2001 From: Wilson Snyder Date: Fri, 5 May 2023 13:47:34 -0400 Subject: [PATCH] Internal: With --xml-only support --debug-exit-uvm --- src/V3AstNodes.cpp | 4 +++- src/V3EmitXml.cpp | 8 ++++---- src/Verilator.cpp | 1 + test_regress/t/t_process_parse.pl | 11 +++++++++-- 4 files changed, 17 insertions(+), 7 deletions(-) diff --git a/src/V3AstNodes.cpp b/src/V3AstNodes.cpp index 6c300058f..e0b2f1b4f 100644 --- a/src/V3AstNodes.cpp +++ b/src/V3AstNodes.cpp @@ -391,8 +391,10 @@ string AstVar::verilogKwd() const { return "wreal"; } else if (varType() == VVarType::IFACEREF) { return "ifaceref"; - } else { + } else if (dtypep()) { return dtypep()->name(); + } else { + return "UNKNOWN"; } } diff --git a/src/V3EmitXml.cpp b/src/V3EmitXml.cpp index 5dc1ed39e..5466bf2f4 100644 --- a/src/V3EmitXml.cpp +++ b/src/V3EmitXml.cpp @@ -188,7 +188,7 @@ class EmitXmlFileVisitor final : public VNVisitorConst { void visit(AstVar* nodep) override { const VVarType typ = nodep->varType(); const string kw = nodep->verilogKwd(); - const string vt = nodep->dtypep()->name(); + const string vt = nodep->dtypep() ? nodep->dtypep()->name() : ""; outputTag(nodep, ""); if (nodep->isIO()) { puts(" dir="); @@ -225,7 +225,7 @@ class EmitXmlFileVisitor final : public VNVisitorConst { void visit(AstPin* nodep) override { // What we call a pin in verilator is a port in the IEEE spec. outputTag(nodep, "port"); // IEEE: vpiPort - if (nodep->modVarp()->isIO()) { + if (nodep->modVarp() && nodep->modVarp()->isIO()) { puts(" direction=\"" + nodep->modVarp()->direction().xmlKwd() + "\""); } puts(" portIndex=\"" + cvtToStr(nodep->pinNum()) + "\""); // IEEE: vpiPortIndex @@ -254,7 +254,7 @@ class EmitXmlFileVisitor final : public VNVisitorConst { void visit(AstNodeCCall* nodep) override { outputTag(nodep, ""); puts(" func="); - putsQuoted(nodep->funcp()->name()); + putsQuoted(nodep->funcp() ? nodep->funcp()->name() : nodep->name()); outputChildrenEnd(nodep, ""); } @@ -401,7 +401,7 @@ private: } } void visit(AstCell* nodep) override { - if (nodep->modp()->dead()) return; + if (nodep->modp() && nodep->modp()->dead()) return; if (!m_hasChildren) m_os << ">\n"; m_os << "fileline()->xmlDetailedLocation() << " name=\"" << nodep->name() << "\"" diff --git a/src/Verilator.cpp b/src/Verilator.cpp index 79a38fce4..6737b8f40 100644 --- a/src/Verilator.cpp +++ b/src/Verilator.cpp @@ -144,6 +144,7 @@ static void process() { if (v3Global.opt.stats()) V3Stats::statsStageAll(v3Global.rootp(), "Link"); if (v3Global.opt.debugExitUvm()) { V3Error::abortIfErrors(); + if (v3Global.opt.xmlOnly()) V3EmitXml::emitxml(); cout << "--debug-exit-uvm: Exiting after UVM-supported pass\n"; std::exit(0); } diff --git a/test_regress/t/t_process_parse.pl b/test_regress/t/t_process_parse.pl index 71e0db056..0023276e1 100755 --- a/test_regress/t/t_process_parse.pl +++ b/test_regress/t/t_process_parse.pl @@ -12,9 +12,16 @@ scenarios(vlt => 1); top_filename("t_process.v"); -lint( - verilator_flags2 => ["--debug-exit-uvm"], +my $out_filename = "$Self->{obj_dir}/V$Self->{name}.xml"; + +compile( + verilator_flags2 => ["--debug-exit-uvm", "--xml-only"], + make_main => 0, + make_top_shell => 0, + verilator_make_gmake => 0, ); +file_grep($out_filename, qr/./); # Exists + ok(1); 1;