Trying to get started with basic Verilator c++ example on Windows 10.
Attempt 1: Using WSL, install from apt
apt install verilatorseems to run fineverilator --versionreturnsVerilator 4.038 2020-07-11 rev v4.036-114-g0cd4a57adexport VERILATOR_ROOT=/usr/share/verilator(after a few attempts at this step)Using
our.vandsim_main.cppas in the exampleverilator --cc --exe --build -j 0 -Wall sim_main.cpp our.vreturns%Error: -j accepts positive integer, but 0 is passed. Ok so maybe that's a version 5 argument.Try again
verilator --cc --exe --build -j 1 -Wall sim_main.cpp our.vreturnsCan't exec "/usr/share/verilator/verilator_bin": No such file or directory at /usr/bin/verilator line 173. %Error: verilator: Misinstalled, or VERILATOR_ROOT might need to be in environment %Error: Verilator threw signal -1. Suggest trying --debug --gdbbt %Error: Command Failed /usr/share/verilator/verilator_bin --cc --exe --build -j 1 -Wall sim_main.cpp our.vverilator_binis installed next toverilatorin/usr/bin, not in/usr/share/verilatorwhich is whereVERILATOR_ROOTpoints to.When I had
VERILATOR_ROOTaccidentally pointing to/usr/binin third step above, the tool could not findverilated.mkI went into
obj_dir/and didmake Vourdirectly, but it complained about not findingverilated_heavy.hSo it looks like
VERILATOR_ROOTis the main lever here, and pointing to either/usr/binor/usr/share/verilatordoesn't work, but in different ways.
Attempt 2: Using WSL, build V5.008 from git source, from instructions
apt remove verilatorto remove attempt 1Download from git and build everything as per "Git Quick Install" section
Needed to install
help2manbeforemake install, which is not in instructionsverilator --versionreturnsVerilator 5.008 2023-03-04 rev v5.008-32-gaaaf8e75amake test-- all passedwhich verilatorreturns/usr/local/bin/verilatorexport VERILATOR_ROOT=/usr/local/binthenverilator --cc --exe --build -j 0 -Wall sim_main.cpp our.vreturnsCannot find verilated_std.sv``/usr/local/share/verilator/include/verilated_std.sv.Put
export VERILATOR_ROOT=/usr/local/share/verilatorin.bashrc, then restart, thenverilator --cc --exe --build -j 0 -Wall sim_main.cpp our.vreturnsCan't exec "/usr/local/share/verilator/verilator_bin": No such file or directory at /usr/local/bin/verilator line 207. %Error: verilator: Misinstalled, or VERILATOR_ROOT might need to be in environment %Error: Verilator threw signal -1. Suggest trying --debug --gdbbt %Error: Command Failed /usr/local/share/verilator/verilator_bin --cc --exe --build -j 1 -Wall sim_main.cpp our.vSo basically same problem as attempt #1 -- I can't find a good setting for
VERILATOR_ROOTRemoved
VERILATOR_ROOTfrom .bashrc, start WSL againmake clean,autoconf,make,make test,make installall goodSame results as above after updating
VERILATOR_ROOTto/usr/local/share/verilatorand optionally adding$VERILATOR_ROOT/binto path.
Attempt 3: Using MSVC and CMAKE, build V5.008 from git source
- More difficulties, but eventually got a binary
- Program does not generate any output.
I just needed to unset VERILATOR_ROOT completely, even after make install.