Forum Discussion
Altera_Forum
Honored Contributor
10 years agoYes- because you have control signal attempting to do increment a counter not on a clock edge.
You need to follow this template:
process(resetN, clk)
begin
if resetN = '0' then
--do resets here
elsif rising_edge(clk)
--ALL other code goes in here
end if;
end process;
If you dont follow the template above, you are trying to create extra analogue control paths. For example - if key0 = '1' and moda = '0', it is trying to increment the counter an infinite number of times in 0 time (in reality there will be some tiny propogation delay - still it will count up ALOT). This is an analogue feedback path - and is not a good idea. I suggest you draw your circuit on paper before you try and write the code. Then when you have a good idea of the circuit, you can use the known templates to copy your circuit into code. I also suggest you write a testbench to test the code.