?? 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;
seth:in std_logic;
hour:buffer std_logic_vector(7 downto 0); --――時輸出端
Enhour:out std_logic); -- ――時計時器的進(jìn)位,用來驅(qū)動星期計時器
End;
Architecture a of hour1 is
Begin
Process(clkh,reset,set,seth)
variable h:std_logic_vector(7 downto 0);
Begin
If reset='0' then
hour<="00000000";
elsif set='1' then
if rising_edge(seth) then
if h=23 then
h:="00000000";
else
h:=h+1;
end if;
end if;
hour<=h; -- ――對時計時器清0
Elsif clkh'event and clkh='1' then
if hour=23 then
hour<="00000000";enhour<='1'; -- ――重復(fù)計數(shù)
else
hour<=hour+1;enhour<='0'; --并產(chǎn)生進(jìn)位以驅(qū)動下一級
end if;
end if;
End process;
End;
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -