Verilator¶
Useful Links
- Homepage: https://verilator.org/
- Documentation: https://verilator.org/guide/latest
- ChangeLog: https://verilator.org/guide/latest/changes.html
- Current default version: 5.040
Initialisation¶
To use verilator, load the verilator package in your script, you can choose to use either a local binary provided by KISSB, or the docker image provided by verilator:
-
To use the local version
Warning
Using verilator via local binary requires installing g++ and ccach on your host - the init command will check for their availability.
-
To use the docker version
To set the version, replace "vVERSION" by the desired version. For example 5.040 for version v5.040:
package require kissb.eda.verilator
# For example:
verilator.init.local 5.040
# To use the official verilator docker image
verilator.init.docker 5.040
Two Step verilator usage¶
1. Compilation¶
After initialisation, first you must compile your design using the verilator verilate command:
/**
A very simple testbenck to demonstrate simulating the counter
*/
module counter_tb;
logic resn;
logic clk;
always begin
#10ns clk <= ! clk;
end
initial begin
$dumpfile("waves.fst");
$dumpvars();
resn = 0;
clk = 0;
@(posedge clk);
@(posedge clk);
resn=1;
repeat(10) begin
@(posedge clk);
end
#5000 $finish();
end
counter dut(
.clk(clk),
.resn(resn),
.value()
);
endmodule
This command accepts the same arguments as the Verilator verilate command, see https://verilator.org/guide/latest/verilating.html
To enable waveform tracing, and add support for GtkWage fst file format, add the following arguments:
# For example to compile a counter design with a simple testbench
verilator.verilate --binary --trace --trace-fst counter.sv counter_tb.sv
2. Running¶
After verilating, you can run your compiled design directly as executable, but best is to use the verilator.simulate command which will execute the binary from your host or via the docker image depending on how you loaded the package.
Single Step Usage¶
To ease usage, users can use the verilator.vrun command, which will compile and run the design in one pass.
Pre-Build Binaries¶
Verilator Package Variables¶
Before or after Loading the flow, you can set configuration variables:
| Variable | Description | Default Value | Env. Override |
|---|---|---|---|
| verilator.version | default verilator version | 5.040 | VERILATOR_VERSION |
| verilator.runtime | local | VERILATOR_RUNTIME | |
| verilator.lint.args | --no-decoration | VERILATOR_LINT_ARGS | |
| verilator.verilate.args | VERILATOR_VERILATE_ARGS |
Verilator Commands Reference¶
verilator.coverage.enable¶
verilator.coverage.enable?args?
Parameters¶
verilator.coverage.toInfo¶
verilator.coverage.toInfocoverageDat coverageInfo
Parameters¶
coverageDat |
Not documented. |
coverageInfo |
Not documented. |
verilator.image.run¶
verilator.image.runscript
Parameters¶
script |
Not documented. |
verilator.init¶
verilator.init?args?
Parameters¶
verilator.init.docker¶
verilator.init.dockerversion
Parameters¶
version |
Not documented. |
verilator.init.local¶
verilator.init.localversion
Parameters¶
version |
Not documented. |
verilator.isDockerRuntime¶
verilator.isDockerRuntime?args?
Parameters¶
verilator.lint¶
Run linter
verilator.lint?args?
Parameters¶
verilator.root¶
verilator.rootpath
Parameters¶
path |
Not documented. |
verilator.runtime.docker¶
verilator.runtime.docker?args?
Parameters¶
verilator.runtime.local¶
verilator.runtime.local?args?
Parameters¶
verilator.simulate¶
Run simulation from exe located in obj_dir
verilator.simulatename ?args?
Parameters¶
name |
Not documented. |
verilator.verilate¶
verilator.verilate?args?
Parameters¶
verilator.vrun¶
verilator.vruntop compileArgs simulateArgs
Parameters¶
top |
Not documented. |
compileArgs |
Not documented. |
simulateArgs |
Not documented. |