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

📄 时间扫描模块seltime.vhd.txt

📁 具有多种功能的电子钟:闹钟
💻 TXT
字号:
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
use ieee.std_logic_arith.all;
entity seltime is
port(clk1,reset:in  std_logic;
     sec,min   :in  std_logic_vector(6 downto 0);
     hour      :in  std_logic_vector(5 downto 0);
     daout     :out std_logic_vector(3 downto 0);
     dp        :out std_logic;
     sel       :out std_logic_vector(2 downto 0));
end seltime;
architecture a of seltime is
      signal count : std_logic_vector(2 downto 0);
begin
     sel<=count;
     process(clk1,reset)
          begin
           if reset='0' then
              count<="000";
              elsif(clk1'event and clk1='1' ) then
                   if (count>="101")then
                    count<="000";
                else
                count<= count+"1";
                   end if;
           end if;
      case count is
         when "000"=>daout<=sec(3 downto 0);dp<='0';
         when "001"=>daout(3)<='0';
              daout(2 downto 0)<=sec(6 downto 4);dp<='0';
         when "010"=>daout<=min(3 downto 0);dp<='1';
         when "011"=>daout(3)<='0';
              daout(2 downto 0)<=min(6 downto 4);dp<='0'; 
         when "100"=>daout<=hour(3 downto 0);dp<='1';
         when others=>daout(3 downto 2)<="00";
              daout(1 downto 0)<=hour(5 downto 4);dp<='0';
      end case;
         end process;
end a;    

⌨️ 快捷键说明

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