Forum Discussion
Altera_Forum
Honored Contributor
17 years agoCounter Problems
Hi, im trying to implement a counter which counts positive, negative, or both edges of an incoming signal. It works, but if I give 10000pulses to it it counts only between 9980...9997. The interna...
Altera_Forum
Honored Contributor
17 years agoI'd add to Kaz's reply by saying that I'd pass in_signal through two registers and not present the "raw" unsynchronised signal to any logic, in order to avoid metastability:
in_signal_d <= in_signal;
in_signal_dd <= in_signal_d; and then: if in_signal_d /= in_signal_dd then
... (I'd also probably separate the code out into two processes but that's just my personal preference).