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";
} else if (varType() == VVarType::IFACEREF) {
return "ifaceref";
} else {
} else if (dtypep()) {
return dtypep()->name();
} else {
return "UNKNOWN";
}
}

View File

@ -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 << "<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.debugExitUvm()) {
V3Error::abortIfErrors();
if (v3Global.opt.xmlOnly()) V3EmitXml::emitxml();
cout << "--debug-exit-uvm: Exiting after UVM-supported pass\n";
std::exit(0);
}

View File

@ -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;