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

📄 hour.vhd

📁 VHDL编写的数字钟
💻 VHD
字号:
-----------------------------------------------------
--author:  Suntion Tang  Weixuan Yuan
--date:    2008-5-15 to  5-20
--modify:  By suntion Tang
-----------------------------------------------------


library ieee;
use ieee.std_logic_1164.all; 
use ieee.std_logic_unsigned.all;
entity hour is
    port (clk : in std_logic;                     
          h_overflow: out std_logic;                                     
          h_dspl : out std_logic_vector(3 downto 0);  
          h_dsph : out std_logic_vector(3 downto 0) );          
   end ;
architecture behav of hour is 
    signal sec1: std_logic_vector(3 downto 0); 
    signal sec2 : std_logic_vector(3 downto 0); 
begin
---------------------------------------------hour high bit

s1:process(clk,sec1,sec2)

begin

if clk'event and clk='1' then

if (sec1="0010" and sec2="0011")then

sec1<="0000";

else if sec2="1001"then

sec1<=sec1+1;

end if;

end if;
end if;
         if (sec1="0010" and sec2="0011") then h_overflow<='1';
           else h_overflow<='0';
         end if;
  h_dsph<=sec1;

end process s1;

--------------------------------------------hour low bit

s2:process(clk,sec2,sec1)

begin

if clk'event and clk='1' then

if (sec2="1001" or (sec1="0010" and sec2="0011")) then sec2<="0000" ;


else sec2<=sec2+1;

end if;
end if;
  h_dspl<=sec2;
end process s2;

end;

⌨️ 快捷键说明

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