Flip-flop issue in iVerilog synthesis. #692
-
Hello,
I use iVerilog 12 and it performs synthesis (using -S key) of this schematic well, but if I comment line 14 (comment), synthesis fails with errors:
It looks like always flock forms a kind of «clock domain» and it is forbidden to have different flip-flops (with asynchronous reset and without) in it. In the output net-list I see 2 flip-flop arrays:
Really I don’t need the asynchronous reset for capture register, but I should connect it due to this restriction.
In the output net-list I see 2 flip-flop arrays – one with reset and other without:
Actually, it is no problem to use 2-nd version instead of first. But 2-nd version requires more HW – at least 2 comparators instead of 1! Could anyone explain me the reason of such behavior of synthesis tool? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
This is an issue with all synthesis tools that I have used over the years - and it isn't restricted to Verilog/SV - it's VHDL as well. I can't remember the exact reason, but it's actually a latch inference problem. If you don't reset EVERYTHING in a "sequential process"/always_ff you will have a latch. So I agree with iVerilog's behaviour here. I have seen in-house tools developed to detect such code, but I would expect the issue to be handled by most modern linting tools. Based on experience - don't write code like this. If you really don't want to reset something, put it in another always_ff WITHOUT a reset and use another signal to assign at the clock edge. |
Beta Was this translation helpful? Give feedback.
This is an issue with all synthesis tools that I have used over the years - and it isn't restricted to Verilog/SV - it's VHDL as well.
I can't remember the exact reason, but it's actually a latch inference problem. If you don't reset EVERYTHING in a "sequential process"/always_ff you will have a latch. So I agree with iVerilog's behaviour here.
I have seen in-house tools developed to detect such code, but I would expect the issue to be handled by most modern linting tools.
Based on experience - don't write code like this. If you really don't want to reset something, put it in another always_ff WITHOUT a reset and use another signal to assign at the clock edge.