《基于eda的万年历设计说明》由会员分享,可在线阅读,更多相关《基于eda的万年历设计说明(27页珍藏版)》请在金锄头文库上搜索。
1、 EDA设计实验报告学校:大学专业:测控技术与仪器班级:一班:史占东辅导老师:郭敏一、设计要求:(1)、能够显示年、月、日、时、分、秒、星期;并具有闰年判断补偿功能;(2)、具有整点报时及定时功能;二、实用方法:设计中用到了6个按键,在模式5下,K1,K2,K3,K4,ZHENG,NAO;其中K1用于切换显示模式,刚开始时显示时间,按两次K1显示定时时间,再按两次K1显示日期,再按两次重新显示时间;K2用于控制中间信号W,每按下两下中间信号加一,加至8时清零,W=1时,每按两下K3键分钟加一;W=2时,每按两下K3键小时加一;W=3时,每按两下K3键星期加一;W=4时,每按两下K3键日期加一;
2、W=5时,每按两下K3键月份加一;W=6时,每按两下K3键年低两位加一;W=7时,每按两下K3键年高两位加一;W=8时,当K4=0时,每按两下K3键定时分钟加一;当K4=1时,每按两下K3键定时小时加一;按键ZHENG为整点报时的使能端;按键NAO为定时闹钟的使能端。 三、程序及仿真:(1)24进制计数器程序及仿真图如下:library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entityt24 isport(clk:in std_logic;q1,q2:out std_logic_vector(3 do
3、wnto 0);cout:out std_logic);endt24;architecture one oft24 issignal q11,q22:std_logic_vector(3 downto 0);beginprocess(clk)beginif clkevent and clk=1 thenq11=q11+1;if q11=9 then q110);q22=q22+1;end if;if q22=2 and q11=3 then q22=0000;q11=0000;cout=1;else cout=0;end if;end if;end process;q1=q11;q2=q22;
4、end;(2)60进制计数器程序及仿真图如下:library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entityt60 isport(clk:in std_logic;q1,q2:out std_logic_vector(3 downto 0);cout:out std_logic);endt60;architecture one oft60 issignal q11,q22:std_logic_vector(3 downto 0);beginprocess(clk)beginif clkevent a
5、nd clk=1 thenq11=q11+1;if q11=9 then q110);q22=q22+1;end if;if q22=5 and q11=9 then q22=0000;q11=0000;cout=1;else cout=0;end if;end if;end process;q1=q11;q2=q22;end;(3)天计数器程序及仿真图如下:library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity day isport(clk,s1,s2:in std_logic;d1,d2
6、:out std_logic_vector(3 downto 0);cout:out std_logic);end day;architecture one of day issignal q11,q22:std_logic_vector(3 downto 0);signal s1s2:std_logic_vector(1 downto 0);beginprocess(clk,s1,s2)beginif clkevent and clk=1 thenq11=q11+1;if q11=9 then q110);q22=q22+1;end if;s1s2if q22=3 and q11=1 the
7、n q22=0000;q11=0001;cout=1;else coutif q22=3 and q11=0 then q22=0000;q11=0001;cout=1;else coutif q22=2 and q11=8 then q22=0000;q11=0001;cout=1;else coutif q22=2 and q11=9 then q22=0000;q11=0001;cout=1;else coutnull;end case;end if;end process;d1=q11;d2=q22;end;(4)月计数器程序及仿真图如下:library ieee;use ieee.s
8、td_logic_1164.all;use ieee.std_logic_unsigned.all;entity month isport(clk,run:in std_logic;m1,m2:out std_logic_vector(3 downto 0);a,b,cout:out std_logic);end month;architecture one of month issignal q1,q2:std_logic_vector(3 downto 0);signal q2q1:std_logic_vector(7 downto 0);beginprocess(clk)beginif
9、clkevent and clk=1 thenq1=q1+1;if q1=9 then q10);q2=q2+1;end if;if q2=1 and q1=2 then q2=0000;q1=0001;cout=1;else cout=0;end if;end if;q2q1a=0;bif run=1 then a=1;b=1;else a=1;ba=0;ba=0;ba=0;ba=0;ba=0;ba=0;ba=0;ba=0;ba=0;ba=0;bnull;end case;end process;m1=q1;m2=q2;end;(5)年低两位计数器程序及仿真图如下:library ieee;
10、use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity year isport(clk:in std_logic;y1,y2:out std_logic_vector(3 downto 0);run,cout:out std_logic);end year;architecture one of year issignal q1,q2,q3:std_logic_vector(3 downto 0);beginprocess(clk)beginif clkevent and clk=1 thenq1=q1+1;if q
11、1=9 then q10);q2=q2+1;end if;if q2=9 and q1=9 then q2=0000;q1=0000;cout=1;else cout=0;end if;end if;end process;process(clk)beginif clkevent and clk=1 thenq3=q3+1;if q3=3 then q30);run=1;else run =0;end if;end if;y1=q1;y2=q2;end process;end;(6)年高两位计数器程序及仿真图如下:library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity year1 isport(clk:in std_logic;y3,y4:out std_logic_vector(3 downto 0);run,cou