基于eda的万年历设计说明_第1页
基于eda的万年历设计说明_第2页
基于eda的万年历设计说明_第3页
基于eda的万年历设计说明_第4页
基于eda的万年历设计说明_第5页
已阅读5页,还剩13页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

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 clk'event and clk='1' thenq11<=q11+1;if q11=9 then q11<=(others=>'0');q22<=q22+1;end if;if q22=2 and q11=3 then q22<="0000"q11

4、<="0000"cout<='1'else cout<='0'end if;end if;end process;q1<=q11;q2<=q22;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_logi

5、c);endt60;architecture one oft60 issignal q11,q22:std_logic_vector(3 downto 0);beginprocess(clk)beginif clk'event and clk='1' thenq11<=q11+1;if q11=9 then q11<=(others=>'0');q22<=q22+1;end if;if q22=5 and q11=9 then q22<="0000"q11<="0000"cout

6、<='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:out std_logic_vector(3 downto 0);cout:out std_logic);end day;architectu

7、re 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 clk'event and clk='1' thenq11<=q11+1;if q11=9 then q11<=(others=>'0');q22<=q22+1;end if;s1s2<=s1&s2;case s1s2 iswhen "00&quo

8、t;=>if q22=3 and q11=1 then q22<="0000"q11<="0001"cout<='1'else cout<='0'end if;when "01"=>if q22=3 and q11=0 then q22<="0000"q11<="0001"cout<='1'else cout<='0'end if;when "10"=&

9、gt;if q22=2 and q11=8 then q22<="0000"q11<="0001"cout<='1'else cout<='0'end if;when "11"=>if q22=2 and q11=9 then q22<="0000"q11<="0001"cout<='1'else cout<='0'end if;when others=>null;end

10、case;end if;end process;d1<=q11;d2<=q22;end;(4)月计数器程序与仿真图如下:library ieee;use ieee.std_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_lo

11、gic_vector(3 downto 0);signal q2q1:std_logic_vector(7 downto 0);beginprocess(clk)beginif clk'event and clk='1' thenq1<=q1+1;if q1=9 then q1<=(others=>'0');q2<=q2+1;end if;if q2=1 and q1=2 then q2<="0000"q1<="0001"cout<='1'else cout

12、<='0'end if;end if;q2q1<=q2&q1;case q2q1 is when"00000001"=>a<='0'b<='0' when"00000010"=>if run='1' then a<='1'b<='1'else a<='1'b<='0' end if; when"00000011"=>a<='

13、;0'b<='0' when"00000100"=>a<='0'b<='1' when"00000101"=>a<='0'b<='0' when"00000110"=>a<='0'b<='1' when"00000111"=>a<='0'b<='0' when"00001000&

14、quot;=>a<='0'b<='0' when"00001001"=>a<='0'b<='1' when"00010000"=>a<='0'b<='0' when"00010001"=>a<='0'b<='1' when"00010010"=>a<='0'b<='0'

15、 when others=>null;end case;end process;m1<=q1;m2<=q2;end;(5)年低两位计数器程序与仿真图如下:library ieee;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

16、 q1,q2,q3:std_logic_vector(3 downto 0);beginprocess(clk)beginif clk'event and clk='1' thenq1<=q1+1;if q1=9 then q1<=(others=>'0');q2<=q2+1;end if;if q2=9 and q1=9 then q2<="0000"q1<="0000"cout<='1'else cout<='0'end if;en

17、d if;end process;process(clk)beginif clk'event and clk='1' thenq3<=q3+1;if q3=3 then q3<=(others=>'0');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_l

18、ogic_unsigned.all;entity year1 isport(clk:in std_logic;y3,y4:out std_logic_vector(3 downto 0);run,cout:out std_logic);end year1;architecture one of year1 issignal q1,q2:std_logic_vector(3 downto 0);beginprocess(clk)beginif clk'event and clk='1' thenq1<=q1+1;if q1=9 then q1<=(others

19、=>'0');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(q1)beginif q1(1 downto 0)/="00" thenrun<='1'else run <='0'end if;y3<=q1;y4<=q2

20、;end process;end;(7)星期计数器程序与仿真图如下:library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entityt7 isport(clk:in std_logic;q1,q2:out std_logic_vector(3 downto 0);endt7;architecture one oft7 issignal q11,q22:std_logic_vector(3 downto 0);beginprocess(clk)beginif clk'event and clk=

21、'1' thenq11<=q11+1;if q11=7 then q11<="0001"end if;end if;q22<="0000"end process;q1<=q11;q2<=q22;end;(8)调节时间与实现定时程序如下:library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity tiaoshi isport(sout,fout,hout,dout,mout,yout0:in std_logic;

22、k2,k3:in std_logic;fin,hin,din,min,yin0,yin1,dingshi,win:out std_logic;q:out std_logic_vector(3 downto 0);end tiaoshi;architecture one of tiaoshi issignal w:std_logic_vector(3 downto 0);beginprocess(k2,k3)beginif k2'event and k2='1' then w<=w+1;if w=8 then w<="0000"end if

23、;end if;case w is when "0000"=>fin<=sout;hin<=fout;din<=hout;min<=dout;yin0<=mout;yin1<=yout0;dingshi<='0'win<=hout; q<="0000" when "0001"=>fin<=k3;hin<='0'din<='0'min<='0'yin0<='0'y

24、in1<='0'dingshi<='0'win<='0' q<="0001" when "0010"=>fin<='0'hin<=k3;din<='0'min<='0'yin0<='0'yin1<='0'dingshi<='0'win<='0' q<="0010"when "0011&

25、quot;=>fin<='0'hin<='0'din<='0'min<='0'yin0<='0'yin1<='0'dingshi<='0'win<=k3; q<="0011" when "0100"=>fin<='0'hin<='0'din<=k3;min<='0'yin0<='0'yi

26、n1<='0'dingshi<='0'win<='0' q<="0100" when "0101"=>fin<='0'hin<='0'din<='0'min<=k3;yin0<='0'yin1<='0'dingshi<='0'win<='0' q<="0101" when "0110&

27、quot;=>fin<='0'hin<='0'din<='0'min<='0'yin0<=k3;yin1<='0'dingshi<='0'win<='0' q<="0110" when "0111"=>fin<='0'hin<='0'din<='0'min<='0'yin0<='

28、0'yin1<=k3;dingshi<='0'win<='0' q<="0111" when "1000"=>fin<='0'hin<='0'din<='0'min<='0'yin0<='0'yin1<='0'dingshi<=k3; q<="1000" when others=>null;end case;end p

29、rocess;end;(9)切换显示状态程序如下:library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity control isport(fld,fhd,hld,hhd,sl,sh,fl,fh,hl,hh,dl,dh,ml,mh,yl,yh,yl1,yh1,wl,wh:in std_logic_vector(3 downto 0);k1:in std_logic;q1,q2,q3,q4,q5,q6,q7,q8:out std_logic_vector(3 downto 0);l1:out st

30、d_logic_vector(3 downto 0);end control;architecture one of control issignal w:std_logic_vector(1 downto 0);beginprocess(k1)begin if k1'event and k1='1' then w<=w+1;if w=2 then w<="00"end if; end if;case w iswhen"00"=>q8<=yh1;q7<=yl1;q6<=yh;q5<=yl;q4<=mh;q3<=ml;q2<=dh;q1<=dl;l1<="0000"when"01"=>q8<=wh;q7<=wl;q6<=hh;q5<=hl;q4<=fh;q3<=fl;q2<=sh;q1<=sl;l1<="0001"when"10"=>q8<=&qu

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

最新文档

评论

0/150

提交评论