diff --git a/Changes b/Changes index d0f057a5e..ed4497f7f 100644 --- a/Changes +++ b/Changes @@ -21,6 +21,7 @@ Verilator 4.227 devel * Support IEEE constant signal strengths (#3601). [Ryszard Rozak/Antmicro] * Add --main to generate main() C++ (previously was experimental only). +* Rename --bin to --build-dep-bin. * Fix thread saftey in SystemC VL_ASSIGN_SBW/WSB (#3494) (#3513). [Mladen Slijepcevic] * Fix crash in gate optimization of circular logic (#3543). [Bill Flynn] * Fix arguments in non-static method call (#3547) (#3582). [Gustav Svensk] diff --git a/bin/verilator b/bin/verilator index b6495eee5..45de10206 100755 --- a/bin/verilator +++ b/bin/verilator @@ -282,8 +282,8 @@ detailed descriptions of these arguments. --autoflush Flush streams after all $displays --bbox-sys Blackbox unknown $system calls --bbox-unsup Blackbox unsupported language features - --bin Override Verilator binary --build Build model executable/library after Verilation + --build-dep-bin Override build dependency Verilator binary --build-jobs Parallelism for --build --cc Create C++ output --cdc Clock domain crossing analysis diff --git a/docs/guide/exe_verilator.rst b/docs/guide/exe_verilator.rst index cf7690a14..daf2fc5f3 100644 --- a/docs/guide/exe_verilator.rst +++ b/docs/guide/exe_verilator.rst @@ -115,13 +115,6 @@ Summary: Using this argument will likely cause incorrect simulation. -.. option:: --bin - - Rarely needed. Override the default filename for Verilator itself. - When a dependency (.d) file is created, this filename will become a - source dependency, such that a change in this binary will have make - rebuild the output files. - .. option:: --build After generating the SystemC/C++ code, Verilator will invoke the @@ -129,6 +122,15 @@ Summary: is also used). Verilator manages the build itself, and for this --build requires GNU Make to be available on the platform. +.. option:: --build-dep-bin + + Rarely needed. When a dependency (.d) file is created, this filename + will become a source dependency, such that a change in this binary will + have make rebuild the output files. Defaults to the full path to the + Verilator binary. + + This option was named `--bin` prior to version 4.228. + .. option:: --build-jobs [] Specify the level of parallelism for :vlopt:`--build`. If zero, uses the diff --git a/src/V3EmitMk.cpp b/src/V3EmitMk.cpp index e4db53ede..726cd96cd 100644 --- a/src/V3EmitMk.cpp +++ b/src/V3EmitMk.cpp @@ -292,7 +292,7 @@ class EmitMkHierVerilation final { of.puts("# Verilation of hierarchical blocks are executed in this directory\n"); of.puts("VM_HIER_RUN_DIR := " + cwd + "\n"); of.puts("# Common options for hierarchical blocks\n"); - const string fullpath_bin = V3Os::filenameRealPath(v3Global.opt.bin()); + const string fullpath_bin = V3Os::filenameRealPath(v3Global.opt.buildDepBin()); const string verilator_wrapper = V3Os::filenameDir(fullpath_bin) + "/verilator"; of.puts("VM_HIER_VERILATOR := " + verilator_wrapper + "\n"); of.puts("VM_HIER_INPUT_FILES := \\\n"); diff --git a/src/V3File.cpp b/src/V3File.cpp index b8c8e6ad6..96386cbc4 100644 --- a/src/V3File.cpp +++ b/src/V3File.cpp @@ -154,7 +154,7 @@ void V3FileDependImp::writeDepend(const string& filename) { if (i.target()) *ofp << i.filename() << " "; } *ofp << " : "; - *ofp << v3Global.opt.bin(); + *ofp << v3Global.opt.buildDepBin(); *ofp << " "; for (const DependFile& i : m_filenameList) { diff --git a/src/V3Options.cpp b/src/V3Options.cpp index 644ea6961..64ca9e861 100644 --- a/src/V3Options.cpp +++ b/src/V3Options.cpp @@ -1005,8 +1005,8 @@ void V3Options::parseOptsList(FileLine* fl, const string& optdir, int argc, char m_bboxUnsup = flag; FileLine::globalWarnOff(V3ErrorCode::E_UNSUPPORTED, true); }); - DECL_OPTION("-bin", Set, &m_bin); DECL_OPTION("-build", Set, &m_build); + DECL_OPTION("-build-dep-bin", Set, &m_buildDepBin); DECL_OPTION("-build-jobs", CbVal, [this, fl](const char* valp) { int val = std::atoi(valp); if (val < 0) { diff --git a/src/V3Options.h b/src/V3Options.h index 6c0eea7fe..4149eb75e 100644 --- a/src/V3Options.h +++ b/src/V3Options.h @@ -320,7 +320,7 @@ private: int m_compLimitMembers = 64; // compiler selection; number of members in struct before make anon array int m_compLimitParens = 240; // compiler selection; number of nested parens - string m_bin; // main switch: --bin {binary} + string m_buildDepBin; // main switch: --build-dep-bin {filename} string m_exeName; // main switch: -o {name} string m_flags; // main switch: -f {name} string m_l2Name; // main switch: --l2name; "" for top-module's name @@ -419,7 +419,6 @@ public: bool makePhony() const { return m_makePhony; } bool preprocNoLine() const { return m_preprocNoLine; } bool underlineZero() const { return m_underlineZero; } - string bin() const { return m_bin; } string flags() const { return m_flags; } bool systemC() const { return m_systemC; } bool savable() const { return m_savable; } @@ -431,6 +430,8 @@ public: bool bboxSys() const { return m_bboxSys; } bool bboxUnsup() const { return m_bboxUnsup; } bool build() const { return m_build; } + string buildDepBin() const { return m_buildDepBin; } + void buildDepBin(const string& flag) { m_buildDepBin = flag; } bool cdc() const { return m_cdc; } bool cmake() const { return m_cmake; } bool context() const { return m_context; } @@ -631,7 +632,6 @@ public: // Return options for child hierarchical blocks when forTop==false, otherwise returns args for // the top module. string allArgsStringForHierBlock(bool forTop) const; - void bin(const string& flag) { m_bin = flag; } void parseOpts(FileLine* fl, int argc, char** argv); void parseOptsList(FileLine* fl, const string& optdir, int argc, char** argv); void parseOptsFile(FileLine* fl, const string& filename, bool rel); diff --git a/src/Verilator.cpp b/src/Verilator.cpp index ffd438ca9..9eb120d86 100644 --- a/src/Verilator.cpp +++ b/src/Verilator.cpp @@ -563,7 +563,7 @@ static void verilate(const string& argString) { UINFO(1, "Option --verilate: Start Verilation\n"); // Can we skip doing everything if times are ok? - V3File::addSrcDepend(v3Global.opt.bin()); + V3File::addSrcDepend(v3Global.opt.buildDepBin()); if (v3Global.opt.skipIdentical().isTrue() && V3File::checkTimes(v3Global.opt.hierTopDataDir() + "/" + v3Global.opt.prefix() + "__verFiles.dat", @@ -714,7 +714,7 @@ int main(int argc, char** argv, char** /*env*/) { V3PreShell::boot(); // Command option parsing - v3Global.opt.bin(argv[0]); + v3Global.opt.buildDepBin(argv[0]); const string argString = V3Options::argString(argc - 1, argv + 1); v3Global.opt.parseOpts(new FileLine{FileLine::commandLineFilename()}, argc - 1, argv + 1); diff --git a/test_regress/t/t_flag_build-jobs_bad.out b/test_regress/t/t_flag_build-jobs_bad.out deleted file mode 100644 index 341b1b979..000000000 --- a/test_regress/t/t_flag_build-jobs_bad.out +++ /dev/null @@ -1 +0,0 @@ -%Error: --build-jobs requires a non-negative integer, but '-1' was passed diff --git a/test_regress/t/t_flag_build-jobs_bad.pl b/test_regress/t/t_flag_build_dep_bin.pl similarity index 75% rename from test_regress/t/t_flag_build-jobs_bad.pl rename to test_regress/t/t_flag_build_dep_bin.pl index 8432e74c6..13eaa6fe3 100755 --- a/test_regress/t/t_flag_build-jobs_bad.pl +++ b/test_regress/t/t_flag_build_dep_bin.pl @@ -10,13 +10,11 @@ if (!$::Driver) { use FindBin; exec("$FindBin::Bin/bootstrap.pl", @ARGV, $0); di scenarios(vlt => 1); -top_filename("t/t_flag_werror.v"); - -lint( - fails => 1, - verilator_flags => [qw(--build-jobs -1 --build)], - expect_filename => $Self->{golden_filename}, +compile( + v_flags2 => ['--build-dep-bin', 'path_to_exe'], ); +file_grep("$Self->{obj_dir}/$Self->{VM_PREFIX}__ver.d", qr/path_to_exe/); + ok(1); 1; diff --git a/test_regress/t/t_flag_build_dep_bin.v b/test_regress/t/t_flag_build_dep_bin.v new file mode 100644 index 000000000..a56f76564 --- /dev/null +++ b/test_regress/t/t_flag_build_dep_bin.v @@ -0,0 +1,8 @@ +// DESCRIPTION: Verilator: Verilog Test module +// +// This file ONLY is placed under the Creative Commons Public Domain, for +// any use, without warranty, 2005 by Wilson Snyder. +// SPDX-License-Identifier: CC0-1.0 + +module t (/*AUTOARG*/); +endmodule