⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 statemachine2.vhd

📁 自己做的一个关于more状态机的三种描述的比较。以后会有更多的资料
💻 VHD
字号:
---双进程状态机,我想做个比较,与单进程和三进程的状态机的区别。
--moore statemachine ,
--input 
--  reset
--  din
--output 
--  op
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
use ieee.std_logic_arith.all;
---------------------------------------------
entity statemachine2 is
  port( clk,reset,din: in std_logic;
        op: out std_logic
      );
end statemachine2;
-----------------------------------
architecture pyy of statemachine2 is
  type state is (s0,s1,s2,s3);    --state type declare;
  signal current_state : state;
  signal next_state: state;
begin
	process(clk,reset)
	begin
		if reset='1'then
			current_state<=s0;
	    elsif rising_edge(clk) then
	    	current_state<=next_state;
	    end if;
	end process;
	
	process(din,current_state)
		begin
	        case current_state is
				when s0=>	if  din='0' then
				            	next_state<=s0;
				            else
								next_state<=s1;
						    end if;
						    op<='0';
				when s1=>	if din='0' then
								next_state<=s2;
						    else 
						        next_state<=s1;
						    end if;
							op<='1';
				when s2=>	if  din='0' then
				            	next_state<=s3;
				            else
								next_state<=s2;
						    end if;
						    op<='0';
				when s3=>	if din='0' then
								next_state<=s1;
						    else 
						        next_state<=s0;
						    end if;
							op<='0';
			end case;
	end process;
end pyy;
					

⌨️ 快捷键说明

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