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

📄 sy3.vhd

📁 是一个用 maxplus2做的vhdl 很平常的课程小设计
💻 VHD
字号:
library  ieee;
use  ieee.std_logic_1164.all;
-------------------------------------------------------------------
entity  sy3  is
    port(x,clk : in std_logic;
         z : out std_logic);
end sy3;
--------------------------------------------------------------------
architecture  bev  of  sy3  is
 type state_type is (s0,s1,s2);             --定义枚举类型state_type
 signal state : state_type;                 --初值为s0
 begin 
       process(x,clk)
       begin
          if (clk'event and clk='1') then   --时钟信号上升沿触发
            case state is
              when s0=>                     --状态为s0,输出0
                z<='0';    
                if (x='0') then             --输入为0,状态变为s1
                                            --输入为1,状态不变
                  state<=s1;
                end if;
              when s1=>                     --状态为s1,输出0
                z<='0';
                if (x='1') then             --输入为1,状态变为s2
                                            --输入为0,状态不变
                  state<=s2;
                end if;
              when s2=>                     --状态为s2
                if (x='0') then             --输入为0,输出为1,状态变为s1
                  z<='1';
                  state<=s1;
                else                        --输入为1,输出为0,状态变为s0
                  z<='0';
                  state<=s0;
                end if;
            end case;
          end if;
       end process;
 end bev;

⌨️ 快捷键说明

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