Forum Discussion
Altera_Forum
Honored Contributor
11 years agohere is an example of a single process state machine:
process(clk, reset)
begin
if reset = '1' then
current_state <= idle;
count <= 0;
elsif rising_edge(clk) then
case current_state is
when idle =>
if input = '1' then
current_state <= doing_something;
end if;
when doing_something =>
count <= count + 1;
if count = SOME_NUMBER then
current_state <= finished;
end if;
when finished =>
count <= 0;
current_state <= idle;
end case;
end if;
end process;