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

📄 second.vhd

📁 该文件是用VHDL变成实现的数字钟程序
💻 VHD
字号:
library ieee; --miaojishu
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
entity second is
port(clk,reset:in std_logic;
     sec1,sec2:out std_logic_vector(3 downto 0);
     carry:out std_logic);
end;
architecture rt1 of second is
signal sec1_t,sec2_t:std_logic_vector(3 downto 0);
begin
process(clk,reset)
begin
if reset='1' then
sec1_t<="0000";
sec2_t<="0000";
elsif clk'event and clk='1' then
if sec1_t="1001" then
   sec1_t<="0000";
if sec2_t="0101" then
   sec2_t<="0000";
else
sec2_t<=sec2_t+1;
end if;
else 
sec1_t<=sec1_t+1;
end if;
if sec1_t="1001" and sec2_t="0101" then
carry<='1';
else
carry<='0';
end if;
end if;
sec1<=sec1_t;
sec2<=sec2_t;
end process;
end rt1;

⌨️ 快捷键说明

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