我的问题是关于合成状态机中使用的第一个状态。
我正在使用 Lattice iCE40 FPGA、用于仿真的 EDA Playground 和用于合成的 Lattice 的 Diamond Programmer。
在下面的示例中,我生成了一系列信号(该示例仅显示了引用状态机的行)。这在模拟中效果很好;即访问的第一个案例是sm_init_lattice
并产生所需的信号)。但是,合成版本会直接进入sm_end
并停留在那里。结果,输出信号保持低电平。
-- state machine
type t_SM_peaks is (sm_init_lattice,
sm_high_start_up, sm_low_start_up, sm_peaks, sm_end);
signal r_SM_peaks : t_SM_peaks;
p_ARRAY_INTS_STDLOG_2D : process (i_Clk) is
begin
if rising_edge(i_Clk) then
case r_SM_peaks is
when sm_init_lattice =>
...
r_SM_peaks <= sm_high_start_up;
when sm_high_start_up =>
...
r_SM_peaks <= sm_low_start_up;
when sm_low_start_up =>
...
r_SM_peaks <= sm_peaks;
when sm_peaks =>
...
r_SM_peaks <= sm_end; -- peaks completed
when sm_end =>
...
r_SM_peaks <= sm_end;
when others =>
r_SM_peaks <= sm_high_start_up;
end case;
end if;
end process p_ARRAY_INTS_STDLOG_2D;
但是,如果我进行如下更改(用“更改”表示),那么我会得到我需要的一组信号。
type t_SM_peaks is (sm_init_lattice,
sm_high_start_up, sm_low_start_up, sm_end, sm_peaks);
signal r_SM_peaks : t_SM_peaks;
p_ARRAY_INTS_STDLOG_2D : process (i_Clk) is
begin
if rising_edge(i_Clk) then
case r_SM_peaks is
when sm_init_lattice =>
...
r_SM_peaks <= sm_high_start_up;
when sm_high_start_up =>
...
r_SM_peaks <= sm_low_start_up;
when sm_low_start_up =>
...
r_SM_peaks <= sm_peaks;
when sm_peaks =>
...
r_SM_peaks <= sm_end; -- peaks completed
when sm_end =>
...
-- CHANGE - swapped 'sm_end' for 'sm_init_lattice'
--r_SM_peaks <= sm_end;
r_SM_peaks <= sm_init_lattice;
when others =>
r_SM_peaks <= sm_high_start_up;
end case;
end if;
end process p_ARRAY_INTS_STDLOG_2D;
任何人都可以解释发生了什么吗?难道我做错了什么?我会很感激任何建议。