diff --git a/docs/CONTRIBUTORS b/docs/CONTRIBUTORS
index 47c79e2f9..999f1086a 100644
--- a/docs/CONTRIBUTORS
+++ b/docs/CONTRIBUTORS
@@ -83,6 +83,7 @@ Sebastien Van Cauwenberghe
Sergi Granell
Stefan Wallentowitz
Stephen Henry
+Steven Hugg
Tim Snyder
Tobias Rosenkranz
Tobias Wölfel
diff --git a/src/V3EmitXml.cpp b/src/V3EmitXml.cpp
index c2facba08..83ff6363d 100644
--- a/src/V3EmitXml.cpp
+++ b/src/V3EmitXml.cpp
@@ -112,12 +112,67 @@ class EmitXmlFileVisitor final : public AstNVisitor {
putsQuoted(nodep->origName());
outputChildrenEnd(nodep, "instance");
}
+ virtual void visit(AstNodeIf* nodep) override {
+ outputTag(nodep, "if");
+ puts(">\n");
+ iterateAndNextNull(nodep->op1p());
+ puts("\n");
+ iterateAndNextNull(nodep->op2p());
+ puts("\n");
+ if (nodep->op3p()) {
+ puts("\n");
+ iterateAndNextNull(nodep->op3p());
+ puts("\n");
+ }
+ puts("\n");
+ }
+ virtual void visit(AstWhile* nodep) override {
+ outputTag(nodep, "while");
+ puts(">\n");
+ puts("\n");
+ iterateAndNextNull(nodep->op1p());
+ puts("\n");
+ if (nodep->op2p()) {
+ puts("\n");
+ iterateAndNextNull(nodep->op2p());
+ puts("\n");
+ }
+ if (nodep->op3p()) {
+ puts("\n");
+ iterateAndNextNull(nodep->op3p());
+ puts("\n");
+ }
+ if (nodep->op4p()) {
+ puts("\n");
+ iterateAndNextNull(nodep->op4p());
+ puts("\n");
+ }
+ puts("\n");
+ }
virtual void visit(AstNetlist* nodep) override {
puts("\n");
iterateChildren(nodep);
puts("\n");
}
- virtual void visit(AstConstPool*) override {}
+ virtual void visit(AstConstPool* nodep) override {
+ if (!v3Global.opt.xmlOnly()) {
+ puts("\n");
+ iterateChildren(nodep);
+ puts("\n");
+ }
+ }
+ virtual void visit(AstInitArray* nodep) override {
+ puts("\n");
+ const AstInitArray::KeyItemMap& map = nodep->map();
+ for (AstInitArray::KeyItemMap::const_iterator it = map.begin(); it != map.end(); ++it) {
+ puts("first));
+ puts("\">\n");
+ iterateChildren(it->second);
+ puts("\n");
+ }
+ puts("\n");
+ }
virtual void visit(AstNodeModule* nodep) override {
outputTag(nodep, "");
puts(" origName=");
@@ -195,6 +250,12 @@ class EmitXmlFileVisitor final : public AstNVisitor {
putsQuoted(nodep->dotted());
outputChildrenEnd(nodep, "");
}
+ virtual void visit(AstNodeCCall* nodep) override {
+ outputTag(nodep, "");
+ puts(" func=");
+ putsQuoted(nodep->funcp()->name());
+ outputChildrenEnd(nodep, "");
+ }
// Data types
virtual void visit(AstBasicDType* nodep) override {
@@ -203,6 +264,9 @@ class EmitXmlFileVisitor final : public AstNVisitor {
puts(" left=\"" + cvtToStr(nodep->left()) + "\"");
puts(" right=\"" + cvtToStr(nodep->right()) + "\"");
}
+ if (nodep->isSigned()) {
+ puts(" signed=\"true\"");
+ }
puts("/>\n");
}
virtual void visit(AstIfaceRefDType* nodep) override {
@@ -319,6 +383,7 @@ private:
// VISITORS
virtual void visit(AstConstPool*) override {}
+
virtual void visit(AstNodeModule* nodep) override {
if (nodep->level() >= 0
&& nodep->level() <= 2) { // ==2 because we don't add wrapper when in XML mode
diff --git a/test_regress/t/t_dist_error_format.pl b/test_regress/t/t_dist_error_format.pl
index 8a30f1f7b..654a7c70f 100755
--- a/test_regress/t/t_dist_error_format.pl
+++ b/test_regress/t/t_dist_error_format.pl
@@ -40,6 +40,7 @@ sub formats {
++$lineno;
$line =~ s/(\$display|\$write).*\".*%(Error|Warning)//;
if ($line =~ /(Error|Warning)/
+ && $line !~ /^\s*
-
-
-
+
+
+
diff --git a/test_regress/t/t_var_xref_gen.pl b/test_regress/t/t_var_xref_gen.pl
index 873cde7f6..d862fcf2e 100755
--- a/test_regress/t/t_var_xref_gen.pl
+++ b/test_regress/t/t_var_xref_gen.pl
@@ -8,11 +8,12 @@ if (!$::Driver) { use FindBin; exec("$FindBin::Bin/bootstrap.pl", @ARGV, $0); di
# Version 2.0.
# SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0
-scenarios(simulator => 1);
+scenarios(vlt => 1);
compile(
verilator_flags2 => ["--debug-check"],
);
ok(1);
+
1;
diff --git a/test_regress/t/t_xml_debugcheck.out b/test_regress/t/t_xml_debugcheck.out
new file mode 100644
index 000000000..bd15fe808
--- /dev/null
+++ b/test_regress/t/t_xml_debugcheck.out
@@ -0,0 +1,1560 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ |
+ |
+
+
+ |
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
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+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/test_regress/t/t_xml_debugcheck.pl b/test_regress/t/t_xml_debugcheck.pl
new file mode 100755
index 000000000..4770d909d
--- /dev/null
+++ b/test_regress/t/t_xml_debugcheck.pl
@@ -0,0 +1,37 @@
+#!/usr/bin/env perl
+if (!$::Driver) { use FindBin; exec("$FindBin::Bin/bootstrap.pl", @ARGV, $0); die; }
+# DESCRIPTION: Verilator: Verilog Test driver/expect definition
+#
+# Copyright 2012 by Wilson Snyder. This program is free software; you
+# can redistribute it and/or modify it under the terms of either the GNU
+# Lesser General Public License Version 3 or the Perl Artistic License
+# Version 2.0.
+# SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0
+
+scenarios(vlt => 1);
+
+my $out_filename = "$Self->{obj_dir}/V$Self->{name}.xml";
+
+top_filename("t/t_enum_type_methods.v");
+
+compile(
+ verilator_flags2 => ['--debug-check', '--flatten'],
+ verilator_make_gmake => 0,
+ make_top_shell => 0,
+ make_main => 0,
+ );
+
+files_identical("$out_filename", $Self->{golden_filename});
+
+# make sure that certain tags are present in --debug-check
+# that would not be present in --xml-only
+file_grep("$out_filename", qr//x); # for and
+file_grep("$out_filename", qr/ signed=/x); # for
+file_grep("$out_filename", qr/ func=/x); # for
+
+ok(1);
+1;
diff --git a/test_regress/t/t_xml_first.out b/test_regress/t/t_xml_first.out
index b00ac18b9..929ff89c1 100644
--- a/test_regress/t/t_xml_first.out
+++ b/test_regress/t/t_xml_first.out
@@ -79,7 +79,7 @@
-
+
diff --git a/test_regress/t/t_xml_flat.out b/test_regress/t/t_xml_flat.out
index 964c5b791..ea35502fc 100644
--- a/test_regress/t/t_xml_flat.out
+++ b/test_regress/t/t_xml_flat.out
@@ -108,7 +108,7 @@
-
+
diff --git a/test_regress/t/t_xml_flat_vlvbound.out b/test_regress/t/t_xml_flat_vlvbound.out
index 28a1c9e97..aafd3bcf6 100644
--- a/test_regress/t/t_xml_flat_vlvbound.out
+++ b/test_regress/t/t_xml_flat_vlvbound.out
@@ -68,43 +68,51 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
-
-
-
+
+
@@ -126,43 +134,51 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
-
-
-
+
+
@@ -189,11 +205,11 @@
-
-
+
+
-
-
+
+
diff --git a/test_regress/t/t_xml_tag.out b/test_regress/t/t_xml_tag.out
index 873eaa1a0..9c4c044e7 100644
--- a/test_regress/t/t_xml_tag.out
+++ b/test_regress/t/t_xml_tag.out
@@ -55,7 +55,7 @@
-
+