Forrest logo
back to the verilator tool

verilator:tldr:d2db0

verilator: Create a C++ executable in a specific folder.
$ verilator --cc --exe --build --build-jobs 0 -Wall ${path-to-source-cpp} ${path-to-output-v}
try on your machine

This command is using the Verilator tool to build and compile a SystemVerilog source file, along with a C++ testbench, into an executable program.

Here is the breakdown of each part of the command:

  • verilator: This is the command to invoke the Verilator tool.

  • --cc: This option specifies that Verilator should generate C++ output code.

  • --exe: This option tells Verilator to create an executable file.

  • --build: This option instructs Verilator to perform a build, which includes compiling and linking the generated C++ code.

  • --build-jobs 0: This option is used to specify the number of simultaneous jobs to run during the build process. Setting it to 0 allows Verilator to automatically determine the optimal number of jobs based on the available system resources.

  • -Wall: This option enables all warning messages during compilation. It helps to catch potential issues or code quality concerns by producing more warnings.

  • ${path-to-source-cpp}: This is the placeholder for the path to your SystemVerilog or Verilog source file. You need to replace it with the actual path to your source code file.

  • ${path-to-output-v}: This is the placeholder for the path where the Verilator will generate the compiled output. You need to replace it with the desired path or filename for the compiled output.

Overall, this command instructs Verilator to compile the specified SystemVerilog source file and its associated C++ testbench into an executable program, using default settings for the build process and enabling warning messages during compilation.

This explanation was created by an AI. In most cases those are correct. But please always be careful and never run a command you are not sure if it is safe.
back to the verilator tool