Replies: 4 comments
-
Thank you for the feedback :) As you are probably able to tell, I am not an expert in VHDL. This is only my second "real" project with an FPGA and it was a lot of trial and error. I'll try to keep your suggestions in mind when I make changes to it in the future (but will leave the code as it is now unless I find problems with it). One question regarding the asynchronous reset you suggested (at least I think that is what you are suggesting): wouldn't that lead to synchronization problems again? The release of the reset signal may happen anytime with respect to the clock and this could cause certain block to react to one rising clock edge and others only to the next edge, right? Or is this not a problem at all because the reset should be synchronous to the clock anyway since it is dependent on the lock signal of the internal PLL? (which I assume will be asserted synchronous to the clock) |
Beta Was this translation helpful? Give feedback.
-
About reset: Using this Dockerfile You can quickly generate RTL-schematics. File reset_test.vhdl:
run:
to get reset_test.svg file: None of the DFF (D Flip Flops) are asynchronously reseted.
a1_out and a2_out on the other hand, are synthesized equally. |
Beta Was this translation helpful? Give feedback.
-
Thanks for the example, it illustrates nicely why I should reset all signal with the approach I am using. But I was wondering about this approach you mentioned:
This would result in an asynchronous reset, correct? And from my limited understanding of VHDL, this could lead to issues when some circuitry gets out of reset faster than others. Or did I misunderstand something there? |
Beta Was this translation helpful? Give feedback.
-
No, my code did not produce async reset. This code
generates async reset for c1_out. Vhdl process is executed in simulator like this:
Note that b1_out reset-if is executed only if there is a rising edge on clk_in. For c1_out, on the other hand, the process is executed if there is a change on sreset_in or clk_in. And the reset-if is not dependent on clk_in, but sreset_in only => thus generating async reset functionality. Properly working logic synthesizer (not all tools are like this, though) either
And yes, async reset (as well as sync reset) needs to be properly timed. There are ways to achieve the timing. Reset signal can be captured by few retiming DFF:s (clock domain crossing), and the timed reset is used for the logic. Works both for sync and async reset. Clock of the logic is disabled during async reset release (clock gating). Some clock buffers have enable input, which can be used to disable the clock at will. One variation is:
This way the reset needs not to be timed against clock. Works also in multi-clock designs, but the enable order of different clocks might need proper planning. |
Beta Was this translation helpful? Give feedback.
-
Hi,
Nice project !
Two comments about VHDL coding style:
You don't need to introduce "component Synchronizer..." type of declarations, when you instantiate the components this way:
Sync_AUX1: entity work.Synchronizer ...
You have your synchronous reset handling in the beginning of process, and actual work-horse in else-path.
This either requires you to reset every signal in the process, or the synthesizer implements a clock-enable signal for un-reseted signals. This shall be either native clock enable, or an input multiplexer to the DFF feeding its own output to the other input of MUX.
If you write in style:
With this coding style the non-reseted signals don't have any effect from the reset signal, and they continue to toggle even when RESET is active (typically for data registers you don't want to have reset).
This helps you when you are coding for high speed logic (e.g. Intel Stratix-10 hyper-registers do not have reset input, so only registers without any reset functionality can be mapped to them).
And you have RESET in your sensitivity list, even though reset is synchronous. That is unnecessary.
Beta Was this translation helpful? Give feedback.
All reactions