mirror of
https://github.com/verilator/verilator.git
synced 2025-01-19 12:54:02 +00:00
Add --main to generate main() C++ (previously was experimental only) (#3265).
This commit is contained in:
parent
9efd64ab98
commit
75fd71d7e5
1
Changes
1
Changes
@ -20,6 +20,7 @@ Verilator 4.227 devel
|
|||||||
**Minor:**
|
**Minor:**
|
||||||
|
|
||||||
* Support IEEE constant signal strengths (#3601). [Ryszard Rozak/Antmicro]
|
* Support IEEE constant signal strengths (#3601). [Ryszard Rozak/Antmicro]
|
||||||
|
* Add --main to generate main() C++ (previously was experimental only).
|
||||||
* Fix thread saftey in SystemC VL_ASSIGN_SBW/WSB (#3494) (#3513). [Mladen Slijepcevic]
|
* 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 crash in gate optimization of circular logic (#3543). [Bill Flynn]
|
||||||
* Fix arguments in non-static method call (#3547) (#3582). [Gustav Svensk]
|
* Fix arguments in non-static method call (#3547) (#3582). [Gustav Svensk]
|
||||||
|
@ -343,6 +343,7 @@ detailed descriptions of these arguments.
|
|||||||
--lint-only Lint, but do not make output
|
--lint-only Lint, but do not make output
|
||||||
--make <build-tool> Generate scripts for specified build tool
|
--make <build-tool> Generate scripts for specified build tool
|
||||||
-MAKEFLAGS <flags> Arguments to pass to make during --build
|
-MAKEFLAGS <flags> Arguments to pass to make during --build
|
||||||
|
--main Generate C++ main()
|
||||||
--max-num-width <value> Maximum number width (default: 64K)
|
--max-num-width <value> Maximum number width (default: 64K)
|
||||||
--Mdir <directory> Name of output object directory
|
--Mdir <directory> Name of output object directory
|
||||||
--MMD Create .d dependency files
|
--MMD Create .d dependency files
|
||||||
|
@ -709,6 +709,15 @@ Summary:
|
|||||||
(e.g. ``-MAKEFLAGS -l -MAKEFLAGS -k``). Use of this option should not be
|
(e.g. ``-MAKEFLAGS -l -MAKEFLAGS -k``). Use of this option should not be
|
||||||
required for simple builds using the host toolchain.
|
required for simple builds using the host toolchain.
|
||||||
|
|
||||||
|
.. option:: --main
|
||||||
|
|
||||||
|
Generates a top-level C++ main() file that supports parsing arguments,
|
||||||
|
but does not drive any inputs. This is sufficient to use for top-level
|
||||||
|
SystemVerilog designs that has no inputs, and does not need the C++ to
|
||||||
|
do any time advancement.
|
||||||
|
|
||||||
|
Implies :vlopt:`--cc` if no other output mode was provided.
|
||||||
|
|
||||||
.. option:: --max-num-width <value>
|
.. option:: --max-num-width <value>
|
||||||
|
|
||||||
Set the maximum number literal width (e.g. in 1024'd22 this it the
|
Set the maximum number literal width (e.g. in 1024'd22 this it the
|
||||||
|
@ -435,6 +435,11 @@ string V3Options::allArgsStringForHierBlock(bool forTop) const {
|
|||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void V3Options::ccSet() { // --cc
|
||||||
|
m_outFormatOk = true;
|
||||||
|
m_systemC = false;
|
||||||
|
}
|
||||||
|
|
||||||
//######################################################################
|
//######################################################################
|
||||||
// File searching
|
// File searching
|
||||||
|
|
||||||
@ -719,9 +724,10 @@ bool V3Options::systemCFound() {
|
|||||||
// V3 Options notification methods
|
// V3 Options notification methods
|
||||||
|
|
||||||
void V3Options::notify() {
|
void V3Options::notify() {
|
||||||
FileLine* const cmdfl = new FileLine(FileLine::commandLineFilename());
|
|
||||||
|
|
||||||
// Notify that all arguments have been passed and final modification can be made.
|
// Notify that all arguments have been passed and final modification can be made.
|
||||||
|
FileLine* const cmdfl = new FileLine{FileLine::commandLineFilename()};
|
||||||
|
|
||||||
|
if (!outFormatOk() && v3Global.opt.main()) ccSet(); // --main implies --cc if not provided
|
||||||
if (!outFormatOk() && !cdc() && !dpiHdrOnly() && !lintOnly() && !preprocOnly() && !xmlOnly()) {
|
if (!outFormatOk() && !cdc() && !dpiHdrOnly() && !lintOnly() && !preprocOnly() && !xmlOnly()) {
|
||||||
v3fatal("verilator: Need --cc, --sc, --cdc, --dpi-hdr-only, --lint-only, "
|
v3fatal("verilator: Need --cc, --sc, --cdc, --dpi-hdr-only, --lint-only, "
|
||||||
"--xml-only or --E option");
|
"--xml-only or --E option");
|
||||||
@ -1002,10 +1008,7 @@ void V3Options::parseOptsList(FileLine* fl, const string& optdir, int argc, char
|
|||||||
DECL_OPTION("-build", Set, &m_build);
|
DECL_OPTION("-build", Set, &m_build);
|
||||||
|
|
||||||
DECL_OPTION("-CFLAGS", CbVal, callStrSetter(&V3Options::addCFlags));
|
DECL_OPTION("-CFLAGS", CbVal, callStrSetter(&V3Options::addCFlags));
|
||||||
DECL_OPTION("-cc", CbCall, [this]() {
|
DECL_OPTION("-cc", CbCall, [this]() { ccSet(); });
|
||||||
m_outFormatOk = true;
|
|
||||||
m_systemC = false;
|
|
||||||
});
|
|
||||||
DECL_OPTION("-cdc", OnOff, &m_cdc);
|
DECL_OPTION("-cdc", OnOff, &m_cdc);
|
||||||
DECL_OPTION("-clk", CbVal, callStrSetter(&V3Options::addClocker));
|
DECL_OPTION("-clk", CbVal, callStrSetter(&V3Options::addClocker));
|
||||||
DECL_OPTION("-no-clk", CbVal, callStrSetter(&V3Options::addNoClocker));
|
DECL_OPTION("-no-clk", CbVal, callStrSetter(&V3Options::addNoClocker));
|
||||||
@ -1175,7 +1178,7 @@ void V3Options::parseOptsList(FileLine* fl, const string& optdir, int argc, char
|
|||||||
m_makeDir = valp;
|
m_makeDir = valp;
|
||||||
addIncDirFallback(m_makeDir); // Need to find generated files there too
|
addIncDirFallback(m_makeDir); // Need to find generated files there too
|
||||||
});
|
});
|
||||||
DECL_OPTION("-main", OnOff, &m_main).undocumented(); // Future
|
DECL_OPTION("-main", OnOff, &m_main);
|
||||||
DECL_OPTION("-make", CbVal, [this, fl](const char* valp) {
|
DECL_OPTION("-make", CbVal, [this, fl](const char* valp) {
|
||||||
if (!strcmp(valp, "cmake")) {
|
if (!strcmp(valp, "cmake")) {
|
||||||
m_cmake = true;
|
m_cmake = true;
|
||||||
|
@ -410,8 +410,9 @@ public:
|
|||||||
void addNoClocker(const string& signame);
|
void addNoClocker(const string& signame);
|
||||||
void addVFile(const string& filename);
|
void addVFile(const string& filename);
|
||||||
void addForceInc(const string& filename);
|
void addForceInc(const string& filename);
|
||||||
void notify();
|
|
||||||
bool available() const { return m_available; }
|
bool available() const { return m_available; }
|
||||||
|
void ccSet();
|
||||||
|
void notify();
|
||||||
|
|
||||||
// ACCESSORS (options)
|
// ACCESSORS (options)
|
||||||
bool preprocOnly() const { return m_preprocOnly; }
|
bool preprocOnly() const { return m_preprocOnly; }
|
||||||
|
@ -11,6 +11,9 @@ if (!$::Driver) { use FindBin; exec("$FindBin::Bin/bootstrap.pl", @ARGV, $0); di
|
|||||||
scenarios(simulator => 1);
|
scenarios(simulator => 1);
|
||||||
|
|
||||||
compile(
|
compile(
|
||||||
|
verilator_flags => [# Custom as don't want -cc
|
||||||
|
"-Mdir $Self->{obj_dir}",
|
||||||
|
"--debug-check", ],
|
||||||
verilator_flags2 => ['--exe --build --main'],
|
verilator_flags2 => ['--exe --build --main'],
|
||||||
verilator_make_cmake => 0,
|
verilator_make_cmake => 0,
|
||||||
verilator_make_gmake => 0,
|
verilator_make_gmake => 0,
|
||||||
|
Loading…
Reference in New Issue
Block a user