houclock.vhd
来自「VHDL的数字钟」· VHDL 代码 · 共 31 行
VHD
31 行
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
entity houclock is
port (clk1khz, ena, clkadd: in std_logic;
dth, qth: in std_logic_vector(3 downto 0);
tf: out std_logic;
dh, qh: out std_logic_vector(3 downto 0));
end houclock;
architecture one of houclock is
signal dhf, qhf: std_logic_vector(3 downto 0);
begin
process (clk1khz,ena,clkadd,dth,qth,dhf,qhf)
begin
if ena='0' then
if rising_edge(clkadd) then
if qhf="0010" and dhf="0011" then qhf<="0000"; dhf<="0000";
elsif dhf<"1001" then dhf<=dhf+1;
elsif dhf="1001" then qhf<=qhf+1; dhf<="0000";
end if;
end if;
elsif rising_edge(clk1khz) then
if dth=dhf and qth=qhf then
tf<='1';
else tf<='0';
end if;
end if;
dh<=dhf;
qh<=qhf;
end process;
end one;
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?