电子钟vhdl设计
电子钟vhdl设计
标签/分类:
1.系统设计要求
(1)具有时、分、秒计数显示功能,小时为24进制,分钟和秒为60进制。
(2)可以根据需要设置复位、清零、置位等功能。
2.系统设计方案概述
根据系统设计要求,系统设计采用自顶向下设计方法,由秒计数模块、分计数模块、时计数模块、时间设置模块和译码模块五部分组成。
3.参考vhdl源程序
(1)秒计数模块的vhdl源程序(second.vhd)
libraryieee;
useieee.std_logic_1164.all;
useieee.std_logic_unsigned.all;
entitysecondis
port(clk,reset,semin:instd_logic;
enmin:outstd_logic;
daout:outstd_logic_vector(6downto0));
endsecond;
architecturertlofsecondis
signalcount:std_logic_vector(6downto0);
signalenmin_1,enmin_2:std_logic;
begin
daout<=count;
enmin_2<=(seminandclk);
enmin<=(enmin_1orenmin_2);
process(clk,reset,semin)
begin
if(reset='0')then
count<=0000000;
enmin_1then
if(countthen
enmin_1<='1';count<=0000000;
else
count<=count+7;
endif;
else
count<=0000000;
endif;
elsif(count<16#60#)then
count<=count+1;
enmin_1<='0';
else
count<=0000000;enmin_1<='0';
endif;
endif;
endprocess;
endrtl;
仿真:
(2)分计数模块vhdl程序(minute.vhd)
libraryieee;
useieee.std_logic_1164.all;
useieee.std_logic_unsigned.all;
entityminuteis
port(clk,reset,clks,sethour:instd_logic;
enhour:outstd_logic;
daout:outstd_logic_vector(6downto0));
endminute;
architecturertlofminuteis
signalcount:std_logic_vector(6downto0);
signalenhour_1,enhour_2:std_logic;
begin
daout<=count;
enhour_2<=(sethourandclk);
enhour<=(enhour_1orenhour_2);
process(clk,reset,sethour)
begin
if(reset='0')then
count<=0000000;
enhour_1then
if(countthen
enhour_1<='1';count<=0000000;
else
count<=count+7;
enhour_1<='0';
endif;
else
count<=0000000;
endif;
elsif(count<16#60#)then
count<=count+1;
enhour_1<='0'after100ns;
else
count<=0000000;enhour_1<='0';
endif;
endif;
endprocess;
endrtl;
仿真
(3)时计数模块vhdl源程序(hour.vhd)
libraryieee;
useieee.std_logic_1164.all;
useieee.std_logic_unsigned.all;
entityhouris
port(clk,reset:instd_logic;
daout:outstd_logic_vector(5downto0));
endhour;
architecturertlofhouris
signalcount:std_logic_vector(5downto0);
begin
daout<=count;
process(clk,reset)
begin
if(reset='0')then
countthen
if(count<16#23#)then
count<=count+7;
else
count<=000000;
endif;
elsif(count<16#23#)then
count<=count+1;
else
countthen
count<=000;
else
count<=count+1;
endif;
endif;
endprocess;
process(clk,reset)
begin
if(reset='0')then
daout<=0000;
dp<='0';
seldaout<=sec(3downto0);
dp<='0';
seldaout(3)<='0';
daout(2downto0)<=sec(6downto4);
dp<='0';
seldaout<=min(3downto0);
dp<='1';
seldaout(3)<='0';
daout(2downto0)<=min(6downto4);
dp<='0';
seldaout<=hour(3downto0);
dp<='1';
seldaout(3downto2)<=00;
daout(1downto0)<=hour(5downto4);
dp<='0';
seldaout<=0000;
dp<='0';
sel<=111111;
endcase;
endif;
endprocess;
endrtl;
仿真
(5)译码显示模块的vhdl程序(deled.vhd)
libraryieee;
useieee.std_logic_1164.all;
useieee.std_logic_unsigned.all;
entitydeledis
port(num:instd_logic_vector(3downto0);
led:outstd_logic_vector(6downto0));
enddeled;
architecturertlofdeledis
begin
led<=1111110whennum=0000else
0110000whennum=0001else
1101101whennum=0010else
1111001whennum=0011else
0110011whennum=0100else
1011011whennum=0101else
1011111whennum=0110else
1110000whennum=0111else
1111111whennum=1000else
1111011whennum=1001else
1110111whennum=1010else
0011111whennum=1011else
1001110whennum=1100else
0111101whennum=1101else
1001111whennum=1110else
1000111whennum=1111;
endrtl;
诺思推出两款超大带宽高频ICBAR滤波芯片
长沙磁悬浮快线正式提速运营
会做中餐的机器人诞生了;会做300多道中国菜
【白皮书】使用 Sigrity X 对 DDR5 应用进行兼顾电源影响的信号完整性分析
Anydesk灵活的远程访问软件
电子钟VHDL设计
外媒验证:拍照方面,iPhone XS仍领先于一众Android旗舰竞品
人生地不熟的高通 中国之旅如今怎样了?
MIT评选出全球10大突破性技术!
涤纶电容需要SGS认证吗?
AR技术如何革新制造业
电解电容器使用注意事项
特斯拉推出自动驾驶计划迎战英伟达
德州仪器推出四款全新易电源电源管理集成电路
电源测试:电源设计的噪声测量
英特尔Xeon Phi™编译"(编译7第5部分)
沐天思考 | 成长之路(5):走出瓶颈
矩形接插件、圆形接插件结构与用途
石墨烯研发再获突破 高端产业化应用将提速
区块链“无币化”_“无币化”正在成为国内区块链技术合规化发展的路径