欢迎来到天天文库
浏览记录
ID:38107589
大小:97.00 KB
页数:5页
时间:2019-05-25
《数字时钟设计》由会员上传分享,免费在线阅读,更多相关内容在行业资料-天天文库。
1、数字时钟设计程序:小时计数器LIBRARYieee;useieee.std_logic_1164.all;useieee.std_logic_unsigned.all;ENTITYhourISPORT(clk,reset:INSTD_LOGIC;daout:outstd_logic_vector(5downto0));ENDentityhour;ARCHITECTUREfunOFhourISSIGNALcount:STD_LOGIC_VECTOR(5downto0);BEGINdaout<=count;process(clk,reset)beginif(reset='0')thencount
2、<="000000";elsif(clk'eventandclk='1')thenif(count(3downto0)="1001")thenif(count<16#24#)thencount<=count+7;elsecount<="000000";endif;elsif(count<16#24#)thencount<=count+1;elsecount<="000000";endif;endif;endprocess;endfun;分钟计数器LIBRARYieee;useieee.std_logic_1164.all;useieee.std_logic_unsigned.all;ENTI
3、TYminuteISPORT(clk,clk1,reset,sethour:INSTD_LOGIC;enhour:OUTSTD_LOGIC;daout:outstd_logic_vector(6downto0));ENDentityminute;ARCHITECTUREfunOFminuteISSIGNALcount:STD_LOGIC_VECTOR(6downto0);BEGINdaout<=count;process(clk,reset,sethour)beginif(reset='0')thencount<="0000000";elsif(sethour='0')thenenhour<
4、=clk1;elsif(clk'eventandclk='1')thenif(count(3downto0)="1001")thenif(count<16#60#)thenif(count="1011001")thenenhour<='1';count<="0000000";ELSEcount<=count+7;endif;elsecount<="0000000";endif;elsif(count<16#60#)thencount<=count+1;enhour<='0'after100ns;elsecount<="0000000";endif;endif;endprocess;ENDfu
5、n;秒钟计数器LIBRARYieee;useieee.std_logic_1164.all;useieee.std_logic_unsigned.all;ENTITYsecondISPORT(clk,reset,setmin:INSTD_LOGIC;enmin:OUTSTD_LOGIC;daout:outstd_logic_vector(6downto0));ENDentitysecond;ARCHITECTUREfunOFsecondISSIGNALcount:STD_LOGIC_VECTOR(6downto0);BEGINdaout<=count;process(clk,reset,se
6、tmin)beginif(reset='0')thencount<="0000000";elsif(setmin='0')thenenmin<=clk;elsif(clk'eventandclk='1')thenif(count(3downto0)="1001")thenif(count<16#60#)thenif(count="1011001")thenenmin<='1';count<="0000000";ELSEcount<=count+7;endif;elsecount<="0000000";endif;elsif(count<16#60#)thencount<=count+1;en
7、min<='0'after100ns;elsecount<="0000000";endif;endif;endprocess;ENDfun;时间选择程序LIBRARYieee;useieee.std_logic_1164.all;useieee.std_logic_unsigned.all;useieee.std_logic_arith.all;ENTITYseltimeISPORT(clk1,reset:I
此文档下载收益归作者所有