Remove env from main() to be C++11 compatible

This commit is contained in:
Wilson Snyder 2022-11-23 18:50:31 -05:00
parent 68f8617f79
commit 4b3731d318
40 changed files with 50 additions and 48 deletions

View File

@ -406,7 +406,7 @@ accesses the above signal "readme" would be:
printf("Value of v: %d\n", v.value.integer); // Prints "readme"
}
int main(int argc, char** argv, char** env) {
int main(int argc, char** argv) {
Verilated::commandArgs(argc, argv);
const std::unique_ptr<VerilatedContext> contextp{new VerilatedContext};
const std::unique_ptr<Vour> top{new Vour{contextp.get()}};

View File

@ -28,7 +28,7 @@ Now, let's create an example Verilog, and C++ wrapper file:
cat >sim_main.cpp <<'EOF'
#include "Vour.h"
#include "verilated.h"
int main(int argc, char** argv, char** env) {
int main(int argc, char** argv) {
VerilatedContext* contextp = new VerilatedContext;
contextp->commandArgs(argc, argv);
Vour* top = new Vour{contextp};

View File

@ -144,7 +144,7 @@ B. Or, for finer-grained control, or C++ files with multiple Verilated
#include "verilated_vcd_c.h"
...
int main(int argc, char** argv, char** env) {
int main(int argc, char** argv) {
const std::unique_ptr<VerilatedContext> contextp{new VerilatedContext};
...
Verilated::traceEverOn(true);
@ -197,7 +197,7 @@ C. Alternatively you may use the C++ trace mechanism described in the
#include "verilated_vcd_sc.h"
...
int main(int argc, char** argv, char** env) {
int main(int argc, char** argv) {
...
Verilated::traceEverOn(true);
VerilatedVcdSc* tfp = new VerilatedVcdSc;

View File

@ -11,19 +11,20 @@
// Include model header, generated from Verilating "top.v"
#include "Vtop.h"
int main(int argc, char** argv, char** env) {
int main(int argc, char** argv) {
// See a similar example walkthrough in the verilator manpage.
// This is intended to be a minimal example. Before copying this to start a
// real project, it is better to start with a more complete example,
// e.g. examples/c_tracing.
// Prevent unused variable warnings
if (false && argc && argv && env) {}
// Construct a VerilatedContext to hold simulation time, etc.
VerilatedContext* contextp = new VerilatedContext;
// Pass arguments so Verilated code can see them, e.g. $value$plusargs
// This needs to be called before you create any model
contextp->commandArgs(argc, argv);
// Construct the Verilated model, from Vtop.h generated from Verilating "top.v"
Vtop* top = new Vtop{contextp};

View File

@ -22,12 +22,13 @@ int sc_main(int argc, char* argv[]) {
// real project, it is better to start with a more complete example,
// e.g. examples/c_tracing.
// Prevent unused variable warnings
if (false && argc && argv) {}
// Construct the Verilated model, from Vtop.h generated from Verilating "top.v"
Vtop* top = new Vtop{"top"};
// Pass arguments so Verilated code can see them, e.g. $value$plusargs
// This needs to be called before you create any model
Verilated::commandArgs(argc, argv);
// Initialize SC model
sc_start(1, SC_NS);

View File

@ -16,8 +16,8 @@
#include <verilated_vcd_c.h>
#endif
int main(int argc, char** argv, char** env) {
if (false && argc && argv && env) {}
int main(int argc, char** argv) {
if (false && argc && argv) {}
// Construct context to hold simulation time, etc
VerilatedContext* contextp = new VerilatedContext;

View File

@ -17,11 +17,11 @@
// Legacy function required only so linking works on Cygwin and MSVC++
double sc_time_stamp() { return 0; }
int main(int argc, char** argv, char** env) {
int main(int argc, char** argv) {
// This is a more complicated example, please also see the simpler examples/make_hello_c.
// Prevent unused variable warnings
if (false && argc && argv && env) {}
if (false && argc && argv) {}
// Create logs/ directory in case we have traces to put under it
Verilated::mkdir("logs");

View File

@ -721,7 +721,7 @@ static void execHierVerilation() {
//######################################################################
int main(int argc, char** argv, char** /*env*/) {
int main(int argc, char** argv) {
// General initialization
std::ios::sync_with_stdio();

View File

@ -113,7 +113,7 @@ void VlcOptions::showVersion(bool verbose) {
//######################################################################
int main(int argc, char** argv, char** /*env*/) {
int main(int argc, char** argv) {
// General initialization
std::ios::sync_with_stdio();

View File

@ -1788,7 +1788,7 @@ sub _make_main {
print $fh " sc_set_time_resolution(1, $Self->{sc_time_resolution});\n";
print $fh " sc_time sim_time($self->{sim_time}, $Self->{sc_time_resolution});\n";
} else {
print $fh "int main(int argc, char** argv, char** env) {\n";
print $fh "int main(int argc, char** argv) {\n";
print $fh " uint64_t sim_time = $self->{sim_time};\n";
}

View File

@ -51,7 +51,7 @@ void oneTest(int argc, char** argv, int seed) {
topp->final();
}
int main(int argc, char** argv, char** env) {
int main(int argc, char** argv) {
#if VL_DEBUG
// Verilated::debug(1);
#endif

View File

@ -16,7 +16,7 @@
#include <memory>
int main(int argc, char** argv, char** env) {
int main(int argc, char** argv) {
const std::unique_ptr<VerilatedContext> contextp{new VerilatedContext};
contextp->commandArgs(argc, argv);
contextp->debug(0);

View File

@ -16,7 +16,7 @@
#include <memory>
int main(int argc, char** argv, char** env) {
int main(int argc, char** argv) {
const std::unique_ptr<VerilatedContext> contextp{new VerilatedContext};
contextp->commandArgs(argc, argv);
contextp->debug(0);

View File

@ -16,7 +16,7 @@
#include <memory>
int main(int argc, char** argv, char** env) {
int main(int argc, char** argv) {
const std::unique_ptr<VerilatedContext> contextp{new VerilatedContext};
contextp->commandArgs(argc, argv);
contextp->debug(0);

View File

@ -110,7 +110,7 @@ void mon_eval() {
//======================================================================
int main(int argc, char** argv, char** env) {
int main(int argc, char** argv) {
const std::unique_ptr<VerilatedContext> contextp{new VerilatedContext};
uint64_t sim_time = 1100;

View File

@ -12,7 +12,7 @@
#include <memory>
int main(int argc, char** argv, char** env) {
int main(int argc, char** argv) {
srand48(5);
const std::unique_ptr<VerilatedContext> contextp{new VerilatedContext};

View File

@ -13,7 +13,7 @@
#include "verilated.h"
std::unique_ptr<Vt_public_clk> topp;
int main(int argc, char** argv, char** env) {
int main(int argc, char** argv) {
vluint64_t sim_time = 1100;
const std::unique_ptr<VerilatedContext> contextp{new VerilatedContext};
contextp->commandArgs(argc, argv);

View File

@ -13,7 +13,7 @@
#include "verilated.h"
std::unique_ptr<Vt_public_seq> topp;
int main(int argc, char** argv, char** env) {
int main(int argc, char** argv) {
vluint64_t sim_time = 1100;
const std::unique_ptr<VerilatedContext> contextp{new VerilatedContext};
contextp->commandArgs(argc, argv);

View File

@ -17,7 +17,7 @@
const unsigned long long dt_2 = 3;
int main(int argc, char** argv, char** env) {
int main(int argc, char** argv) {
const std::unique_ptr<VerilatedContext> contextp{new VerilatedContext};
Vt_scope_map* top = new Vt_scope_map{contextp.get(), "top"};

View File

@ -22,7 +22,7 @@ const char* trace_name() {
return name;
}
int main(int argc, char** argv, char** env) {
int main(int argc, char** argv) {
std::unique_ptr<VM_PREFIX> top{new VM_PREFIX("top")};
Verilated::debug(0);

View File

@ -22,7 +22,7 @@ const char* trace_name() {
return name;
}
int main(int argc, char** argv, char** env) {
int main(int argc, char** argv) {
std::unique_ptr<VM_PREFIX> top{new VM_PREFIX("top")};
Verilated::debug(0);

View File

@ -19,7 +19,7 @@ double sc_time_stamp() { return (double)main_time; }
const unsigned long long dt_2 = 3;
int main(int argc, char** argv, char** env) {
int main(int argc, char** argv) {
std::unique_ptr<VM_PREFIX> top{new VM_PREFIX("top")};
Verilated::debug(0);

View File

@ -27,7 +27,7 @@ double sc_time_stamp() { return (double)main_time; }
const unsigned long long dt_2 = 3;
int main(int argc, char** argv, char** env) {
int main(int argc, char** argv) {
std::unique_ptr<VM_PREFIX> top{new VM_PREFIX("top")};
Verilated::debug(0);

View File

@ -25,7 +25,7 @@ double sc_time_stamp() { return (double)main_time; }
const unsigned long long dt_2 = 3;
int main(int argc, char** argv, char** env) {
int main(int argc, char** argv) {
VM_PREFIX* top = new VM_PREFIX{"top"};
Verilated::debug(0);

View File

@ -16,7 +16,7 @@
unsigned long long main_time = 0;
double sc_time_stamp() { return (double)main_time; }
int main(int argc, char** argv, char** env) {
int main(int argc, char** argv) {
std::unique_ptr<VM_PREFIX> top{new VM_PREFIX("top")};
Verilated::debug(0);

View File

@ -26,7 +26,7 @@
VM_PREFIX* ap;
Vt_trace_two_b* bp;
int main(int argc, char** argv, char** env) {
int main(int argc, char** argv) {
const std::unique_ptr<VerilatedContext> contextp{new VerilatedContext};
uint64_t sim_time = 1100;

View File

@ -19,7 +19,7 @@ double main_time;
double sc_time_stamp() { return main_time; }
int main(int argc, char** argv, char** env) {
int main(int argc, char** argv) {
Verilated::debug(0);
VM_PREFIX* topp = new VM_PREFIX{""}; // Note null name - we're flattening it out

View File

@ -143,7 +143,7 @@ static void register_filler_cb() {
double sc_time_stamp() { return main_time; }
int main(int argc, char** argv, char** env) {
int main(int argc, char** argv) {
const std::unique_ptr<VerilatedContext> contextp{new VerilatedContext};
uint64_t sim_time = 100;

View File

@ -245,7 +245,7 @@ static int register_test_callback() {
return 0;
}
int main(int argc, char** argv, char** env) {
int main(int argc, char** argv) {
const std::unique_ptr<VerilatedContext> contextp{new VerilatedContext};
uint64_t sim_time = 100;

View File

@ -239,7 +239,7 @@ void vpi_compat_bootstrap(void) {
void (*vlog_startup_routines[])() = {vpi_compat_bootstrap, 0};
#else
int main(int argc, char** argv, char** env) {
int main(int argc, char** argv) {
const std::unique_ptr<VerilatedContext> contextp{new VerilatedContext};
uint64_t sim_time = 1100;

View File

@ -250,7 +250,7 @@ void (*vlog_startup_routines[])() = {vpi_compat_bootstrap, 0};
#else
int main(int argc, char** argv, char** env) {
int main(int argc, char** argv) {
const std::unique_ptr<VerilatedContext> contextp{new VerilatedContext};
uint64_t sim_time = 1100;

View File

@ -171,7 +171,7 @@ void (*vlog_startup_routines[])() = {vpi_compat_bootstrap, 0};
#else
int main(int argc, char** argv, char** env) {
int main(int argc, char** argv) {
const std::unique_ptr<VerilatedContext> contextp{new VerilatedContext};
uint64_t sim_time = 1100;

View File

@ -239,7 +239,7 @@ void (*vlog_startup_routines[])() = {vpi_compat_bootstrap, 0};
#else
int main(int argc, char** argv, char** env) {
int main(int argc, char** argv) {
const std::unique_ptr<VerilatedContext> contextp{new VerilatedContext};
uint64_t sim_time = 1100;

View File

@ -24,7 +24,7 @@
//======================================================================
int main(int argc, char** argv, char** env) {
int main(int argc, char** argv) {
const std::unique_ptr<VerilatedContext> contextp{new VerilatedContext};
uint64_t sim_time = 1100;

View File

@ -183,7 +183,7 @@ extern "C" int mon_check() {
//======================================================================
int main(int argc, char** argv, char** env) {
int main(int argc, char** argv) {
const std::unique_ptr<VerilatedContext> contextp{new VerilatedContext};
uint64_t sim_time = 1100;

View File

@ -693,7 +693,7 @@ void (*vlog_startup_routines[])() = {vpi_compat_bootstrap, 0};
#else
double sc_time_stamp() { return main_time; }
int main(int argc, char** argv, char** env) {
int main(int argc, char** argv) {
const std::unique_ptr<VerilatedContext> contextp{new VerilatedContext};
uint64_t sim_time = 1100;

View File

@ -105,7 +105,7 @@ void (*vlog_startup_routines[])() = {vpi_compat_bootstrap, 0};
#else
int main(int argc, char** argv, char** env) {
int main(int argc, char** argv) {
const std::unique_ptr<VerilatedContext> contextp{new VerilatedContext};
uint64_t sim_time = 1100;

View File

@ -88,7 +88,7 @@ void sim(VM_PREFIX* topp) {
contextp->coveragep()->write(filename.c_str());
}
int main(int argc, char** argv, char** env) {
int main(int argc, char** argv) {
// Create contexts
std::unique_ptr<VerilatedContext> context0p{new VerilatedContext};
std::unique_ptr<VerilatedContext> context1p{new VerilatedContext};

View File

@ -9,7 +9,7 @@
#include VM_PREFIX_INCLUDE
int main(int argc, char** argv, char** env) {
int main(int argc, char** argv) {
// Create contexts
VerilatedContext* contextp{new VerilatedContext};

View File

@ -29,7 +29,7 @@ vluint64_t vl_time_stamp64() { return main_time; }
double sc_time_stamp() { return main_time; }
#endif
int main(int argc, char** argv, char** env) {
int main(int argc, char** argv) {
// Test that the old non-context Verilated:: calls all work
// (This test should never get updated to use context)