📄 hour1.vhd
字号:
Library ieee; --计时模块
Use ieee.std_logic_1164.all;
Use ieee.std_logic_arith.all;
Use ieee.std_logic_unsigned.all;
Entity hour1 is
Port(clkh,set,reset:in std_logic;
h1,h0:in std_logic_vector(3 downto 0); --输入预置小时数
hour1,hour0:buffer std_logic_vector(3 downto 0); --输出小时显示
enday:out std_logic); --小时满24,进位,天数加1
End hour1;
Architecture one of hour1 is
Begin
Process(clkh,reset,set,h1,h0)
variable cq1,cq0: STD_LOGIC_vector( 3 downto 0);
Begin
if reset='1' then cq1:="0000"; cq0:="0000";
Elsif clkh'event and clkh='1' then
if ( cq1="0010" and cq0="0100" )then cq1:="0000"; cq0:="0000"; enday<='1'; --小时满24,返回00重复计时,进位天数加1
else enday<='0';
end if;
cq0:=cq0+1;
if cq0="1010" then cq0:="0000";cq1:=cq1+1; --小时低位满10,进位高位加1
end if;
end if;
hour1<=cq1;hour0<=cq0;
End process;
End one;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -