steveicarus / iverilog

Icarus Verilog
https://steveicarus.github.io/iverilog/
GNU General Public License v2.0
2.86k stars 530 forks source link

Clock of register is out of sync between RTL vs Yosys genereted netlist #1125

Closed zhergarvi closed 6 months ago

zhergarvi commented 6 months ago

There is asynchronous reset register in RTL which runs on clock fabric_clk_div from PLL. After synthesizing this RTL, the netlist contains same clock that goes to DFFRE but both clocks are not in sync with each other. The netlist clock get triggered before RTL clock. Below is the screenshot: image Note: After running this design on Verilator, both clocks were in sync. Steps to reproduce:

  1. iverilog -g2012 *.v
  2. vvp a.out Files: test.tar.gz
martinwhitaker commented 6 months ago

This is a race in your code. Look at how the PLL LOCK signal is generated and used.

martinwhitaker commented 6 months ago

Closing as this is not an Icarus Verilog issue.