您好,欢迎访问三七文档
当前位置:首页 > 电子/通信 > 综合/其它 > 基于eda的万年历设计
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键日期加一;W=5时,每按两下K3键月份加一;W=6时,每按两下K3键年低两位加一;W=7时,每按两下K3键年高两位加一;W=8时,当K4=0时,每按两下K3键定时分钟加一;当K4=1时,每按两下K3键定时小时加一;按键ZHENG为整点报时的使能端;按键NAO为定时闹钟的使能端。三、程序及仿真:(1)24进制计数器程序及仿真图如下:libraryieee;useieee.std_logic_1164.all;useieee.std_logic_unsigned.all;entitycnt24isport(clk:instd_logic;q1,q2:outstd_logic_vector(3downto0);cout:outstd_logic);endcnt24;architectureoneofcnt24issignalq11,q22:std_logic_vector(3downto0);beginprocess(clk)beginifclk'eventandclk='1'thenq11=q11+1;ifq11=9thenq11=(others='0');q22=q22+1;endif;ifq22=2andq11=3thenq22=0000;q11=0000;cout='1';elsecout='0';endif;endif;endprocess;q1=q11;q2=q22;end;(2)60进制计数器程序及仿真图如下:libraryieee;useieee.std_logic_1164.all;useieee.std_logic_unsigned.all;entitycnt60isport(clk:instd_logic;q1,q2:outstd_logic_vector(3downto0);cout:outstd_logic);endcnt60;architectureoneofcnt60issignalq11,q22:std_logic_vector(3downto0);beginprocess(clk)beginifclk'eventandclk='1'thenq11=q11+1;ifq11=9thenq11=(others='0');q22=q22+1;endif;ifq22=5andq11=9thenq22=0000;q11=0000;cout='1';elsecout='0';endif;endif;endprocess;q1=q11;q2=q22;end;(3)天计数器程序及仿真图如下:libraryieee;useieee.std_logic_1164.all;useieee.std_logic_unsigned.all;entitydayisport(clk,s1,s2:instd_logic;d1,d2:outstd_logic_vector(3downto0);cout:outstd_logic);endday;architectureoneofdayissignalq11,q22:std_logic_vector(3downto0);signals1s2:std_logic_vector(1downto0);beginprocess(clk,s1,s2)beginifclk'eventandclk='1'thenq11=q11+1;ifq11=9thenq11=(others='0');q22=q22+1;endif;s1s2=s1&s2;cases1s2iswhen00=ifq22=3andq11=1thenq22=0000;q11=0001;cout='1';elsecout='0';endif;when01=ifq22=3andq11=0thenq22=0000;q11=0001;cout='1';elsecout='0';endif;when10=ifq22=2andq11=8thenq22=0000;q11=0001;cout='1';elsecout='0';endif;when11=ifq22=2andq11=9thenq22=0000;q11=0001;cout='1';elsecout='0';endif;whenothers=null;endcase;endif;endprocess;d1=q11;d2=q22;end;(4)月计数器程序及仿真图如下:libraryieee;useieee.std_logic_1164.all;useieee.std_logic_unsigned.all;entitymonthisport(clk,run:instd_logic;m1,m2:outstd_logic_vector(3downto0);a,b,cout:outstd_logic);endmonth;architectureoneofmonthissignalq1,q2:std_logic_vector(3downto0);signalq2q1:std_logic_vector(7downto0);beginprocess(clk)beginifclk'eventandclk='1'thenq1=q1+1;ifq1=9thenq1=(others='0');q2=q2+1;endif;ifq2=1andq1=2thenq2=0000;q1=0001;cout='1';elsecout='0';endif;endif;q2q1=q2&q1;caseq2q1iswhen00000001=a='0';b='0';when00000010=ifrun='1'thena='1';b='1';elsea='1';b='0';endif;when00000011=a='0';b='0';when00000100=a='0';b='1';when00000101=a='0';b='0';when00000110=a='0';b='1';when00000111=a='0';b='0';when00001000=a='0';b='0';when00001001=a='0';b='1';when00010000=a='0';b='0';when00010001=a='0';b='1';when00010010=a='0';b='0';whenothers=null;endcase;endprocess;m1=q1;m2=q2;end;(5)年低两位计数器程序及仿真图如下:libraryieee;useieee.std_logic_1164.all;useieee.std_logic_unsigned.all;entityyearisport(clk:instd_logic;y1,y2:outstd_logic_vector(3downto0);run,cout:outstd_logic);endyear;architectureoneofyearissignalq1,q2,q3:std_logic_vector(3downto0);beginprocess(clk)beginifclk'eventandclk='1'thenq1=q1+1;ifq1=9thenq1=(others='0');q2=q2+1;endif;ifq2=9andq1=9thenq2=0000;q1=0000;cout='1';elsecout='0';endif;endif;endprocess;process(clk)beginifclk'eventandclk='1'thenq3=q3+1;ifq3=3thenq3=(others='0');run='1';elserun='0';endif;endif;y1=q1;y2=q2;endprocess;end;(6)年高两位计数器程序及仿真图如下:libraryieee;useieee.std_logic_1164.all;useieee.std_logic_unsigned.all;entityyear1isport(clk:instd_logic;y3,y4:outstd_logic_vector(3downto0);run,cout:outstd_logic);endyear1;architectureoneofyear1issignalq1,q2:std_logic_vector(3downto0);beginprocess(clk)beginifclk'eventandclk='1'thenq1=q1+1;ifq1=9thenq1=(others='0');q2=q2+1;endif;ifq2=9andq1=9thenq2=0000;q1=0000;cout='1';elsecout='0';endif;endif;endprocess;process(q1)beginifq1(1downto0)/=00thenrun='1';elserun='0';endif;y3=q1;y4=q2;endprocess;end;(7)星期计数器程序及仿真图如下:libraryieee;useieee.std_logic_1164.all;useieee.std_logic_unsigned.all;entitycnt7isport(clk:instd_logic;q1,q2:outstd_logic_vector(3downto0));endcnt7;architectureoneofcnt7issignalq11,q22:std_logic_vector(3downto0);beginprocess(clk)beginifclk'eventandclk='1'thenq11=q11+1;ifq11=7thenq11=0001;endif;endif;q22=0000;endprocess;q1=q11;q2=q22;end;(8)调节时间及实现定时程序如下:libraryieee;useieee.std_logic_1164.all;useieee.std_logic_unsigned.all;entitytiaoshiisport(sout,fout,hout,dout,mout,yout0:instd_logic;k2,k3:instd_logic;fin,hin,din,min,yin0,yin1,dingshi,win:outstd_logic;q:outstd_logic_vector(3downto0));endtiaoshi;architectureoneoftiaoshiissignalw:std_logic_vector(3downto0);beginprocess(k2,k3)beginifk2'eventandk2='1'thenw=w+1;ifw=8thenw=0000;endif;endif;casewiswhen0000=fin=sout;hin=fout;din=hout;min=
本文标题:基于eda的万年历设计
链接地址:https://www.777doc.com/doc-1893263 .html