📄 带莫尔_米勒输出的状态机.vhd
字号:
--State Machine with Moore and Mealy outputslibrary ieee;use ieee.std_logic_1164.all;entity mealy1 is port(clk, rst: in std_logic;id: in std_logic_vector(3 downto 0);w: out std_logic;y: out std_logic_vector(1 downto 0));end mealy1;architecture archmealy1 of mealy1 istype states is (state0, state1, state2, state3, state4);signal state: states;beginmoore: process (clk, rst)beginif rst='1' thenstate <= state0;elsif (clk'event and clk='1') thencase state iswhen state0 =>if id = x"3" thenstate <= state1;elsestate <= state0;end if;when state1 =>state <= state2;when state2 =>if id = x"7" thenstate <= state3;elsestate <= state2;end if;when state3 =>if id < x"7" thenstate <= state0;elsif id = x"9" thenstate <= state4;elsestate <= state3;end if;when state4 =>if id = x"b" thenstate <= state0;elsestate <= state4;end if;end case;end if;end process;--assign moore state outputs;y <= "00" when (state=state0) else"10" when (state=state1 or state=state3) else"11";--assign mealy output;w <= '0' when (state=state3 and id < x"7") else'1';end archmealy1;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -