Verilator v5試す(timingとbinaryオプション)
2022/10/29に Verilator v5.002がリリースされたようです。
Revision Historyによると
・Require C++20 for the new –timing features. Upgrading to a C++20 or newer compiler is strongly recommended.
・Support the Active and NBA scheduling regions as defined by the SystemVerilog standard (IEEE 1800-2017 chapter 4). This means all generated clocks are now simulated correctly (#3278, #3384). [Geza Lore, Shunyao CAD]
・Support timing controls (delays, event controls in any location, wait statements) and forks. [Krzysztof Bieganski, Antmicro Ltd] This may require adding –timing or –no-timing. See docs for details.
・Introduce a new combinational logic optimizer (DFG), that can yield significant performance improvements on some designs. [Geza Lore, Shunyao CAD]
・Add –binary option as alias of –main –exe –build –timing (#3625). For designs where C++ was only used to make a simple no-I/O testbench, we recommend abandoning that C++, and instead letting Verilator build it with –binary (or –main).
ということで、Timing Controlがサポートされたということで早速試してみました。
Mac(Monterey 12.6)だと brew install
でインストールされると思います。
私は元々入れていたので、brew update/upgrade
を実行しました。
$ verilator --version Verilator 5.002 2022-10-29 rev UNKNOWN.REV
実行コード&オプション自体はこちらを参考にしました。
module our; initial begin $display("Current time = %t", $realtime); $display("Hello World"); #10; $display("Current time = %t", $realtime); $finish; end endmodule
- コンパイル&実行
$ verilator --binary -j 0 -Wall our.v $ ./obj_dir/Vour Current time = 0 Hello World Current time = 10 - our.v:7: Verilog $finish
おぉ!きちんと #10;
が効いてますね。
ちなみに、--no-timing
を付けるとエラーメッセージが出てきます。
$ verilator --no-timing --binary -j 0 -Wall our.v %Warning-STMTDLY: our.v:5:5: Ignoring delay on this statement due to --no-timing : ... In instance our 5 | #10; | ^ ... For warning description see https://verilator.org/warn/STMTDLY?v=5.002 ... Use "/* verilator lint_off STMTDLY */" and lint_on around source to disable this message. %Error: Exiting due to 1 warning(s)