?? second.vhd
字號:
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
entity SECOND is
port(clk,clr:in std_logic;----時鐘/清零信號
sec1,sec0:out std_logic_vector(3 downto 0);----秒高位/低位
co:out std_logic);-------輸出/進位信號
end SECOND;
architecture SEC of SECOND is
begin
process(clk,clr)
variable cnt1,cnt0:std_logic_vector(3 downto 0);---計數
begin
if clr='1' then----當ckr為1時,高低位均為0
cnt1:="0000";
cnt0:="0000";
elsif clk'event and clk='1' then
if cnt1="0101" and cnt0="1001" then----當記數為58(實際是經過59個記時脈沖)
co<='1';----進位
cnt0:="0000";----低位為9
cnt1:="0000";
elsif cnt0<"1001" then----小于9時
cnt0:=cnt0+1;----計數
co<='0';
else
cnt0:="0000";
if cnt1<"0101" then----高位小于5時
cnt1:=cnt1+1;
else
cnt1:="0000";
co<='0';
end if;
end if;
end if;
sec1<=cnt1;
sec0<=cnt0;
end process;
end SEC;
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -