Add `--no-std-package` as subset-alias of `--no-std`.

This commit is contained in:
Wilson Snyder 2024-11-11 08:30:07 -05:00
parent 151c5b6a1d
commit 7c8ff1d19c
7 changed files with 36 additions and 7 deletions

View File

@ -16,6 +16,7 @@ Verilator 5.031 devel
* Support queue's assignment `push_back/push_front('{})` (#5585) (#5586). [Yilou Wang]
* Support basic constrained random for multi-dimensional dynamic array and queue (#5591). [Yilou Wang]
* Support `pure constraint`.
* Add `--no-std-package` as subset-alias of `--no-std`.
* Add error on illegal enum base type (#3010). [Iztok Jeras]
* Add error on `wait` with missing `.triggered` (#4457).
* Add error when improperly storing to parameter (#5147). [Gökçe Aydos]

View File

@ -448,7 +448,8 @@ 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
--no-std Prevent loading standard files
--no-std-package Prevent parsing standard package
--no-stop-fail Do not call $stop when assertion fails
--structs-packed Convert all unpacked structures to packed structures
-sv Enable SystemVerilog parsing

View File

@ -1363,7 +1363,13 @@ Summary:
.. option:: --no-std
Prevents parsing standard library.
Prevents parsing standard input files, alias for
:opt:`--no-std-package`. This may be extended to prevent reading other
standardized files in future versions.
.. option:: --no-std-package
Prevents parsing standard `std::` package file.
.. option:: --no-stop-fail

View File

@ -66,7 +66,7 @@ void V3Global::readFiles() {
}
// Parse the std package
if (v3Global.opt.std()) {
if (v3Global.opt.stdPackage()) {
parser.parseFile(new FileLine{V3Options::getStdPackagePath()},
V3Options::getStdPackagePath(), false,
"Cannot find verilated_std.sv containing built-in std:: definitions: ");

View File

@ -1258,7 +1258,7 @@ void V3Options::parseOptsList(FileLine* fl, const string& optdir, int argc,
DECL_OPTION("-json-edit-nums", OnOff, &m_jsonEditNums);
DECL_OPTION("-json-ids", OnOff, &m_jsonIds);
DECL_OPTION("-E", CbOnOff, [this](bool flag) {
if (flag) m_std = false;
if (flag) m_stdPackage = false;
m_preprocOnly = flag;
});
DECL_OPTION("-emit-accessors", OnOff, &m_emitAccessors);
@ -1512,7 +1512,8 @@ void V3Options::parseOptsList(FileLine* fl, const string& optdir, int argc,
m_statsVars = flag;
m_stats |= flag;
});
DECL_OPTION("-std", OnOff, &m_std);
DECL_OPTION("-std", CbOnOff, [this](bool flag) { m_stdPackage = flag; });
DECL_OPTION("-std-package", OnOff, &m_stdPackage);
DECL_OPTION("-stop-fail", OnOff, &m_stopFail);
DECL_OPTION("-structs-packed", OnOff, &m_structsPacked);
DECL_OPTION("-sv", CbCall, [this]() { m_defaultLanguage = V3LangCode::L1800_2023; });

View File

@ -279,7 +279,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_stdPackage = true; // main switch: --std-package
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
@ -465,7 +465,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 stdPackage() const { return m_stdPackage; }
bool structsPacked() const { return m_structsPacked; }
bool assertOn() const { return m_assert; } // assertOn as __FILE__ may be defined
bool assertCaseOn() const { return m_assertCase || m_assert; }

View File

@ -0,0 +1,20 @@
#!/usr/bin/env python3
# DESCRIPTION: Verilator: Verilog Test driver/expect definition
#
# Copyright 2024 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
import vltest_bootstrap
test.scenarios('simulator')
test.top_filename = "t/t_no_std_bad.v"
test.golden_filename = "t/t_no_std_bad.out"
test.lint(fails=True,
verilator_flags2=["--no-std-package", "--exe --main --timing -Wall"],
expect_filename=test.golden_filename)
test.passes()