带同步复位的状态机.vhd

来自「含有各类寄存器」· VHDL 代码 · 共 45 行

VHD
45
字号
--State Machine with Asynchronous Resetlibrary ieee;use ieee.std_logic_1164.all;entity stmch1 isport(clk, in1, rst: in std_logic; out1: out std_logic);end stmch1;architecture behave of stmch1 istype state_values is (sx, s0, s1);signal state, next_state: state_values;beginprocess (clk, rst)beginif rst = '1' thenstate <= s0;elsif rising_edge(clk) thenstate <= next_state;end if;end process;process (state, in1)begin-- set defaults for output and stateout1 <= '0';next_state <= sx; -- catch missing assignments to next_statecase state iswhen s0 =>if in1 = '0' thenout1 <='1';next_state <= s1;elseout1 <= '0';next_state <= s0;end if;when s1 =>if in1 = '0' thenout1 <='0';next_state <= s0;elseout1 <= '1';next_state <= s1;end if;when sx =>next_state <= sx;end case;end process;end behave;

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?