This page describes my first experience with
verilator.
-
In order to practice cpp (c++) verification benches, with system verilog DPI, using a
verilog DUT, I decided to download verilator
and do some self study exercises.
-
First I installed the software. This is fairly simple on a debian
machine:
apt-get install verilator
-
Next I headed to try the example, given in the manual pages of verilator. At
this point my troubles,
with this software, started.
-
Setting the variable VERILATOR_ROOT. If I set it as in the manual pages,
it would not compile. Based on its error messages, I selected:
export VERILATOR_ROOT=/usr/bin
Then I was able to compile it, with the following command and not as
shown in manual pages:
clear;/usr/bin/verilator --cc our.v --exe sim_main.cpp
-
I switched to the object directory namely, obj_dir, and the make file would
not work properly. Again the internal VERILATOR_ROOT, in the make file, was not set
properly, under my debian machine. I applied the following
simple patch:
# Pini
# VERILATOR_ROOT = /usr/bin
VERILATOR_ROOT = /usr/share/verilator
-
At this point all worked well. I run the simulation using the command:
./Vour
-
The example, simple verilog and its cpp test-bench, as I used it for the test
are listed below:
module our;
initial begin
$display("Hello World ----");
$finish;
end
endmodule
The bench is as is in the example, untouched.
#include "Vour.h"
#include "verilated.h"
int main(int argc, char **argv, char **env) {
Verilated::commandArgs(argc, argv);
Vour* top = new Vour;
while (!Verilated::gotFinish()) { top->eval(); }
exit(0);
}
|