Forum Discussion
Altera_Forum
Honored Contributor
16 years agoModling a State Machine in VHDL ... with trouble memorizing variables
Hi, I'm trying to make a state-machine wich remains in one of the states until one of the variables goes from zero to one three times. I assume it should be quite simple, but after some days I ...
Altera_Forum
Honored Contributor
16 years agoYou can't place a counter in the combinational process. The output gets simply unpredictable this way. The accumulator must be assigned under control of an edge sensitive condition, similar to the state variable.
accumulate<=accumulate+1; Also I don't see how the state machine can work with just two states. I have difficulties to guess the exact intended behaviour. I suggest to sketch a waveform and use a different state for each step. Care must be taken, if signal_to_monitor is unrelated to the system clock domain, e.g. an external signal. In this case, it's necessary to synchronize it by a clocked register and make the register output control the state machine.