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

📄 hello.vhd

📁 停车场显示是日常生活中使用很平常的系统
💻 VHD
字号:
 --停车场初态,显示HELLO 
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;

entity HELLO is
  port(SysClk: in std_logic;
       Rst   : in std_logic;
	   hel1o : in std_logic;
	   cheweikong : in std_logic;
       LedMS : out std_logic_vector(7 downto 0);
       LedMR : out std_logic_vector(7 downto 0);
       LedMG : out std_logic_vector(7 downto 0);
       shumaguan : out std_logic_vector(6 downto 0)
       );
end entity;
  
architecture HELLO of HELLO is
signal CntClk:std_logic_vector(24 downto 0);  
signal State:std_logic_vector(2 downto 0); 
   
begin
 
  process(SysClk)   --分频
  begin
    if SysClk'event and SysClk='1' then
       CntClk<=CntClk+1;
    end if ;
  end process;

 
  process(CntClk(23)) --利用状态机逐帧显示HELLO
  begin
    if Rst='1' then
       State<="000"; 
    elsif CntClk(23)'event and CntClk(23)='1' then  
        State<=State+1;
         if State="111" then 
         State<="000"; 
         end if;
     end if;
  end process;
 


  process(CntClk(9 downto 7))
  begin
     case (CntClk(9 downto 7)) is
       when "000"=> LedMS<="10000000";
					if hel1o = '1' then shumaguan<="0011111";
					else shumaguan<="0000000"; end if;
       when "001"=> LedMS<="01000000";
					if hel1o = '1' then shumaguan<="0110011";
					else shumaguan<="0000000"; end if;
       when "010"=> LedMS<="00100000"; shumaguan<="0000000";
       when "011"=> LedMS<="00010000"; shumaguan<="0000000";       
       when "100"=> LedMS<="00001000"; shumaguan<="0000000";       
       when "101"=> LedMS<="00000100"; shumaguan<="0000000";       
       when "110"=> LedMS<="00000010"; shumaguan<="0000000";       
       when "111"=> LedMS<="00000001"; shumaguan<="0000000";       
     end case;
  end process;
 


  process(State, CntClk(9 downto 7))       --显示HELLO
  variable a: std_logic_vector(5 downto 0);
  begin
    a:=State & CntClk(9 downto 7);
		  LedMR<="00000000";  LedMG<="00000000";

  case a is
----------------------H,E------------------------------------------
	
      when "000000"=>if(hel1o='1' and cheweikong='1') then             
				LedMR<="11111111"; end if;
      when "000001"=>if(hel1o='1' and cheweikong='1') then   
				LedMR<="00010000"; end if;
      when "000010"=>if(hel1o='1' and cheweikong='1') then
				LedMR<="11111111"; end if;
      when "000011"=>if(hel1o='1' and cheweikong='1') then   
				LedMR<="00000000"; end if;
      when "000100"=>if(hel1o='1' and cheweikong='1') then
				LedMR<="11111111"; end if;
      when "000101"=>if(hel1o='1' and cheweikong='1') then
				LedMR<="10010001"; end if;
      when "000110"=>if(hel1o='1' and cheweikong='1') then   
				LedMR<="10010001"; end if;
      when "000111"=>if(hel1o='1' and cheweikong='1') then
				LedMR<="00000000"; end if;
----------------------L,L--------------------------------------
      when "001000"=>if(hel1o='1' and cheweikong='1') then
				LedMR<="11111111"; end if;
      when "001001"=>if(hel1o='1' and cheweikong='1') then
				LedMR<="00000001"; end if;
      when "001010"=>if(hel1o='1' and cheweikong='1') then
				LedMR<="00000001"; end if;
      when "001011"=>if(hel1o='1' and cheweikong='1') then
				LedMR<="00000000"; end if;
      when "001100"=>if(hel1o='1' and cheweikong='1') then
				LedMR<="11111111"; end if;
      when "001101"=>if(hel1o='1' and cheweikong='1') then
				LedMR<="00000001"; end if;
      when "001110"=>if(hel1o='1' and cheweikong='1') then
				LedMR<="00000001"; end if;
	  when "001111"=>if(hel1o='1' and cheweikong='1') then
				LedMR<="00000000"; end if;
----------------------O,H---------------------------------------				
      when "010000"=>if(hel1o='1' and cheweikong='1') then
				LedMR<="11111111"; end if;
      when "010001"=>if(hel1o='1' and cheweikong='1') then
				LedMR<="10000001"; end if;
      when "010010"=>if(hel1o='1' and cheweikong='1') then
				LedMR<="11111111"; end if;
	  when "010011"=>if(hel1o='1' and cheweikong='1') then
				LedMR<="00000000"; end if;
      when "010100"=>if(hel1o='1' and cheweikong='1') then
				LedMR<="11111111"; end if;
      when "010101"=>if(hel1o='1' and cheweikong='1') then
				LedMR<="00010000"; end if;
      when "010110"=>if(hel1o='1' and cheweikong='1') then
				LedMR<="11111111"; end if;
      when "010111"=>if(hel1o='1' and cheweikong='1') then
				LedMR<="00000000"; end if;
----------------------E,L---------------------------------------
      when "011000"=>if(hel1o='1' and cheweikong='1') then
				LedMR<="11111111"; end if; 
      when "011001"=>if(hel1o='1' and cheweikong='1') then
				LedMR<="10010001"; end if;
      when "011010"=>if(hel1o='1' and cheweikong='1') then
				LedMR<="10010001"; end if;
      when "011011"=>if(hel1o='1' and cheweikong='1') then
				LedMR<="00000000"; end if;
      when "011100"=>if(hel1o='1' and cheweikong='1') then
				LedMR<="11111111"; end if;
      when "011101"=>if(hel1o='1' and cheweikong='1') then
				LedMR<="00000001"; end if;
      when "011110"=>if(hel1o='1' and cheweikong='1') then
				LedMR<="00000001"; end if;
      when "011111"=>if(hel1o='1' and cheweikong='1') then
				LedMR<="00000000"; end if;
---------------------L,O--------------------------------------			
      when "100000"=>if(hel1o='1' and cheweikong='1') then
				LedMR<="11111111"; end if; 
      when "100001"=>if(hel1o='1' and cheweikong='1') then
				LedMR<="00000001"; end if;
      when "100010"=>if(hel1o='1' and cheweikong='1') then
				LedMR<="00000001"; end if;
      when "100011"=>if(hel1o='1' and cheweikong='1') then
				LedMR<="00000000"; end if;
      when "100100"=>if(hel1o='1' and cheweikong='1') then
				LedMR<="11111111"; end if;
      when "100101"=>if(hel1o='1' and cheweikong='1') then
				LedMR<="10000001"; end if;
      when "100110"=>if(hel1o='1' and cheweikong='1') then
				LedMR<="11111111"; end if;
      when "100111"=>if(hel1o='1' and cheweikong='1') then
				LedMR<="00000000"; end if;
----------------------H,E--------------------------------------
      when "101000"=>if(hel1o='1' and cheweikong='1') then
				LedMR<="11111111"; end if; 
      when "101001"=>if(hel1o='1' and cheweikong='1') then
				LedMR<="00010001"; end if; 
      when "101010"=>if(hel1o='1' and cheweikong='1') then
				LedMR<="11111111"; end if;
      when "101011"=>if(hel1o='1' and cheweikong='1') then
				LedMR<="00000000"; end if;
      when "101100"=>if(hel1o='1' and cheweikong='1') then
				LedMR<="11111111"; end if;
      when "101101"=>if(hel1o='1' and cheweikong='1') then
				LedMR<="10010001"; end if; 
      when "101110"=>if(hel1o='1' and cheweikong='1') then
				LedMR<="10010001"; end if; 
      when "101111"=>if(hel1o='1' and cheweikong='1') then
				LedMR<="00000000"; end if;
----------------------L,L--------------------------------------
      when "110000"=>if(hel1o='1' and cheweikong='1') then
				LedMR<="11111111"; end if; 
      when "110001"=>if(hel1o='1' and cheweikong='1') then
				LedMR<="00000001"; end if; 
      when "110010"=>if(hel1o='1' and cheweikong='1') then
				LedMR<="00000001"; end if;
      when "110011"=>if(hel1o='1' and cheweikong='1') then
				LedMR<="00000000"; end if;
      when "110100"=>if(hel1o='1' and cheweikong='1') then
				LedMR<="11111111"; end if;
      when "110101"=>if(hel1o='1' and cheweikong='1') then
				LedMR<="00000001"; end if; 
      when "110110"=>if(hel1o='1' and cheweikong='1') then
				LedMR<="00000001"; end if; 
      when "110111"=>if(hel1o='1' and cheweikong='1') then
				LedMR<="00000000"; end if;
----------------------O--------------------------------------
      when "111000"=>if(hel1o='1' and cheweikong='1') then
				LedMR<="11111111"; end if; 
      when "111001"=>if(hel1o='1' and cheweikong='1') then
				LedMR<="10000001"; end if; 
      when "111010"=>if(hel1o='1' and cheweikong='1') then
				LedMR<="11111111"; end if;
      when "111011"=>if(hel1o='1' and cheweikong='1') then
				LedMR<="00000000"; end if;
      when "111100"=>if(hel1o='1' and cheweikong='1') then
				LedMR<="00000000"; end if;
      when "111101"=>if(hel1o='1' and cheweikong='1') then
				LedMR<="00000000"; end if; 
      when "111110"=>if(hel1o='1' and cheweikong='1') then
				LedMR<="00000000"; end if; 
      when "111111"=>if(hel1o='1' and cheweikong='1') then
				LedMR<="00000000"; end if;

	  when others=>LedMR<="00000000";  

      end case;

  end process;
end HELLO;

⌨️ 快捷键说明

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