我是VHDL的新手。我目前正在開發一個FSM,我希望我的狀態機只有在我的輸入發生變化時才改變狀態。我應該在下面的代碼中做出什麼改變?依賴於輸入事件的狀態轉換VHDL
entity fsm is
Port (clk : in STD_LOGIC;
reset : in STD_LOGIC;
x_in : in STD_LOGIC; -- input Bitstream
y_out : out STD_LOGIC_VECTOR (1 downto 0)); -- Encoded output
end fsm;
-----------------------------------------------------
architecture Behavioral of fsm is
-- Building an Enumerated type for the state machine
type state_type is (s_idle,s1,s2,s3,s4); -- constraint length = 3, Hence number of Regs = 2 therefore Number of states = 4
signal state, next_state: state_type ; -- Registers to hold the Present and next states
begin
-----------------------------------------------------
process1: process (reset, clk) -- Sequential Logic Selection process:
begin
if (reset ='1') then
state <=s_idle;
elsif (clk='1' and x_in'Event) then
state <= next_state;
end if;
-----------------------------------------------------
end process process1;
我編輯了你的問題,但從中間部分無法理解。您可能需要重新格式化它。 –