【发布时间】:2021-07-18 03:43:18
【问题描述】:
我收集了一些 VHDL 代码来维护它,其中包含以我不熟悉的方式编写的重置。我不确定它是否有效,而且我的模拟器(Modelsim)正在发出我没想到的警告。模式示例:
process(clk, reset_n)
begin
if reset_n = '0' then
counter <= (others=>'0');
end if;
if rising_edge(clk) then
case state is
when IDLE =>
if signal_a = signal_b then
state <= DATA;
end if;
when DATA =>
state <= IDLE;
when others =>
end case;
if state = DATA then
counter <= counter + 1;
else
counter <= (others => '0');
end if;
end if;
end process;
Modelsim 警告 state、signal_a 和 signal_b“在进程中被读取但不在敏感列表中”。我不希望这样,因为它们在一个时钟块中,并且该过程对时钟很敏感。
这是异步重置的有效编码风格吗?我希望看到elsif rising_edge(clk),但请理解这会在此处与其他非重置信号(state)的混合导致问题。
【问题讨论】:
-
与您的问题无关:变量状态未在您的代码中重置,这可能会导致将来出现问题。