C
Calvin
Guest
I am aware of three main styles for state machine coding: Medvedev,
Moore and Mealy. Recently, one of my coworkers introduced a "hybrid"
one as follows:
p_reg: process(rst, clk)
begin
if rst = '0' then
current_state <= st_idle;
current_output <= cmb_idle;
elsif rising_edge(clk) then
current_state <= next_state;
current_output <= next_output;
end if;
end process p_reg;
p_cmb: process(current_state, data, stat)
case current_state is
when st_idle =>
if data = "1001" then
next_state <= st_start;
next_output <= stat(0) and not stat(1);
elsif ...
...
...
end if;
when st_start =>
...
when others =>
...
end case;
end process;
to_output_port <= current_output;
He said this is the best approach for state machine coding.
I truly appreciate any comments as well as pros/cons for this approach.
Calvin
Moore and Mealy. Recently, one of my coworkers introduced a "hybrid"
one as follows:
p_reg: process(rst, clk)
begin
if rst = '0' then
current_state <= st_idle;
current_output <= cmb_idle;
elsif rising_edge(clk) then
current_state <= next_state;
current_output <= next_output;
end if;
end process p_reg;
p_cmb: process(current_state, data, stat)
case current_state is
when st_idle =>
if data = "1001" then
next_state <= st_start;
next_output <= stat(0) and not stat(1);
elsif ...
...
...
end if;
when st_start =>
...
when others =>
...
end case;
end process;
to_output_port <= current_output;
He said this is the best approach for state machine coding.
I truly appreciate any comments as well as pros/cons for this approach.
Calvin