minute.vhd
来自「VHDL编写的数字钟」· VHDL 代码 · 共 69 行
VHD
69 行
-----------------------------------------------------
--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 minute is
port (clk : in std_logic;
m_overflow: out std_logic;
m_dspl : out std_logic_vector(3 downto 0);
m_dsph : out std_logic_vector(3 downto 0) );
end ;
architecture behav of minute is
signal sec1: std_logic_vector(3 downto 0);
signal sec2 : std_logic_vector(3 downto 0);
begin
---------------------------------------------minute high bit
s1:process(clk,sec1)
begin
if clk'event and clk='1' then
if (sec1="0101" and sec2="1001")then
sec1<="0000";
else if sec2="1001"then
sec1<=sec1+1;
end if;
end if;
end if;
if sec1 = 5 then m_overflow<='1';
else m_overflow<='0';
end if;
m_dsph<=sec1;
end process s1;
--------------------------------------------minute low bit
s2:process(clk,sec2)
begin
if clk'event and clk='1' then
if sec2="1001" then
sec2<="0000";
else sec2<=sec2+1;
end if;
end if;
m_dspl<=sec2;
end process s2;
end;
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?