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

📄 scan.vhd

📁 VHDL多功能时钟设计~~24小时制~带闹钟
💻 VHD
字号:
library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity scan is   port(hou1,hou0,min1,min0,sec1,sec0:in std_logic_vector(3 downto 0);        nia1,nia0,yue1,yue0,ri1,ri0:in std_logic_vector(3 downto 0);        pmi1,pmi0,pse1,pse0,pus1,pus0:in std_logic_vector(3 downto 0);        nho1,nho0,nmi1,nmi0:in std_logic_vector(3 downto 0);        clk1khz, bm, cho:in std_logic;        num:out std_logic_vector(3 downto 0);        sel:out std_logic_vector(2 downto 0));end scan;architecture one of scan is  signal count:std_logic_vector(2 downto 0);signal bmi,choi:std_logic_vector(1 downto 0);signal ms,chos: integer range 0 to 3;  begin  process(clk1khz,bm,cho,ms,chos)   begin    if ms<4 then     if rising_edge(bm) then ms<=ms+1;     end if;    else ms<=0;    end if;     case ms is      when 0=>       if chos<4 then       if rising_edge(cho) then chos<=chos+1;       end if;       else chos<=0;       end if;       if rising_edge(clk1khz) then       case chos is        when 0=>        case count is         when "000"=>num<=sec0;sel<="000";count<="001";         when "001"=>num<=sec1;sel<="001";count<="010";         when "010"=>num<=min0;sel<="011";count<="011";         when "011"=>num<=min1;sel<="100";count<="100";         when "100"=>num<=hou0;sel<="110";count<="101";         when "101"=>num<=hou1;sel<="111";count<="000";         when others=>null;        end case;        when 1=>        case count is         when "000"=>num<="1111";sel<="000";count<="001";         when "001"=>num<="1111";sel<="001";count<="010";         when "010"=>num<="1111";sel<="011";count<="011";         when "011"=>num<="1111";sel<="100";count<="100";         when "100"=>num<=hou0;sel<="110";count<="101";         when "101"=>num<=hou1;sel<="111";count<="000";         when others=>null;        end case;        when 2=>        case count is         when "000"=>num<="1111";sel<="000";count<="001";         when "001"=>num<="1111";sel<="001";count<="010";         when "010"=>num<=min0;sel<="011";count<="011";         when "011"=>num<=min1;sel<="100";count<="100";         when "100"=>num<=hou0;sel<="110";count<="101";         when "101"=>num<=hou1;sel<="111";count<="000";         when others=>null;        end case;        when 3=>        case count is         when "000"=>num<=sec0;sel<="000";count<="001";         when "001"=>num<=sec1;sel<="001";count<="010";         when "010"=>num<=min0;sel<="011";count<="011";         when "011"=>num<=min1;sel<="100";count<="100";         when "100"=>num<=hou0;sel<="110";count<="101";         when "101"=>num<=hou1;sel<="111";count<="000";         when others=>null;        end case;        when others=>null;       end case;      end if;      when 1=>       if chos<4 then       if rising_edge(cho) then chos<=chos+1;       end if;       else chos<=0;       end if;       if rising_edge(clk1khz) then       case chos is        when 0=>        case count is         when "000"=>num<=ri0;sel<="000";count<="001";         when "001"=>num<=ri1;sel<="001";count<="010";         when "010"=>num<=yue0;sel<="011";count<="011";         when "011"=>num<=yue1;sel<="100";count<="100";         when "100"=>num<=nia0;sel<="110";count<="101";         when "101"=>num<=nia1;sel<="111";count<="000";         when others=>null;        end case;        when 1=>        case count is         when "000"=>num<="1111";sel<="000";count<="001";         when "001"=>num<="1111";sel<="001";count<="010";         when "010"=>num<="1111";sel<="011";count<="011";         when "011"=>num<="1111";sel<="100";count<="100";         when "100"=>num<=nia0;sel<="110";count<="101";         when "101"=>num<=nia1;sel<="111";count<="000";         when others=>null;        end case;        when 2=>        case count is         when "000"=>num<="1111";sel<="000";count<="001";         when "001"=>num<="1111";sel<="001";count<="010";         when "010"=>num<=yue0;sel<="011";count<="011";         when "011"=>num<=yue1;sel<="100";count<="100";         when "100"=>num<=nia0;sel<="110";count<="101";         when "101"=>num<=nia1;sel<="111";count<="000";         when others=>null;        end case;        when 3=>        case count is         when "000"=>num<=ri0;sel<="000";count<="001";         when "001"=>num<=ri1;sel<="001";count<="010";         when "010"=>num<=yue0;sel<="011";count<="011";         when "011"=>num<=yue1;sel<="100";count<="100";         when "100"=>num<=nia0;sel<="110";count<="101";         when "101"=>num<=nia1;sel<="111";count<="000";         when others=>null;        end case;        when others=>null;       end case;      end if;      when 2=>      if rising_edge(clk1khz) then       case count is        when "000"=>num<=pus0;sel<="000";count<="001";        when "001"=>num<=pus1;sel<="001";count<="010";        when "010"=>num<=pse0;sel<="011";count<="011";        when "011"=>num<=pse1;sel<="100";count<="100";        when "100"=>num<=pmi0;sel<="110";count<="101";        when "101"=>num<=pmi1;sel<="111";count<="000";        when others=>null;       end case;      end if;      when 3=>       if rising_edge(clk1khz) then       case count is        when "000"=>num<="1111";sel<="000";count<="001";        when "001"=>num<="1111";sel<="001";count<="010";        when "010"=>num<=nmi0;sel<="011";count<="011";        when "011"=>num<=nmi1;sel<="100";count<="100";        when "100"=>num<=nho0;sel<="110";count<="101";        when "101"=>num<=nho1;sel<="111";count<="000";        when others=>null;       end case;       end if;      when others=>null;     end case;end process;end;

⌨️ 快捷键说明

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