Add `--public-ignore` to ignore public metacomments (#7819)
This commit is contained in:
parent
28a59a2b21
commit
f8dd65c7cd
3
Changes
3
Changes
|
@ -13,7 +13,8 @@ Verilator 5.033 devel
|
|||
|
||||
**Minor:**
|
||||
|
||||
* Add COVERIGN warning, as a more specific UNSUPPORTED error.
|
||||
* Add `COVERIGN` warning, as a more specific UNSUPPORTED error.
|
||||
* Add `--public-ignore` to ignore public metacomments (#7819). [Andrew Nolte]
|
||||
* Support generated classes (#5665). [Shou-Li Hsu]
|
||||
* Support `+incdir` with multiple directories.
|
||||
* Support side effects of form 'variable[index_function()]++'.
|
||||
|
|
|
@ -431,8 +431,9 @@ detailed descriptions of these arguments.
|
|||
--protect-lib <name> Create a DPI protected library
|
||||
--public Mark signals as public; see docs
|
||||
--public-depth <level> Mark public to specified module depth
|
||||
--public-params Mark all parameters as public_flat
|
||||
--public-flat-rw Mark all variables, etc as public_flat_rw
|
||||
--public-ignore Ignore all public comment markings
|
||||
--public-params Mark all parameters as public_flat
|
||||
-pvalue+<name>=<value> Overwrite toplevel parameter
|
||||
--quiet Minimize additional printing
|
||||
--quiet-exit Don't print the command on failure
|
||||
|
|
|
@ -1211,6 +1211,13 @@ Summary:
|
|||
module specifically enabled it with
|
||||
:option:`/*verilator&32;inline_module*/`.
|
||||
|
||||
|
||||
.. option:: --public-depth <level>
|
||||
|
||||
Enables public as with :vlopt:`--public-flat-rw`, but only to the specified depth of modules.
|
||||
It operates at the module maximum level, so if a module's cells are A.B.X and A.X, the
|
||||
a --public-depth 3 must be used to make module X public, and both A.B.X and A.X will be public.
|
||||
|
||||
.. option:: --public-flat-rw
|
||||
|
||||
Declares all variables, ports, and wires public as if they had
|
||||
|
@ -1222,11 +1229,12 @@ Summary:
|
|||
marking only those signals that need public_flat_rw is typically
|
||||
significantly better performing.
|
||||
|
||||
.. option:: --public-depth <level>
|
||||
.. option:: --public-ignore
|
||||
|
||||
Enables public as with :vlopt:`--public-flat-rw`, but only to the specified depth of modules.
|
||||
It operates at the module maximum level, so if a module's cells are A.B.X and A.X, the
|
||||
a --public-depth 3 must be used to make module X public, and both A.B.X and A.X will be public.
|
||||
Ignore all :code:`/*verilator public* */` metacomments. This is useful
|
||||
for speed-optimizing VPI builds where VPI is not being used. This only
|
||||
affects metacomments; options such as :vlopt:`--public`,
|
||||
:vlopt:`--public-depth`, etc. work normally.
|
||||
|
||||
.. option:: --public-params
|
||||
|
||||
|
@ -1234,6 +1242,7 @@ Summary:
|
|||
:code:`/*verilator public_flat_rd*/`
|
||||
metacomments.
|
||||
|
||||
|
||||
.. option:: -pvalue+<name>=<value>
|
||||
|
||||
Overwrites the given parameter(s) of the top-level module. See
|
||||
|
|
|
@ -1510,8 +1510,9 @@ void V3Options::parseOptsList(FileLine* fl, const string& optdir, int argc,
|
|||
m_publicFlatRW = flag;
|
||||
v3Global.dpi(true);
|
||||
});
|
||||
DECL_OPTION("-public-ignore", CbOnOff, [this](bool flag) { m_publicIgnore = flag; });
|
||||
DECL_OPTION("-public-params", CbOnOff, [this](bool flag) {
|
||||
m_public_params = flag;
|
||||
m_publicParams = flag;
|
||||
v3Global.dpi(true);
|
||||
});
|
||||
DECL_OPTION("-quiet", CbOnOff, [this](bool flag) {
|
||||
|
|
|
@ -273,7 +273,8 @@ private:
|
|||
bool m_protectIds = false; // main switch: --protect-ids
|
||||
bool m_public = false; // main switch: --public
|
||||
bool m_publicFlatRW = false; // main switch: --public-flat-rw
|
||||
bool m_public_params = false; // main switch: --public-params
|
||||
bool m_publicIgnore = false; // main switch: --public-ignore
|
||||
bool m_publicParams = false; // main switch: --public-params
|
||||
bool m_quietExit = false; // main switch: --quiet-exit
|
||||
bool m_quietStats = false; // main switch: --quiet-stats
|
||||
bool m_relativeIncludes = false; // main switch: --relative-includes
|
||||
|
@ -541,10 +542,11 @@ public:
|
|||
bool usesProfiler() const { return profExec() || profPgo(); }
|
||||
bool protectIds() const VL_MT_SAFE { return m_protectIds; }
|
||||
bool allPublic() const { return m_public; }
|
||||
bool publicParams() const { return m_public_params; }
|
||||
bool publicParams() const { return m_publicParams; }
|
||||
bool publicOff() const { return m_publicIgnore; }
|
||||
bool publicFlatRW() const { return m_publicFlatRW; }
|
||||
int publicDepth() const { return m_publicDepth; }
|
||||
bool anyPublicFlat() const { return m_public_params || m_publicFlatRW || m_publicDepth; }
|
||||
bool anyPublicFlat() const { return m_publicParams || m_publicFlatRW || m_publicDepth; }
|
||||
bool lintOnly() const VL_MT_SAFE { return m_lintOnly; }
|
||||
bool ignc() const { return m_ignc; }
|
||||
bool quietExit() const VL_MT_SAFE { return m_quietExit; }
|
||||
|
|
|
@ -486,7 +486,7 @@ void V3PreProcImp::comment(const string& text) {
|
|||
//}
|
||||
// else ignore the comment we don't recognize
|
||||
} // else no assertions
|
||||
} else if (vlcomment) {
|
||||
} else if (vlcomment && !(v3Global.opt.publicOff() && VString::startsWith(cmd, "public"))) {
|
||||
if (VString::startsWith(cmd, "public_flat_rw")) {
|
||||
// "/*verilator public_flat_rw @(foo) */" -> "/*verilator public_flat_rw*/ @(foo)"
|
||||
string::size_type endOfCmd = std::strlen("public_flat_rw");
|
||||
|
|
|
@ -26,6 +26,8 @@
|
|||
#include "Vt_vpi_public_depth__Dpi.h"
|
||||
#elif defined(T_VPI_PUBLIC_DEPTH_OFF)
|
||||
#include "Vt_vpi_public_depth_off__Dpi.h"
|
||||
#elif defined(T_VPI_PUBLIC_OFF)
|
||||
#include "Vt_vpi_public_off__Dpi.h"
|
||||
#else
|
||||
#error "Bad test"
|
||||
#endif
|
||||
|
@ -87,6 +89,15 @@ int mon_check() {
|
|||
it.freed(); // IEEE 37.2.2 vpi_scan at end does a vpi_release_handle
|
||||
CHECK_RESULT_Z(topmod_done_should_be_0);
|
||||
|
||||
TestVpiHandle mod_a = vpi_handle_by_name(const_cast<PLI_BYTE8*>("\\mod.a "), topmod);
|
||||
#if defined(T_VPI_PUBLIC_OFF)
|
||||
// metacomment from module A should be ignored
|
||||
CHECK_RESULT_Z(mod_a);
|
||||
return 0;
|
||||
#endif
|
||||
|
||||
CHECK_RESULT_NZ(mod_a);
|
||||
|
||||
TestVpiHandle it2 = vpi_iterate(vpiModule, topmod);
|
||||
CHECK_RESULT_NZ(it2);
|
||||
|
||||
|
|
|
@ -65,7 +65,8 @@ module A(/*AUTOARG*/
|
|||
clk, a, b
|
||||
);
|
||||
|
||||
input clk;
|
||||
// this comment should get ignored for public-ignore
|
||||
input clk /* verilator public_flat_rw */;
|
||||
|
||||
input a, b;
|
||||
output x;
|
||||
|
|
|
@ -0,0 +1,29 @@
|
|||
#!/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.pli_filename = "t/t_vpi_public_depth.cpp"
|
||||
test.top_filename = "t/t_vpi_public_depth.v"
|
||||
|
||||
test.compile(make_top_shell=False,
|
||||
make_main=False,
|
||||
make_pli=True,
|
||||
iv_flags2=["-g2005-sv"],
|
||||
verilator_flags2=[
|
||||
"+define+USE_DOLLAR_C32 --exe --vpi --no-l2name",
|
||||
test.pli_filename,
|
||||
"--public-depth 1 --public-ignore",
|
||||
],
|
||||
make_flags=['CPPFLAGS_ADD=-DTEST_VPI_PUBLIC_OFF'])
|
||||
|
||||
test.execute(use_libvpi=True)
|
||||
|
||||
test.passes()
|
Loading…
Reference in New Issue