这段代码是一个FSM,它是一个摩尔机器
Alyssa P. Hacker有一只蜗牛,它从纸带上爬下来,纸带上有1和0。每当蜗牛爬过的最后两个数字是01时,它就会微笑。设计蜗牛大脑的Moore和Mealy FSM。
代码如下所示
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
entity simpfsm is
Port ( A : in STD_LOGIC;
clk : in STD_LOGIC;
r : in STD_LOGIC;
Y : out STD_LOGIC);
end simpfsm;
architecture Behavioral of simpfsm is
type state_type is (SA,SB,SC);
signal state,next_state:state_type;
begin
SYNC_PROC:process(clk)
begin
if(clk'event and clk='1') then
if(r='1') then
next_state <= SA; -- removed trailing grave accent
else
state <= next_state;
end if;
end if;
end process;
OUTPUT_DECODE:process(state)
begin
case (state) is
when SA =>
Y <= '0';
when SB =>
Y <= '0';
when SC =>
Y <= '1';
when others =>
Y <= '0';
end case;
end process;
NEXT_STATE_DECODE:process(state,A)
begin
next_state <= state;
case (state) is
when SA =>
if(A='0') then
next_state <= SB;
end if;
when SB =>
if(A='1') then
next_state <= SC;
end if;
when SC =>
if(A='0') then
next_state <= SB;
elsif(A='1') then
next_state <= SA;
end if;
when others =>
next_state <= SA; --"if not state then begin with SA"
end case;
end process;
end Behavioral; -- removed trailing grave accent
错误是XSIM43-3249文件D:/Users/93443/project_4/project_4.srcs/sources_1/new/A_11_fsm.vhd,第22行。未解析的信号"next_state“被多路驱动。
发布于 2018-10-15 00:06:56
在SYNC_PROC复位时驱动Next_stat
next_state <= SA;
在NEXT_STATE_DECODE过程中也是如此。您不能从两个进程驱动它。
你还有一个额外的`没有充分的理由。这是真正的代码吗?
https://stackoverflow.com/questions/52804205
复制相似问题