|
大家过来帮忙看看这个状态机
这几天我在调试一个状态机的时候碰到一些问题:
程序部分vhdl代码如下:
............................
.........................................
UC_SM_REGS: process (clk, reset)
begin
if reset = RESET_ACTIVE then
fft_state <= IDLE;
elsif clk'event and clk = '1' then
fft_state <= fft_next_state;
end if;
end process;
fft_process1: process(clk_os, reset, result_rd_start, fft_state, outdataen)
begin
if reset = RESET_ACTIVE then
fft_next_state <= IDLE;
ch0_rd_clk_en <= '0';
ch0_rd_addr <= "1111111111";
result_data_tmp <= "ZZZZZZZZZZZZZZZZ";
else
ch0_rd_clk_en <= '0';
fft_start <= '0';
case fft_state is
when IDLE=>
if result_rd_start = '1' then 由另外一个状态机产生result_rd-start信号 fft_start <= '1';
end if;
if fft_start = '1' then
fft_next_state <= CLK_EN;
end if;
when CLK_EN =>
fft_start <= '1';
ch0_rd_addr <= ch0_rd_addr + 1;
if clk_os = '0' then
ch0_rd_clk_en <= '1';
fft_next_state <= IO_HANDLE;
end if;
when IO_HANDLE =>
ch0_rd_clk_en <= '1';
if clk_os = '1' then
result_data_tmp <= ch0_data_out;
fft_next_state <= FFT_PROCESS;
end if;
when FFT_PROCESS=>
fft_next_state <= SAVE_DATA;
when SAVE_DATA=>
fft_next_state <= CLK_END;
when CLK_END =>
if clk = '1' then
fft_next_state <= IDLE;
end if;
when others =>
fft_next_state <= IDLE;
end case;
end if;
end process;
.............................
在用modelsim做时序仿真时发现状态机的状态在reset之后一个时钟时就变为unknown状态, 之后一直是unknown状态,状态机一直无法工作 ,下板看时也是这个情况
我用的是lattice的fpga ,状态机的functional simulation 是正确的,综合工具是synplify,开发环境isplevel6.0
工作频率是40MHz,
希望大家踊跃讨论,给兄弟一些启发和提示,谢谢
我是新手
[em13] |
|