基于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;entity cnt24 isport(clk:in std_logic;q1,q2:out std_logic_vecto

3、r(3 downto 0);cout:out std_logic);end cnt24;architecture one of cnt24 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

4、=q11;q2=q22;end;(2)60进制计数器程序及仿真图如下:library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity cnt60 isport(clk:in std_logic;q1,q2:out std_logic_vector(3 downto 0);cout:out std_logic);end cnt60;architecture one of cnt60 issignal q11,q22:std_logic_vector(3 downto 0);beginprocess(c

5、lk)beginif clkevent and 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,

6、s2:in std_logic;d1,d2: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;s1s2i

7、f q22=3 and q11=1 then 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)月计数器程序及仿真图如下:li

8、brary 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_logic_vector(3 downto 0);signal q2q1:std_logic_vector(7 downto 0);begi

9、nprocess(clk)beginif 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)年低两位计数器程

10、序及仿真图如下: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 q1,q2,q3:std_logic_vector(3 downto 0);beginprocess(clk)beginif clkevent and c

11、lk=1 thenq1=q1+1;if q1=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 ie

12、ee.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,cout:out std_logic);end year1;architecture one of year1 issignal q1,q2:std_logic_vector(3 downto 0);beginprocess(clk)beginif clkevent and clk=1 thenq1=q1+1;if q1=9 th

13、en 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(q1)beginif q1(1 downto 0)/=00 thenrun=1;else run =0;end if;y3=q1;y4=q2;end process;end;(7)星期计数器程序及仿真图如下:library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity cn

14、t7 isport(clk:in std_logic;q1,q2:out std_logic_vector(3 downto 0);end cnt7;architecture one of cnt7 issignal q11,q22:std_logic_vector(3 downto 0);beginprocess(clk)beginif clkevent and clk=1 thenq11=q11+1;if q11=7 then q11=0001;end if;end if;q22=0000;end process;q1=q11;q2=q22;end;(8)调节时间及实现定时程序如下:lib

15、rary 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;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_log

16、ic_vector(3 downto 0);beginprocess(k2,k3)beginif k2event and k2=1 then w=w+1;if w=8 then wfin=sout;hin=fout;din=hout;min=dout;yin0=mout;yin1=yout0;dingshi=0;win=hout; qfin=k3;hin=0;din=0;min=0;yin0=0;yin1=0;dingshi=0;win=0; qfin=0;hin=k3;din=0;min=0;yin0=0;yin1=0;dingshi=0;win=0; qfin=0;hin=0;din=0;

17、min=0;yin0=0;yin1=0;dingshi=0;win=k3; qfin=0;hin=0;din=k3;min=0;yin0=0;yin1=0;dingshi=0;win=0; qfin=0;hin=0;din=0;min=k3;yin0=0;yin1=0;dingshi=0;win=0; qfin=0;hin=0;din=0;min=0;yin0=k3;yin1=0;dingshi=0;win=0; qfin=0;hin=0;din=0;min=0;yin0=0;yin1=k3;dingshi=0;win=0; qfin=0;hin=0;din=0;min=0;yin0=0;yi

18、n1=0;dingshi=k3; qnull;end case;end process;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 s

19、td_logic_vector(3 downto 0);l1:out std_logic_vector(3 downto 0);end control;architecture one of control issignal w:std_logic_vector(1 downto 0);beginprocess(k1)begin if k1event and k1=1 then w=w+1;if w=2 then wq8=yh1;q7=yl1;q6=yh;q5=yl;q4=mh;q3=ml;q2=dh;q1=dl;l1q8=wh;q7=wl;q6=hh;q5=hl;q4=fh;q3=fl;q2=sh;q1=sl;l1q8=0000;q7=0000;q6=0000;q5=0000;q4=hhd;q3=hld;q2=fhd;q1=fld;l1null;end case;end process;end;(10)闹钟控制程序如下:library ieee;use ieee.std_l

温馨提示

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

评论

0/150

提交评论