manualswitch.vhd

来自「此为用VHDL编写的可实现动感图像的点阵」· VHDL 代码 · 共 45 行

VHD
45
字号
library ieee;
use  ieee.std_logic_1164.all;
use  ieee.std_logic_signed.all;
entity manualswitch  is
      port(
            clk:in std_logic;
            key: in std_logic;
            en:out std_logic_vector(1 downto 0)
            );
end manualswitch;
architecture  behavor  of manualswitch is
      signal cp:std_logic;
      signal jsp:integer  range 0 to 5;
      signal count: std_logic_vector(1 downto 0):="00";
      begin
process(clk)
      begin
 if(clk'event and clk='1')then
       if(key='1') then
              if jsp=5  then
                jsp<=jsp;
              else
                 jsp<=jsp+1;
              end if;
           end if;
       if (jsp>=4 and key='0' ) then
              cp<='1';jsp<=0;
          else
               cp<='0';
        end if;
end if;

end process;
process(cp)
begin
     if(cp'event and cp='1')then
              count<=count+1;
     else
              count<=count;
     end if;
     en<=count;
end process;
end behavor;

⌨️ 快捷键说明

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