当前位置:首页 > (完整版)基于FPGA的电子时钟毕业设计论文
outclk<='1'; end if;
end if; end if;
end process; end one;
附录2:时间计数器
附录2.1:六十进制计数器
library ieee;
use ieee.std_logic_1164.all; use ieee.std_logic_unsigned.all; entity second is
port(enl,res,clk,sadd,sdec:in std_logic; a,b:out std_logic_vector(3 downto 0); ca:out std_logic); end second;
--enl使能 --res清零--clk时钟--sadd加--sdec减--a低位--b高位--ca进位 architecture SEC of second is begin
process(enl,clk,res)
variable m0,m1:std_logic_vector(3 downto 0); begin
if res='1' then m0:=\
m1:=\ ca<='0'; elsif clk'event and clk='1' then ca<='0';
if sadd='1' or enl='1' then
if m0=\ --实际是第59个--脉冲 end if;
if m0<\
else m0:=\ m1:=m1+1;
if m1>\ m1:=\ ca<='0'; end if; end if;
elsif sdec='1' then
if m0=\ m1:=\
elsif m0>\ else m0:=\ m1:=m1-1; end if; end if; end if;
a<=m0; b<=m1; end process; end SEC;
附录2.1:二十四进制计数器
library ieee;
use ieee.std_logic_1164.all; use ieee.std_logic_unsigned.all; entity std_logic;
a,b:out std_logic_vector(3 downto 0); ca:out std_logic); end
process(enl,clk,res)
variable m0,m1:std_logic_vector(3 downto 0); begin
if res='1' then m0:=\ m1:=\ ca<='0'; elsif clk'event and clk='1' then ca<='0'; if
if m0=\
m0:=\
m1:=\
end if;
if m0<\
else m0:=\ m1:=m1+1; end if; elsif
if m0=\
m1:=\
elsif m0>\
else m0:=\ m1:=m1-1;
end if;
end if; end if; a<=m0; b<=m1; end process; end SEC;
附录3:日期计数器
附录3.1:天计数器
library ieee;
use ieee.std_logic_1164.all; use ieee.std_logic_unsigned.all;
共分享92篇相关文档