Internal: With --xml-only support --debug-exit-uvm

This commit is contained in:
Wilson Snyder 2023-05-05 13:47:34 -04:00
parent 61e1483b74
commit 584f8cc9e7
4 changed files with 17 additions and 7 deletions

View File

@ -391,8 +391,10 @@ string AstVar::verilogKwd() const {
return "wreal"; return "wreal";
} else if (varType() == VVarType::IFACEREF) { } else if (varType() == VVarType::IFACEREF) {
return "ifaceref"; return "ifaceref";
} else { } else if (dtypep()) {
return dtypep()->name(); return dtypep()->name();
} else {
return "UNKNOWN";
} }
} }

View File

@ -188,7 +188,7 @@ class EmitXmlFileVisitor final : public VNVisitorConst {
void visit(AstVar* nodep) override { void visit(AstVar* nodep) override {
const VVarType typ = nodep->varType(); const VVarType typ = nodep->varType();
const string kw = nodep->verilogKwd(); const string kw = nodep->verilogKwd();
const string vt = nodep->dtypep()->name(); const string vt = nodep->dtypep() ? nodep->dtypep()->name() : "";
outputTag(nodep, ""); outputTag(nodep, "");
if (nodep->isIO()) { if (nodep->isIO()) {
puts(" dir="); puts(" dir=");
@ -225,7 +225,7 @@ class EmitXmlFileVisitor final : public VNVisitorConst {
void visit(AstPin* nodep) override { void visit(AstPin* nodep) override {
// What we call a pin in verilator is a port in the IEEE spec. // What we call a pin in verilator is a port in the IEEE spec.
outputTag(nodep, "port"); // IEEE: vpiPort outputTag(nodep, "port"); // IEEE: vpiPort
if (nodep->modVarp()->isIO()) { if (nodep->modVarp() && nodep->modVarp()->isIO()) {
puts(" direction=\"" + nodep->modVarp()->direction().xmlKwd() + "\""); puts(" direction=\"" + nodep->modVarp()->direction().xmlKwd() + "\"");
} }
puts(" portIndex=\"" + cvtToStr(nodep->pinNum()) + "\""); // IEEE: vpiPortIndex puts(" portIndex=\"" + cvtToStr(nodep->pinNum()) + "\""); // IEEE: vpiPortIndex
@ -254,7 +254,7 @@ class EmitXmlFileVisitor final : public VNVisitorConst {
void visit(AstNodeCCall* nodep) override { void visit(AstNodeCCall* nodep) override {
outputTag(nodep, ""); outputTag(nodep, "");
puts(" func="); puts(" func=");
putsQuoted(nodep->funcp()->name()); putsQuoted(nodep->funcp() ? nodep->funcp()->name() : nodep->name());
outputChildrenEnd(nodep, ""); outputChildrenEnd(nodep, "");
} }
@ -401,7 +401,7 @@ private:
} }
} }
void visit(AstCell* nodep) override { void visit(AstCell* nodep) override {
if (nodep->modp()->dead()) return; if (nodep->modp() && nodep->modp()->dead()) return;
if (!m_hasChildren) m_os << ">\n"; if (!m_hasChildren) m_os << ">\n";
m_os << "<cell " << nodep->fileline()->xmlDetailedLocation() << " name=\"" << nodep->name() m_os << "<cell " << nodep->fileline()->xmlDetailedLocation() << " name=\"" << nodep->name()
<< "\"" << "\""

View File

@ -144,6 +144,7 @@ static void process() {
if (v3Global.opt.stats()) V3Stats::statsStageAll(v3Global.rootp(), "Link"); if (v3Global.opt.stats()) V3Stats::statsStageAll(v3Global.rootp(), "Link");
if (v3Global.opt.debugExitUvm()) { if (v3Global.opt.debugExitUvm()) {
V3Error::abortIfErrors(); V3Error::abortIfErrors();
if (v3Global.opt.xmlOnly()) V3EmitXml::emitxml();
cout << "--debug-exit-uvm: Exiting after UVM-supported pass\n"; cout << "--debug-exit-uvm: Exiting after UVM-supported pass\n";
std::exit(0); std::exit(0);
} }

View File

@ -12,9 +12,16 @@ scenarios(vlt => 1);
top_filename("t_process.v"); top_filename("t_process.v");
lint( my $out_filename = "$Self->{obj_dir}/V$Self->{name}.xml";
verilator_flags2 => ["--debug-exit-uvm"],
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); ok(1);
1; 1;