Verilator Double-Triggering
See original GitHub issueI’ve run into a bug where rising edges of clocks will double-trigger, when using Verilator as a simulator.
Here is a minimum reproduction of the design that causes the issue:
module test(input wire clk);
reg clkdiv2;
always @(posedge clk) begin
clkdiv2 <= ~clkdiv2;
end
endmodule
See this gist for my full test setup.
I can’t seem to get the example to trigger at all in iverilog, so I don’t entirely know if it’s Verilator or CocoTB. I’m assuming iverilog is optimizing out clkdiv2
but I’m not sure how to fix that.
EDIT:
Specifically what’s happening is the following statement:
await RisingEdge(dut.clkdiv2)
print(get_sim_time())
Triggers twice per clock edge. (Also tested with FallingEdge, Edge, and ClockCycles)
Issue Analytics
- State:
- Created 3 years ago
- Comments:7 (3 by maintainers)
Top Results From Across the Web
Verilator 5.005 documentation
Verilator reads the input Verilog code and determines all “top modules”, that is, modules or programs that are not used as instances under...
Read more >cocotb/Lobby - Gitter
Seeing some unexpected behavior with Verilator. ... are called again after the readwrite callbacks without an eval, which is the cause of double...
Read more >FAQ/Frequently Asked Questions — Verilator 5.005 ... - Veripool
Verilator is one of the “big 4” simulators, meaning one of the four leading ... Any of your VPI/DPI C++ routines that Verilator...
Read more >Verilator Pt.1: Introduction - It's Embedded!
To simulate a design using Verilator, a native binary executable is built from the verilated HDL code and the C++ testbench using GCC...
Read more >Taking a New Look at Verilator - ZipCPU
You will start by running the Verilator command line program on your top level Verilog file. For the purposes of this discussion, let's...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I can confirm that the issue has been fixed, running a fresh build:
Verilator 4.105 devel rev v4.104-81-gd21b4e3f
.The infinite loop issue I believe was related has also been fixed!
@davidlenfesty Can you check if this issue is still occuring? verilator/verilator#2644 may have fixed this.