Electronic – Return from idle state

state-machinesvhdl

I have 5 states : idle, state1, state2, state3, state4. I sometimes need to go to idle according to my design, and when I return from idle, I don't want to start from beginning, I want to start from the last state I was in. I thought about doing this in idle as

if (statereg = 2) then
my_state <= state2;
end if;

Is this a good approach or won't work? Are there better ways? How do VHDL gurus handle this kind of situation, what do we call this method in VHDL, does it have a name?

Best Answer

How complicated is your "idle" state?

If it's relatively simple, perhaps it would be better to simply replicate it; in other words, have separate idle1, idle2, etc. states, one for each of the active states.