Change .vlt config files to be read before .v files (#5185).

This commit is contained in:
Wilson Snyder 2024-09-09 20:18:54 -04:00
parent 4e4fdd3b66
commit e566b5a4f5
6 changed files with 20 additions and 6 deletions

View File

@ -17,6 +17,7 @@ Verilator 5.029 devel
**Minor:**
* Change .vlt config files to be read before .v files (#5185). [David Moberg]
* Support IEEE-compliant intra-assign delays (#3711) (#5441). [Krzysztof Bieganski, Antmicro Ltd.]
* Support unconstrained randomization for unions (#5395) (#5396). [Yilou Wang]
* Support appending to queue via `[]` (#5421). [Krzysztof Bieganski, Antmicro Ltd.]

View File

@ -1909,8 +1909,12 @@ Configuration Files
In addition to the command line, warnings and other features for the
:command:`verilator` command may be controlled with configuration files,
typically named with the .vlt extension (what makes it a configuration file
is the :option:`\`verilator_config` directive). An example:
typically named with the `.vlt` extension (what makes it a configuration
file is the :option:`\`verilator_config` directive). These files, when
named `.vlt`, are read before source code files; if this behavior is
undesired, name the config file with a `.v` suffix.
An example:
.. code-block:: sv

View File

@ -58,6 +58,13 @@ void V3Global::readFiles() {
V3Parse parser{v3Global.rootp(), &filter, &parseSyms};
// Read .vlt files
const V3StringSet& vltFiles = v3Global.opt.vltFiles();
for (const string& filename : vltFiles) {
parser.parseFile(new FileLine{FileLine::commandLineFilename()}, filename, false,
"Cannot find file containing .vlt file: ");
}
// Parse the std package
if (v3Global.opt.std()) {
parser.parseFile(new FileLine{V3Options::getStdPackagePath()},

View File

@ -395,6 +395,7 @@ void V3Options::addVFile(const string& filename) {
// in a specific order and multiple of them.
m_vFiles.push_back(filename);
}
void V3Options::addVltFile(const string& filename) { m_vltFiles.insert(filename); }
void V3Options::addForceInc(const string& filename) { m_forceIncs.push_back(filename); }
void V3Options::addLineArg(const string& arg) { m_impp->m_lineArgs.push_back(arg); }
@ -1772,6 +1773,8 @@ void V3Options::parseOptsList(FileLine* fl, const string& optdir, int argc,
|| suffixed(filename, ".o") //
|| suffixed(filename, ".so")) {
V3Options::addLdLibs(filename);
} else if (suffixed(filename, ".vlt")) {
V3Options::addVltFile(filename);
} else {
V3Options::addVFile(filename);
}

View File

@ -210,6 +210,7 @@ private:
V3StringSet m_clockers; // argument: Verilog -clk signals
V3StringSet m_noClockers; // argument: Verilog -noclk signals
V3StringList m_vFiles; // argument: Verilog files to read
V3StringSet m_vltFiles; // argument: Verilator config files to read
V3StringList m_forceIncs; // argument: -FI
DebugLevelMap m_debugLevel; // argument: --debugi-<srcfile/tag> <level>
DebugLevelMap m_dumpLevel; // argument: --dumpi-<srcfile/tag> <level>
@ -444,6 +445,7 @@ public:
void addClocker(const string& signame);
void addNoClocker(const string& signame);
void addVFile(const string& filename);
void addVltFile(const string& filename);
void addForceInc(const string& filename);
bool available() const VL_MT_SAFE { return m_available; }
void ccSet();
@ -638,6 +640,7 @@ public:
const V3StringList& makeFlags() const { return m_makeFlags; }
const V3StringSet& libraryFiles() const { return m_libraryFiles; }
const V3StringList& vFiles() const { return m_vFiles; }
const V3StringSet& vltFiles() const { return m_vltFiles; }
const V3StringList& forceIncs() const { return m_forceIncs; }
bool hasParameter(const string& name);

View File

@ -1,7 +1,3 @@
%Error-PKGNODECL: t/t_vlt_match_error.v:17:12: Package/class 'hi' not found, and needs to be predeclared (IEEE 1800-2023 26.3)
17 | import hi::*;
| ^~
... For error description see https://verilator.org/warn/PKGNODECL?v=latest
%Error: t/t_vlt_match_error.v:17:12: Importing from missing package 'hi'
17 | import hi::*;
| ^~