Forum Discussion
Altera_Forum
Honored Contributor
9 years agothats because your enable isnt acting as an enable. cnt_out is a combinatorial version of cnt+1 or cnt, using the enable bit to select. This is because you used a variable for cnt, and then assigned it to a signal after you've done +1
The fix : remove the variable complelely and use signals instead. Switch to vhdl 2008 and replace cnt with cnt_out. Variables can cause these issues as the ordering of the code can affect the circuit. If you used only signals, then you probably wouldnt have had this problem.