?? jishuqi.vhd
字號:
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
entity jishuqi is
port (
clk : in std_logic;
en : in std_logic;
clr: in std_logic;
q :out std_logic_vector(7 downto 0);
c : out std_logic
);
end jishuqi;
architecture a of jishuqi is
signal qa:std_logic_vector(3 downto 0);
signal qb:std_logic_vector(3 downto 0);
signal cy:std_logic;
begin
process(clk,en,clr)
begin
if clr='0' then
qa<="0000";
elsif ( clk'event and clk='1') then
if en='1' then
if (qa=9) or (qa=5 and qb=1) then
qa<="0000";
cy<='0';
qa<=qa+1;
cy<='1';
else
qa<=qa+1;
cy<='0';
end if;
end if;
end if;
end process;
process(en,clk,cy,clr)
begin
if clr='0' then
qb<="0000";
elsif ( clk'event and clk='1') then
if en='1' then
if (qa=5 and qb=1) then
qb<="0000";
c<='1';
elsif cy='1' then
qb<=qb+1;
c<='0';
else
c<='0';
end if;
end if;
end if;
end process;
q(7 downto 4)<=qb;
q(3 downto 0)<=qa;
end a;
/*******************************************************************************************************************************************************************************************************************************************************************************************************************************************************
CPLD器件中常用編程,對于多進程做了很好的處理,能實現0到59計數,還可自己根據需要調整,實現多種計數功能,從而實現時分秒計時器的功能
********************************************************************************************************************************************************************************************************************************************************************************************************************************************************
*/
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -