Fix std:: to be parsed first (#3864) (#3928)

This commit is contained in:
Aleksander Kiryk 2023-02-03 15:04:16 +01:00 committed by GitHub
parent 00f0027c80
commit 31130c4b4a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
42 changed files with 202 additions and 102 deletions

View File

@ -416,6 +416,7 @@ detailed descriptions of these arguments.
--no-skip-identical Disable skipping identical output
--stats Create statistics file
--stats-vars Provide statistics on variables
--no-std Prevent parsing standard library
--structs-packed Convert all unpacked structures to packed structures
-sv Enable SystemVerilog parsing
+systemverilogext+<ext> Synonym for +1800-2017ext+<ext>

View File

@ -434,7 +434,7 @@ Summary:
Preprocess the source code, but do not compile, similar to C++
preprocessing using :command:`gcc -E`. Output is written to standard
out. Beware of enabling debugging messages, as they will also go to
standard out.
standard out. See :vlopt:`--no-std`, which is implied by this.
See also :vlopt:`--dump-defines`, :vlopt:`-P`, and
:vlopt:`--pp-comments` options.
@ -1202,6 +1202,10 @@ Summary:
by size (plain :vlopt:`--stats` just gives a count). See
:vlopt:`--stats`, which is implied by this.
.. option:: --no-std
Prevents parsing standard library.
.. option:: --structs-packed
Converts all unpacked structures to packed structures, and issues an

View File

@ -26,6 +26,10 @@
// verilator lint_off TIMESCALEMOD
// verilator lint_off UNUSEDSIGNAL
package std;
// The process class is not implemented, but it's predeclared here,
// so the linter accepts references to it.
typedef class process;
class mailbox #(type T);
protected int m_bound;
protected T m_queue[$];
@ -112,6 +116,3 @@ package std;
endfunction
endclass
endpackage
// verilator lint_off IMPORTSTAR
import std::*;

View File

@ -53,6 +53,14 @@ void V3Global::readFiles() {
V3ParseSym parseSyms{v3Global.rootp()}; // Symbol table must be common across all parsing
V3Parse parser(v3Global.rootp(), &filter, &parseSyms);
// Parse the std package
if (v3Global.opt.std()) {
parser.parseFile(new FileLine{V3Options::getStdPackagePath()},
V3Options::getStdPackagePath(), false,
"Cannot find verilated_std.sv containing built-in std:: definitions:");
}
// Read top module
const V3StringList& vFiles = v3Global.opt.vFiles();
for (const string& filename : vFiles) {
@ -60,13 +68,6 @@ void V3Global::readFiles() {
"Cannot find file containing module: ");
}
if (usesStdPackage()) {
// Parse the std package
parser.parseFile(new FileLine{FileLine::commandLineFilename()},
V3Options::getStdPackagePath(), false,
"Cannot find verilated_std.sv containing built-in std:: definitions:");
}
// Read libraries
// To be compatible with other simulators,
// this needs to be done after the top file is read
@ -75,6 +76,15 @@ void V3Global::readFiles() {
parser.parseFile(new FileLine{FileLine::commandLineFilename()}, filename, true,
"Cannot find file containing library module: ");
}
// Delete the std package if unused
if (!usesStdPackage()) {
if (AstNodeModule* stdp = v3Global.rootp()->stdPackagep()) {
v3Global.rootp()->stdPackagep(nullptr);
VL_DO_DANGLING(stdp->unlinkFrBack()->deleteTree(), stdp);
}
}
// v3Global.rootp()->dumpTreeFile(v3Global.debugFilename("parse.tree"));
V3Error::abortIfErrors();

View File

@ -1395,8 +1395,11 @@ class LinkDotFindVisitor final : public VNVisitor {
UINFO(4, " Link: " << nodep << endl);
VSymEnt* const srcp = m_statep->getNodeSym(nodep->packagep());
if (nodep->name() == "*") {
if (m_curSymp == m_statep->dunitEntp()) {
nodep->v3warn(IMPORTSTAR, "Import::* in $unit scope may pollute global namespace");
if (nodep->packagep() != v3Global.rootp()->stdPackagep()) {
if (m_curSymp == m_statep->dunitEntp()) {
nodep->v3warn(IMPORTSTAR,
"Import::* in $unit scope may pollute global namespace");
}
}
} else {
VSymEnt* const impp = srcp->findIdFlat(nodep->name());
@ -2971,7 +2974,7 @@ private:
"Bad package link");
AstClassOrPackageRef* const cpackagerefp
= VN_AS(m_ds.m_dotp->lhsp(), ClassOrPackageRef);
if (cpackagerefp->name() == "process" || cpackagerefp->name() == "local") {
if (cpackagerefp->name() == "local") {
nodep->v3warn(E_UNSUPPORTED,
"Unsupported: " << AstNode::prettyNameQ(cpackagerefp->name()));
}

View File

@ -602,7 +602,9 @@ void V3Options::filePathLookedMsg(FileLine* fl, const string& modname) {
V3LangCode V3Options::fileLanguage(const string& filename) {
string ext = V3Os::filenameNonDir(filename);
string::size_type pos;
if ((pos = ext.rfind('.')) != string::npos) {
if (filename == V3Options::getStdPackagePath()) {
return V3LangCode::mostRecent();
} else if ((pos = ext.rfind('.')) != string::npos) {
ext.erase(0, pos + 1);
const auto it = m_impp->m_langExts.find(ext);
if (it != m_impp->m_langExts.end()) return it->second;
@ -1145,7 +1147,10 @@ void V3Options::parseOptsList(FileLine* fl, const string& optdir, int argc, char
DECL_OPTION("-dumpi-", CbPartialMatchVal, [this](const char* optp, const char* valp) {
m_dumpLevel[optp] = std::atoi(valp);
});
DECL_OPTION("-E", Set, &m_preprocOnly);
DECL_OPTION("-E", CbOnOff, [this](bool flag) {
if (flag) m_std = false;
m_preprocOnly = flag;
});
DECL_OPTION("-error-limit", CbVal, static_cast<void (*)(int)>(&V3Error::errorLimit));
DECL_OPTION("-exe", OnOff, &m_exe);
DECL_OPTION("-expand-limit", CbVal,
@ -1405,6 +1410,7 @@ void V3Options::parseOptsList(FileLine* fl, const string& optdir, int argc, char
m_statsVars = flag;
m_stats |= flag;
});
DECL_OPTION("-std", OnOff, &m_std);
DECL_OPTION("-structs-packed", OnOff, &m_structsPacked);
DECL_OPTION("-sv", CbCall, [this]() { m_defaultLanguage = V3LangCode::L1800_2017; });

View File

@ -267,6 +267,7 @@ private:
bool m_relativeIncludes = false; // main switch: --relative-includes
bool m_reportUnoptflat = false; // main switch: --report-unoptflat
bool m_savable = false; // main switch: --savable
bool m_std = true; // main switch: --std
bool m_structsPacked = false; // main switch: --structs-packed
bool m_systemC = false; // main switch: --sc: System C instead of simple C++
bool m_stats = false; // main switch: --stats
@ -431,6 +432,7 @@ public:
bool savable() const VL_MT_SAFE { return m_savable; }
bool stats() const { return m_stats; }
bool statsVars() const { return m_statsVars; }
bool std() const { return m_std; }
bool structsPacked() const { return m_structsPacked; }
bool assertOn() const { return m_assert; } // assertOn as __FILE__ may be defined
bool autoflush() const { return m_autoflush; }

View File

@ -507,6 +507,19 @@ void V3ParseImp::tokenPipelineSym() {
// " -findtree: ", true);
foundp = V3ParseImp::parsep()->symp()->symCurrentp()->findIdFallback(*(yylval.strp));
}
if (!foundp && !m_afterColonColon) { // Check if the symbol can be found in std
AstPackage* const stdpkgp = v3Global.rootp()->stdPackagep();
if (stdpkgp) {
VSymEnt* const stdsymp = stdpkgp->user4u().toSymEnt();
foundp = stdsymp->findIdFallback(*(yylval.strp));
}
if (foundp && !v3Global.usesStdPackage()) {
AstPackageImport* const impp
= new AstPackageImport(stdpkgp->fileline(), stdpkgp, "*");
unitPackage(stdpkgp->fileline())->addStmtsp(impp);
v3Global.setUsesStdPackage();
}
}
if (foundp) {
AstNode* const scp = foundp->nodep();
yylval.scp = scp;
@ -523,20 +536,13 @@ void V3ParseImp::tokenPipelineSym() {
} else {
token = yaID__ETC;
}
} else if (!m_afterColonColon && *(yylval.strp) == "std") {
v3Global.setUsesStdPackage();
}
} else if ((token == yaID__LEX || token == yaID__CC)
&& (*(yylval.strp) == "mailbox" // IEEE-standard class
|| *(yylval.strp) == "process" // IEEE-standard class
|| *(yylval.strp) == "semaphore")) { // IEEE-standard class
v3Global.setUsesStdPackage();
yylval.scp = nullptr;
if (token == yaID__LEX) token = yaID__aTYPE;
} else { // Not found
yylval.scp = nullptr;
if (token == yaID__CC) {
if (!m_afterColonColon && *(yylval.strp) == "std") {
v3Global.setUsesStdPackage();
} else if (!v3Global.opt.bboxUnsup()) {
if (!v3Global.opt.bboxUnsup()) {
// IEEE does require this, but we may relax this as UVM breaks it, so allow
// bbox for today
// We'll get a parser error eventually but might not be obvious

View File

@ -3393,7 +3393,7 @@ private:
UASSERT_OBJ(first_classp, nodep, "Unlinked");
for (AstClass* classp = first_classp; classp;) {
if (nodep->fileline()->timingOn()) {
if (classp->name() == "semaphore"
if (classp->name() == "semaphore" || classp->name() == "process"
|| VString::startsWith(classp->name(), "mailbox")) {
// Find the package the class is in
AstNode* pkgItemp = classp;

View File

@ -17,9 +17,9 @@ compile(
);
if ($Self->{vlt_all}) {
file_grep("$out_filename", qr/\<var loc="d,74,.*?" name="clk0" .*dir="input" .*vartype="logic" origName="clk0" clocker="true" public="true"\/\>/i);
file_grep("$out_filename", qr/\<var loc="d,75,.*?" name="clk1" .*dir="input" .*vartype="logic" origName="clk1" clocker="true" public="true"\/\>/i);
file_grep("$out_filename", qr/\<var loc="d,76,.*?" name="clk2" .*dir="input" .*vartype="logic" origName="clk2" clocker="true" public="true"\/\>/i);
file_grep("$out_filename", qr/\<var loc="e,74,.*?" name="clk0" .*dir="input" .*vartype="logic" origName="clk0" clocker="true" public="true"\/\>/i);
file_grep("$out_filename", qr/\<var loc="e,75,.*?" name="clk1" .*dir="input" .*vartype="logic" origName="clk1" clocker="true" public="true"\/\>/i);
file_grep("$out_filename", qr/\<var loc="e,76,.*?" name="clk2" .*dir="input" .*vartype="logic" origName="clk2" clocker="true" public="true"\/\>/i);
}
execute(

View File

@ -18,10 +18,10 @@ compile(
);
if ($Self->{vlt_all}) {
file_grep("$out_filename", qr/\<var loc="e,78,.*?" name="clk0" .*dir="input" .*vartype="logic" origName="clk0" clocker="true" public="true"\/\>/i);
file_grep("$out_filename", qr/\<var loc="e,79,.*?" name="clk1" .*dir="input" .*vartype="logic" origName="clk1" clocker="true" public="true"\/\>/i);
file_grep("$out_filename", qr/\<var loc="e,80,.*?" name="clk2" .*dir="input" .*vartype="logic" origName="clk2" clocker="true" public="true"\/\>/i);
file_grep("$out_filename", qr/\<var loc="e,82,.*?" name="data_in" .*dir="input" .*vartype="logic" origName="data_in" clocker="false" public="true"\/\>/i);
file_grep("$out_filename", qr/\<var loc="f,78,.*?" name="clk0" .*dir="input" .*vartype="logic" origName="clk0" clocker="true" public="true"\/\>/i);
file_grep("$out_filename", qr/\<var loc="f,79,.*?" name="clk1" .*dir="input" .*vartype="logic" origName="clk1" clocker="true" public="true"\/\>/i);
file_grep("$out_filename", qr/\<var loc="f,80,.*?" name="clk2" .*dir="input" .*vartype="logic" origName="clk2" clocker="true" public="true"\/\>/i);
file_grep("$out_filename", qr/\<var loc="f,82,.*?" name="data_in" .*dir="input" .*vartype="logic" origName="data_in" clocker="false" public="true"\/\>/i);
}
execute(

View File

@ -18,10 +18,10 @@ compile(
);
if ($Self->{vlt_all}) {
file_grep("$out_filename", qr/\<var loc="d,56,.*?" name="formatted" dtype_id="\d+" dir="input" vartype="string" origName="formatted" sformat="true"\/\>/i);
file_grep("$out_filename", qr/\<var loc="d,77,.*?" name="t.sub.in" dtype_id="\d+" vartype="int" origName="in" public="true" public_flat_rd="true"\/\>/i);
file_grep("$out_filename", qr/\<var loc="d,78,.*?" name="t.sub.fr_a" dtype_id="\d+" vartype="int" origName="fr_a" public="true" public_flat_rd="true" public_flat_rw="true"\/\>/i);
file_grep("$out_filename", qr/\<var loc="d,79,.*?" name="t.sub.fr_b" dtype_id="\d+" vartype="int" origName="fr_b" public="true" public_flat_rd="true" public_flat_rw="true"\/\>/i);
file_grep("$out_filename", qr/\<var loc="e,56,.*?" name="formatted" dtype_id="\d+" dir="input" vartype="string" origName="formatted" sformat="true"\/\>/i);
file_grep("$out_filename", qr/\<var loc="e,77,.*?" name="t.sub.in" dtype_id="\d+" vartype="int" origName="in" public="true" public_flat_rd="true"\/\>/i);
file_grep("$out_filename", qr/\<var loc="e,78,.*?" name="t.sub.fr_a" dtype_id="\d+" vartype="int" origName="fr_a" public="true" public_flat_rd="true" public_flat_rw="true"\/\>/i);
file_grep("$out_filename", qr/\<var loc="e,79,.*?" name="t.sub.fr_b" dtype_id="\d+" vartype="int" origName="fr_b" public="true" public_flat_rd="true" public_flat_rw="true"\/\>/i);
}
execute(

View File

@ -20,10 +20,10 @@ compile(
);
if ($Self->{vlt_all}) {
file_grep("$out_filename", qr/\<var loc="e,58,.*?" name="formatted" dtype_id="\d+" dir="input" vartype="string" origName="formatted" sformat="true"\/\>/i);
file_grep("$out_filename", qr/\<var loc="e,81,.*?" name="t.sub.in" dtype_id="\d+" vartype="int" origName="in" public="true" public_flat_rd="true"\/\>/i);
file_grep("$out_filename", qr/\<var loc="e,82,.*?" name="t.sub.fr_a" dtype_id="\d+" vartype="int" origName="fr_a" public="true" public_flat_rd="true" public_flat_rw="true"\/\>/i);
file_grep("$out_filename", qr/\<var loc="e,83,.*?" name="t.sub.fr_b" dtype_id="\d+" vartype="int" origName="fr_b" public="true" public_flat_rd="true" public_flat_rw="true"\/\>/i);
file_grep("$out_filename", qr/\<var loc="f,58,.*?" name="formatted" dtype_id="\d+" dir="input" vartype="string" origName="formatted" sformat="true"\/\>/i);
file_grep("$out_filename", qr/\<var loc="f,81,.*?" name="t.sub.in" dtype_id="\d+" vartype="int" origName="in" public="true" public_flat_rd="true"\/\>/i);
file_grep("$out_filename", qr/\<var loc="f,82,.*?" name="t.sub.fr_a" dtype_id="\d+" vartype="int" origName="fr_a" public="true" public_flat_rd="true" public_flat_rw="true"\/\>/i);
file_grep("$out_filename", qr/\<var loc="f,83,.*?" name="t.sub.fr_b" dtype_id="\d+" vartype="int" origName="fr_b" public="true" public_flat_rd="true" public_flat_rw="true"\/\>/i);
}
execute(

View File

@ -18,10 +18,10 @@ compile(
);
if ($Self->{vlt_all}) {
file_grep("$out_filename", qr/\<module loc="d,84,.*?" name="ma" origName="ma" public="true"\>/i);
file_grep("$out_filename", qr/\<module loc="d,99,.*?" name="mb" origName="mb" public="true"\>/i);
file_grep("$out_filename", qr/\<module loc="d,127,.*?" name="mc" origName="mc" public="true"\>/i);
file_grep("$out_filename", qr/\<module loc="d,127,.*?" name="mc__PB1" origName="mc" public="true"\>/i);
file_grep("$out_filename", qr/\<module loc="e,84,.*?" name="ma" origName="ma" public="true"\>/i);
file_grep("$out_filename", qr/\<module loc="e,99,.*?" name="mb" origName="mb" public="true"\>/i);
file_grep("$out_filename", qr/\<module loc="e,127,.*?" name="mc" origName="mc" public="true"\>/i);
file_grep("$out_filename", qr/\<module loc="e,127,.*?" name="mc__PB1" origName="mc" public="true"\>/i);
}
execute(

View File

@ -18,10 +18,10 @@ compile(
);
if ($Self->{vlt_all}) {
file_grep("$out_filename", qr/\<module loc="e,84,.*?" name="ma" origName="ma" public="true"\>/i);
file_grep("$out_filename", qr/\<module loc="e,99,.*?" name="mb" origName="mb" public="true"\>/i);
file_grep("$out_filename", qr/\<module loc="e,127,.*?" name="mc" origName="mc" public="true"\>/i);
file_grep("$out_filename", qr/\<module loc="e,127,.*?" name="mc__PB1" origName="mc" public="true"\>/i);
file_grep("$out_filename", qr/\<module loc="f,84,.*?" name="ma" origName="ma" public="true"\>/i);
file_grep("$out_filename", qr/\<module loc="f,99,.*?" name="mb" origName="mb" public="true"\>/i);
file_grep("$out_filename", qr/\<module loc="f,127,.*?" name="mc" origName="mc" public="true"\>/i);
file_grep("$out_filename", qr/\<module loc="f,127,.*?" name="mc__PB1" origName="mc" public="true"\>/i);
}
execute(

View File

@ -18,8 +18,8 @@ compile(
);
if ($Self->{vlt_all}) {
file_grep("$out_filename", qr/\<instance loc="d,87,.*?" name="t.ma0.mb0" defName="mb" origName="mb0"\/\>/i);
file_grep("$out_filename", qr/\<module loc="d,99,.*?" name="mb" origName="mb"\>/i);
file_grep("$out_filename", qr/\<instance loc="e,87,.*?" name="t.ma0.mb0" defName="mb" origName="mb0"\/\>/i);
file_grep("$out_filename", qr/\<module loc="e,99,.*?" name="mb" origName="mb"\>/i);
}
execute(

View File

@ -18,8 +18,8 @@ compile(
);
if ($Self->{vlt_all}) {
file_grep("$out_filename", qr/\<instance loc="e,87,.*?" name="t.ma0.mb0" defName="mb" origName="mb0"\/\>/i);
file_grep("$out_filename", qr/\<module loc="e,99,.*?" name="mb" origName="mb"\>/i);
file_grep("$out_filename", qr/\<instance loc="f,87,.*?" name="t.ma0.mb0" defName="mb" origName="mb0"\/\>/i);
file_grep("$out_filename", qr/\<module loc="f,99,.*?" name="mb" origName="mb"\>/i);
}
execute(

View File

@ -18,12 +18,12 @@ compile(
);
if ($Self->{vlt_all}) {
file_grep("$out_filename", qr/\<module loc="e,56,.*?" name="l1" origName="l1"\>/i);
file_grep("$out_filename", qr/\<module loc="e,62,.*?" name="l2" origName="l2"\>/i);
file_grep("$out_filename", qr/\<module loc="e,69,.*?" name="l3" origName="l3"\>/i);
file_grep("$out_filename", qr/\<module loc="e,76,.*?" name="l4" origName="l4"\>/i);
file_grep("$out_filename", qr/\<module loc="e,83,.*?" name="l5__P2" origName="l5"\>/i);
file_grep("$out_filename", qr/\<module loc="e,83,.*?" name="l5__P1" origName="l5"\>/i);
file_grep("$out_filename", qr/\<module loc="f,56,.*?" name="l1" origName="l1"\>/i);
file_grep("$out_filename", qr/\<module loc="f,62,.*?" name="l2" origName="l2"\>/i);
file_grep("$out_filename", qr/\<module loc="f,69,.*?" name="l3" origName="l3"\>/i);
file_grep("$out_filename", qr/\<module loc="f,76,.*?" name="l4" origName="l4"\>/i);
file_grep("$out_filename", qr/\<module loc="f,83,.*?" name="l5__P2" origName="l5"\>/i);
file_grep("$out_filename", qr/\<module loc="f,83,.*?" name="l5__P1" origName="l5"\>/i);
}
execute(

View File

@ -18,9 +18,9 @@ compile(
);
if ($Self->{vlt_all}) {
file_grep("$out_filename", qr/\<var loc="e,70,.*?" name="t.u.u0.u0.z1" dtype_id="\d+" vartype="logic" origName="z1"\/\>/i);
file_grep("$out_filename", qr/\<var loc="e,70,.*?" name="t.u.u0.u1.z1" dtype_id="\d+" vartype="logic" origName="z1"\/\>/i);
file_grep("$out_filename", qr/\<var loc="e,70,.*?" name="t.u.u1.u0.z0" dtype_id="\d+" vartype="logic" origName="z0"\/\>/i);
file_grep("$out_filename", qr/\<var loc="f,70,.*?" name="t.u.u0.u0.z1" dtype_id="\d+" vartype="logic" origName="z1"\/\>/i);
file_grep("$out_filename", qr/\<var loc="f,70,.*?" name="t.u.u0.u1.z1" dtype_id="\d+" vartype="logic" origName="z1"\/\>/i);
file_grep("$out_filename", qr/\<var loc="f,70,.*?" name="t.u.u1.u0.z0" dtype_id="\d+" vartype="logic" origName="z0"\/\>/i);
}
execute(

View File

@ -19,9 +19,9 @@ compile(
);
if ($Self->{vlt_all}) {
file_grep("$out_filename", qr/\<var loc="e,70,.*?" name="u.u0.u0.z0" dtype_id="\d+" vartype="logic" origName="z0" public="true" public_flat_rd="true" public_flat_rw="true"\/\>/i);
file_grep("$out_filename", qr/\<var loc="e,85,.*?" name="u.u0.u0.u0.u0.z1" dtype_id="\d+" vartype="logic" origName="z1" public="true" public_flat_rd="true" public_flat_rw="true"\/\>/i);
file_grep("$out_filename", qr/\<var loc="e,83,.*?" name="u.u0.u1.u0.u0.z" dtype_id="\d+" vartype="logic" origName="z" public="true" public_flat_rd="true" public_flat_rw="true"\/\>/i);
file_grep("$out_filename", qr/\<var loc="f,70,.*?" name="u.u0.u0.z0" dtype_id="\d+" vartype="logic" origName="z0" public="true" public_flat_rd="true" public_flat_rw="true"\/\>/i);
file_grep("$out_filename", qr/\<var loc="f,85,.*?" name="u.u0.u0.u0.u0.z1" dtype_id="\d+" vartype="logic" origName="z1" public="true" public_flat_rd="true" public_flat_rw="true"\/\>/i);
file_grep("$out_filename", qr/\<var loc="f,83,.*?" name="u.u0.u1.u0.u0.z" dtype_id="\d+" vartype="logic" origName="z" public="true" public_flat_rd="true" public_flat_rw="true"\/\>/i);
}
execute(

View File

@ -0,0 +1,8 @@
%Error-PKGNODECL: t/t_no_std_bad.v:9:11: Package/class 'std' not found, and needs to be predeclared (IEEE 1800-2017 26.3)
9 | import std::*;
| ^~~
... For error description see https://verilator.org/warn/PKGNODECL?v=latest
%Error: t/t_no_std_bad.v:9:11: Importing from missing package 'std'
9 | import std::*;
| ^~~
%Error: Exiting due to

19
test_regress/t/t_no_std_bad.pl Executable file
View File

@ -0,0 +1,19 @@
#!/usr/bin/env perl
if (!$::Driver) { use FindBin; exec("$FindBin::Bin/bootstrap.pl", @ARGV, $0); die; }
# DESCRIPTION: Verilator: Verilog Test driver/expect definition
#
# Copyright 2020 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(simulator => 1);
lint(fails => 1,
verilator_flags2 => ["--no-std", "--exe --main --timing -Wall"],
expect_filename => $Self->{golden_filename},
);
ok(1);
1;

View File

@ -0,0 +1,10 @@
// DESCRIPTION: Verilator: Verilog Test module
//
// This file ONLY is placed under the Creative Commons Public Domain, for
// any use, without warranty, 2020 by Wilson Snyder.
// SPDX-License-Identifier: CC0-1.0
// verilator lint_off DECLFILENAME
module t(/*AUTOARG*/);
import std::*;
endmodule

View File

@ -12,6 +12,7 @@ scenarios(linter => 1);
lint(
fails => 1,
verilator_flags2 => ['--no-std'],
expect_filename => $Self->{golden_filename},
);

View File

@ -12,6 +12,7 @@ scenarios(linter => 1);
lint(
fails => 1,
verilator_flags2 => ['--no-std'],
expect_filename => $Self->{golden_filename},
);

View File

@ -12,6 +12,7 @@ scenarios(linter => 1);
lint(
fails => $Self->{vlt_all},
verilator_flags2 => ['--no-std'],
expect_filename => $Self->{golden_filename},
);

View File

@ -1,10 +1,24 @@
%Error: t/t_process.v:26:11: Forward typedef used as class/package does not resolve to class/package: 'process'
26 | p = process::self();
| ^~~~~~~
%Error: t/t_process.v:27:25: Forward typedef used as class/package does not resolve to class/package: 'process'
27 | if (p.status() != process::RUNNING) $stop;
| ^~~~~~~
%Error: t/t_process.v:28:25: Forward typedef used as class/package does not resolve to class/package: 'process'
28 | if (p.status() == process::WAITING) $stop;
| ^~~~~~~
%Error: t/t_process.v:29:25: Forward typedef used as class/package does not resolve to class/package: 'process'
29 | if (p.status() == process::SUSPENDED) $stop;
| ^~~~~~~
%Error: t/t_process.v:30:25: Forward typedef used as class/package does not resolve to class/package: 'process'
30 | if (p.status() == process::KILLED) $stop;
| ^~~~~~~
%Error: t/t_process.v:31:25: Forward typedef used as class/package does not resolve to class/package: 'process'
31 | if (p.status() == process::FINISHED) $stop;
| ^~~~~~~
%Error: t/t_process.v:22:4: Can't find typedef: 'process'
22 | process p;
| ^~~~~~~
%Error-UNSUPPORTED: t/t_process.v:26:20: Unsupported: 'process'
26 | p = process::self();
| ^~~~
... For error description see https://verilator.org/warn/UNSUPPORTED?v=latest
%Error: Internal Error: t/t_process.v:26:11: ../V3LinkDot.cpp:#: Bad package link
26 | p = process::self();
| ^~~~~~~

View File

@ -1,10 +1,9 @@
%Error: t/t_process_bad.v:12:11: Forward typedef used as class/package does not resolve to class/package: 'process'
12 | p = process::self();
| ^~~~~~~
%Error: t/t_process_bad.v:8:4: Can't find typedef: 'process'
8 | process p;
| ^~~~~~~
%Error-UNSUPPORTED: t/t_process_bad.v:12:20: Unsupported: 'process'
12 | p = process::self();
| ^~~~
... For error description see https://verilator.org/warn/UNSUPPORTED?v=latest
%Error: Internal Error: t/t_process_bad.v:12:11: ../V3LinkDot.cpp:#: Bad package link
12 | p = process::self();
| ^~~~~~~

View File

@ -1,10 +1,24 @@
%Error: t/t_process.v:26:11: Forward typedef used as class/package does not resolve to class/package: 'process'
26 | p = process::self();
| ^~~~~~~
%Error: t/t_process.v:27:25: Forward typedef used as class/package does not resolve to class/package: 'process'
27 | if (p.status() != process::RUNNING) $stop;
| ^~~~~~~
%Error: t/t_process.v:28:25: Forward typedef used as class/package does not resolve to class/package: 'process'
28 | if (p.status() == process::WAITING) $stop;
| ^~~~~~~
%Error: t/t_process.v:29:25: Forward typedef used as class/package does not resolve to class/package: 'process'
29 | if (p.status() == process::SUSPENDED) $stop;
| ^~~~~~~
%Error: t/t_process.v:30:25: Forward typedef used as class/package does not resolve to class/package: 'process'
30 | if (p.status() == process::KILLED) $stop;
| ^~~~~~~
%Error: t/t_process.v:31:25: Forward typedef used as class/package does not resolve to class/package: 'process'
31 | if (p.status() == process::FINISHED) $stop;
| ^~~~~~~
%Error: t/t_process.v:22:4: Can't find typedef: 'process'
22 | process p;
| ^~~~~~~
%Error-UNSUPPORTED: t/t_process.v:26:20: Unsupported: 'process'
26 | p = process::self();
| ^~~~
... For error description see https://verilator.org/warn/UNSUPPORTED?v=latest
%Error: Internal Error: t/t_process.v:26:11: ../V3LinkDot.cpp:#: Bad package link
26 | p = process::self();
| ^~~~~~~

View File

@ -10,10 +10,10 @@ if (!$::Driver) { use FindBin; exec("$FindBin::Bin/bootstrap.pl", @ARGV, $0); di
scenarios(linter => 1);
lint(
fails => 1,
expect_filename => $Self->{golden_filename},
);
#lint(
# fails => 1,
# expect_filename => $Self->{golden_filename},
# );
lint(
verilator_flags2 => ["-DTEST_DECLARE_STD"],

View File

@ -22,7 +22,7 @@ compile(
);
if ($Self->{vlt_all}) {
file_grep("$out_filename", qr/\<var loc="e,47,.*?" name="GSR" dtype_id="1" vartype="logic" origName="GSR" public="true" public_flat_rd="true" public_flat_rw="true"\/\>/i);
file_grep("$out_filename", qr/\<var loc="f,47,.*?" name="GSR" dtype_id="1" vartype="logic" origName="GSR" public="true" public_flat_rd="true" public_flat_rw="true"\/\>/i);
}
execute(

View File

@ -19,11 +19,11 @@ compile(
if ($Self->{vlt_all}) {
file_grep($Self->{stats}, qr/Optimizations, isolate_assignments blocks\s+5/i);
file_grep("$out_filename", qr/\<var loc="d,23,.*?" name="t.b" dtype_id="\d+" vartype="logic" origName="b" isolate_assignments="true"\/\>/i);
file_grep("$out_filename", qr/\<var loc="d,99,.*?" name="__Vfunc_t.file.get_31_16__0__Vfuncout" dtype_id="\d+" vartype="logic" origName="__Vfunc_t__DOT__file__DOT__get_31_16__0__Vfuncout" isolate_assignments="true"\/\>/i);
file_grep("$out_filename", qr/\<var loc="d,100,.*?" name="__Vfunc_t.file.get_31_16__0__t_crc" dtype_id="\d+" vartype="logic" origName="__Vfunc_t__DOT__file__DOT__get_31_16__0__t_crc" isolate_assignments="true"\/\>/i);
file_grep("$out_filename", qr/\<var loc="d,112,.*?" name="__Vtask_t.file.set_b_d__1__t_crc" dtype_id="\d+" vartype="logic" origName="__Vtask_t__DOT__file__DOT__set_b_d__1__t_crc" isolate_assignments="true"\/\>/i);
file_grep("$out_filename", qr/\<var loc="d,113,.*?" name="__Vtask_t.file.set_b_d__1__t_c" dtype_id="\d+" vartype="logic" origName="__Vtask_t__DOT__file__DOT__set_b_d__1__t_c" isolate_assignments="true"\/\>/i);
file_grep("$out_filename", qr/\<var loc="e,23,.*?" name="t.b" dtype_id="\d+" vartype="logic" origName="b" isolate_assignments="true"\/\>/i);
file_grep("$out_filename", qr/\<var loc="e,99,.*?" name="__Vfunc_t.file.get_31_16__0__Vfuncout" dtype_id="\d+" vartype="logic" origName="__Vfunc_t__DOT__file__DOT__get_31_16__0__Vfuncout" isolate_assignments="true"\/\>/i);
file_grep("$out_filename", qr/\<var loc="e,100,.*?" name="__Vfunc_t.file.get_31_16__0__t_crc" dtype_id="\d+" vartype="logic" origName="__Vfunc_t__DOT__file__DOT__get_31_16__0__t_crc" isolate_assignments="true"\/\>/i);
file_grep("$out_filename", qr/\<var loc="e,112,.*?" name="__Vtask_t.file.set_b_d__1__t_crc" dtype_id="\d+" vartype="logic" origName="__Vtask_t__DOT__file__DOT__set_b_d__1__t_crc" isolate_assignments="true"\/\>/i);
file_grep("$out_filename", qr/\<var loc="e,113,.*?" name="__Vtask_t.file.set_b_d__1__t_c" dtype_id="\d+" vartype="logic" origName="__Vtask_t__DOT__file__DOT__set_b_d__1__t_c" isolate_assignments="true"\/\>/i);
}
execute(

View File

@ -19,11 +19,11 @@ compile(
if ($Self->{vlt_all}) {
file_grep($Self->{stats}, qr/Optimizations, isolate_assignments blocks\s+5/i);
file_grep("$out_filename", qr/\<var loc="e,23,.*?" name="t.b" dtype_id="\d+" vartype="logic" origName="b" isolate_assignments="true"\/\>/i);
file_grep("$out_filename", qr/\<var loc="e,104,.*?" name="__Vfunc_t.file.get_31_16__0__Vfuncout" dtype_id="\d+" vartype="logic" origName="__Vfunc_t__DOT__file__DOT__get_31_16__0__Vfuncout" isolate_assignments="true"\/\>/i);
file_grep("$out_filename", qr/\<var loc="e,105,.*?" name="__Vfunc_t.file.get_31_16__0__t_crc" dtype_id="\d+" vartype="logic" origName="__Vfunc_t__DOT__file__DOT__get_31_16__0__t_crc" isolate_assignments="true"\/\>/i);
file_grep("$out_filename", qr/\<var loc="e,115,.*?" name="__Vtask_t.file.set_b_d__1__t_crc" dtype_id="\d+" vartype="logic" origName="__Vtask_t__DOT__file__DOT__set_b_d__1__t_crc" isolate_assignments="true"\/\>/i);
file_grep("$out_filename", qr/\<var loc="e,116,.*?" name="__Vtask_t.file.set_b_d__1__t_c" dtype_id="\d+" vartype="logic" origName="__Vtask_t__DOT__file__DOT__set_b_d__1__t_c" isolate_assignments="true"\/\>/i);
file_grep("$out_filename", qr/\<var loc="f,23,.*?" name="t.b" dtype_id="\d+" vartype="logic" origName="b" isolate_assignments="true"\/\>/i);
file_grep("$out_filename", qr/\<var loc="f,104,.*?" name="__Vfunc_t.file.get_31_16__0__Vfuncout" dtype_id="\d+" vartype="logic" origName="__Vfunc_t__DOT__file__DOT__get_31_16__0__Vfuncout" isolate_assignments="true"\/\>/i);
file_grep("$out_filename", qr/\<var loc="f,105,.*?" name="__Vfunc_t.file.get_31_16__0__t_crc" dtype_id="\d+" vartype="logic" origName="__Vfunc_t__DOT__file__DOT__get_31_16__0__t_crc" isolate_assignments="true"\/\>/i);
file_grep("$out_filename", qr/\<var loc="f,115,.*?" name="__Vtask_t.file.set_b_d__1__t_crc" dtype_id="\d+" vartype="logic" origName="__Vtask_t__DOT__file__DOT__set_b_d__1__t_crc" isolate_assignments="true"\/\>/i);
file_grep("$out_filename", qr/\<var loc="f,116,.*?" name="__Vtask_t.file.set_b_d__1__t_c" dtype_id="\d+" vartype="logic" origName="__Vtask_t__DOT__file__DOT__set_b_d__1__t_c" isolate_assignments="true"\/\>/i);
}
execute(

View File

@ -13,7 +13,7 @@ scenarios(vlt => 1);
my $out_filename = "$Self->{obj_dir}/V$Self->{name}.xml";
compile(
verilator_flags2 => ['--xml-only'],
verilator_flags2 => ['--no-std', '--xml-only'],
verilator_make_gmake => 0,
make_top_shell => 0,
make_main => 0,

View File

@ -15,7 +15,7 @@ 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_flags2 => ['--no-std', '--debug-check', '--flatten'],
verilator_make_gmake => 0,
make_top_shell => 0,
make_main => 0,

View File

@ -13,7 +13,7 @@ scenarios(vlt => 1);
my $out_filename = "$Self->{obj_dir}/V$Self->{name}.xml";
compile(
verilator_flags2 => ['--xml-only'],
verilator_flags2 => ['--no-std', '--xml-only'],
verilator_make_gmake => 0,
make_top_shell => 0,
make_main => 0,

View File

@ -15,7 +15,7 @@ my $out_filename = "$Self->{obj_dir}/V$Self->{name}.xml";
top_filename("t/t_xml_first.v");
compile(
verilator_flags2 => ['--xml-only', '--flatten'],
verilator_flags2 => ['--no-std', '--xml-only', '--flatten'],
verilator_make_gmake => 0,
make_top_shell => 0,
make_main => 0,

View File

@ -13,7 +13,7 @@ scenarios(vlt => 1);
my $out_filename = "$Self->{obj_dir}/V$Self->{name}.xml";
compile(
verilator_flags2 => ['--xml-only', '--flatten'],
verilator_flags2 => ['--no-std', '--xml-only', '--flatten'],
verilator_make_gmake => 0,
make_top_shell => 0,
make_main => 0,

View File

@ -13,7 +13,7 @@ scenarios(vlt => 1);
my $out_filename = "$Self->{obj_dir}/V$Self->{name}.xml";
compile(
verilator_flags2 => ['--xml-only', '--flatten'],
verilator_flags2 => ['--no-std', '--xml-only', '--flatten'],
verilator_make_gmake => 0,
make_top_shell => 0,
make_main => 0,

View File

@ -13,7 +13,7 @@ scenarios(vlt => 1);
my $out_filename = "$Self->{obj_dir}/V$Self->{name}.xml";
compile(
verilator_flags2 => ['--xml-only', '--flatten'],
verilator_flags2 => ['--no-std', '--xml-only', '--flatten'],
verilator_make_gmake => 0,
make_top_shell => 0,
make_main => 0,

View File

@ -13,7 +13,7 @@ scenarios(vlt => 1);
my $out_filename = "$Self->{obj_dir}/renamed-$Self->{name}.xml";
compile(
verilator_flags2 => ["--xml-only --xml-output $out_filename"],
verilator_flags2 => ["--no-std", "--xml-only --xml-output $out_filename"],
verilator_make_gmake => 0,
make_top_shell => 0,
make_main => 0,

View File

@ -13,7 +13,7 @@ scenarios(vlt => 1);
my $out_filename = "$Self->{obj_dir}/V$Self->{name}.xml";
compile(
verilator_flags2 => ['--xml-only'],
verilator_flags2 => ['--no-std', '--xml-only'],
verilator_make_gmake => 0,
make_top_shell => 0,
make_main => 0,