From: Ralf Hildebrandt on
Am 13.05.2010 16:18, schrieb John McCaskill:

> The problem is this bit of code:
>
> process (Inc_cnt, Dec_cnt)
> begin
> if Inc_cnt = '1' then
> Int_count <= Int_count + 1;
> elsif Dec_cnt = '1' then
> Int_count <= Int_count - 1;
> end if;
>
> end process;
>
>
> Inc_cnt looks like an asynchronous reset, and Dec_cnt looks like the
> clock.

You pointed out a very bad piece of code, but it is not a flipflop - it
is a latch as rickman has already pointed out.

It has 2 big design errors:

1) muxed latch: Inc_cnt and Dec_cnt drive latch-enable and mux-select.
This is very bad design because no one can say if the latch-enable or
the mux-select chances first in the moment when Inc_cnt / Dec_cnt become
inactive.

2) infinite loop: As long as Inc_cnt / Dec_cnt is enable, Int_count is
incremented / decremented. During simulation this problem did not show
up, because the sensitivity list of this process is incomplete. Put
Int_count into the sensitivity list and the simulator will freeze forever.


Ralf