xhour.vhd
来自「DEMO2 数码管扫描显示电路/DEMO4 计数时钟 DEMO5 键盘扫描设计」· VHDL 代码 · 共 44 行
VHD
44 行
library IEEE;
use IEEE.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
use ieee.std_logic_arith.all;
entity xhour is
port (
clkhour: in STD_LOGIC;
reset: in STD_LOGIC;
hourout: out STD_LOGIC_VECTOR (5 downto 0)
);
end xhour;
architecture xhour_arch of xhour is
signal hour : std_logic_vector(5 downto 0);
begin
-- <<enter your statements here>>
process(reset,clkhour,hour)
alias lcount : std_logic_vector(3 downto 0) is hour(3 downto 0);
alias hcount : std_logic_vector(1 downto 0) is hour(5 downto 4);
begin
if reset='0' then
hourout<="000000";
hour<="000000";
else
if (clkhour='1' and clkhour'event) then
if lcount=9 then
lcount<="0000";
hcount<=hcount+1;
else
if hour="100011" then
hour<="000000";
else
lcount<=lcount+1;
end if;
end if;
end if;
hourout<=hour;
end if;
end process;
end xhour_arch;
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?