First have a look at the attached sreenshot...
> but clearly it dosent work...
And HOW did you see that?
Did you do a SIMULATION?
What ERROR messages or WARNINGS did you get?
And why do you ignore them all?
In fact the problem here is the well known and famous "combinatorial
loop":
as long as key0 is 1 and moda is 0 the countera is counting upwards
without any clock at maximum and random speed:
1 | elsif (key0 ='1') and moda='0' then
|
2 | countera<= countera+"00001" ;
|
Try Google translator on that:
http://www.lothar-miller.de/s9y/archives/42-Kombinatorische-Schleifen.html
Let me ask you: where did you see this structure in literature?
1 | begin process ( resetN key0, clk)
|
2 | begin
|
3 | if resetN = '0' then
|
4 | ...
|
5 | elsif (key0 ='1') and moda='0' then
|
6 | ...
|
7 | elsif (rising_edge(clk)) then
|
8 | ...
|
9 | end if;
|
There's only one way to desrcibe a synchronous process:
1 | begin process ( resetN, clk)
|
2 | begin
|
3 | if resetN = '0' then
|
4 | ...
|
5 | elsif (rising_edge(clk)) then
|
6 | ...
|
7 | end if;
|
Beside the whole things above: the sensitivity list is incomplete, moda
ist missing. Therefore a simulation will show wrong results...
BTW: congratulations to use the 1-process-FSM. You are a big step
further than in the thread https://embdev.net/topic/386779