当前位置:文档之家› EDA万年历实训报告

EDA万年历实训报告

《EDA技术及其应用》实训报告班级 11241姓名苏合信,张明伟,朱迎新,王亚坤学号 22,11,28,29指导教师薛瑞2013年05月26 日北华航天工业学院11级电子工程系目录一设计要求 (2)1.0 设计目的及意义 (2)1.1 设计要求 (2)二设计流程: (2)2.0 原理框图 (2)2.1 VHDL设计思路 (3)三 VHDL程序 (3)3.0 天计数模块 (6)3.1 月计数模块 (7)3.2 年计数模块 (9)3.3 调时控制模块 (11)3.4 译码模块 (12)3.5 扫描模块 (12)四心得体会 (14)4.0 (14)五附录 (15)5.0 顶层文件 (15)一、设计目的及意义1.0 设计目的及意义在掌握EDA理论知识的基础上进一步了解EDA开发软件QuartusII的使用,掌握VHDL编程的技巧及方法,学会并熟练掌握PC机与实验箱的连接下载及使用,进一步提高自己的动手操作能力。

1.1 设计要求利用QuartusII编写程序在实验箱上实现万年历的年月日的显示,要求能够区分闰年与平年;年月日,时分秒可以自由调整并能随意切换;能够清楚地分辨出年月日,时分秒的显示状态。

二、设计流程2.0 原理框图2.1 VHDL设计思路编写年月日模块,年模块要有一个反馈端口控制月;月也要有一个反馈端口控制日;最后编写调时模块和扫描模块,以及译码模块,可以用k1,k2调节年月,用对应的LED等的亮灭来表示调节状态。

三、VHDL程序3.0 天计数模块library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity tian isport(clk:in std_logic;pan:in std_logic_vector(1 downto 0);T1:out std_logic_vector(6 downto 0);cout:out std_logic);end tian;architecture one of tian issignal q1:std_logic_vector(3 downto 0);signal q2:std_logic_vector(2 downto 0);signal ab:std_logic_vector(1 downto 0);beginprocess(clk,pan)beginif clk'event and clk='1'then q1<=q1+1;if q1=9 then q1<="0000";q2<=q2+1;end if;case pan iswhen "00"=>if q2=3 and q1=1 then q2<="000" ;q1<="0001";cout<='1'; else cout<='0';end if;when "01"=>if q2=3 and q1=0 then q2<="000" ;q1<="0001";cout<='1'; else cout<='0';end if;when "10"=>if q2=2 and q1=8 then q2<="000" ;q1<="0001";cout<='1'; else cout<='0';end if;when "11"=>if q2=2 and q1=9 then q2<="000" ;q1<="0001";cout<='1'; else cout<='0';end if;when others=>null;end case;end if;end process;T1(3 downto 0)<=q1;T1(6 downto 4)<=q2;end one;3.1 月计数模块library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity yue isport(clk,run:in std_logic;cout:out std_logic;pan:out std_logic_vector(1 downto 0);Y1:out std_logic_vector(6 downto 0));end yue;architecture behav of yue issignal q1:std_logic_vector(3 downto 0);signal q2:std_logic_vector(2 downto 0);signal q3:std_logic_vector(6 downto 0);beginprocess(clk,run,q1,q2)beginif clk'event and clk='1' thenq1<=q1+1;if q1=9 then q1<="0000";q2<=q2+1;end if;if q1=2 and q2=1 thenq1<="0001";q2<="000";cout<='1';else cout<='0';end if;q3<=q2&q1;case q3 iswhen "0000001"=>pan<="00";when "0000010"=>if run='1' then pan<="11";else pan<="10"; end if;when "0000011"=>pan<="00";when "0000100"=>pan<="01";when "0000101"=>pan<="00";when "0000110"=>pan<="01";when "0000111"=>pan<="00";when "0001000"=>pan<="00";when "0001001"=>pan<="01";when "0001010"=>pan<="00";when "0001011"=>pan<="01";when "0001100"=>pan<="00";when others=>null;end case;end if;Y1(3 downto 0)<=q1;Y1(6 downto 4)<=q2; end process;end behav;3.2 年计数模块library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity nian isport(clk :in std_logic;n1:out std_logic_vector(6 downto 0); run:out std_logic);end entity;architecture one of nian issignal q1,q3:std_logic_vector(3 downto 0); signal q2:std_logic_vector(2 downto 0);beginprocess(clk)beginif clk'event and clk='1' thenq1<=q1+1;q3<=q3+1;if q1=9 then q2<=q2+1;q1<="0000";end if;if q3=3 thenq3<="0000";run<='1';else run<='0';end if;if q1=9 and q2<=7 then q1<="0001";q2<="000"; end if;end if;end process;n1(3 downto 0)<=q1;n1(6 downto 4)<=q2;end one;3.3 调时模块library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity tiaoshi isport(k1,k2:in std_logic;m1,m2:in std_logic;n1,n2,d1,d2:out std_logic);end entity;architecture one of tiaoshi issignal q:std_logic_vector(3 downto 0);beginprocess(k1,q,m1,m2)beginif k1'event and k1='1' then q<=q+1;if q=2 then q<="0000";end if;end if;case q iswhen"0000"=>n1<=m1;n2<=m2;d1<='0';d2<='0'; when"0001"=>n1<=k2;n2<='0'; d1<='1';d2<='0'; when"0010"=>n1<='0';n2<=k2; d1<='0';d2<='1'; when others=>NULL;end case;end process;end one;3.4 扫描模块library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;use ieee.std_logic_arith.all;entity seltime isport(clk1:in std_logic;tian,yue:in std_logic_vector(6 downto 0); nian:in std_logic_vector(6 downto 0);daout:out std_logic_vector(3 downto 0);dp:out std_logic;sel:out std_logic_vector(2 downto 0));end seltime;architecture fun of seltime issignal count:std_logic_vector(2 downto 0); beginsel<=count;process(clk1)beginif(clk1'event and clk1='1')thenif(count>="101")thencount<="000";elsecount<=count+1;end if;end if;case count iswhen "000"=>daout<=tian(3 downto 0);dp<='0'; when"001"=>daout(3)<='0';daout(2 downto 0)<=tian(6 downto 4);dp<='0';when "010"=>daout<=yue(3 downto 0);dp<='1'; when"011"=>daout(3)<='0';daout(2 downto 0)<=yue(6 downto 4);dp<='0';when "100"=>daout<=nian(3 downto 0);dp<='1'; when others=>daout(3 downto 2)<="00"; daout(2 downto 0)<=nian(6 downto 4);dp<='0';end case;end process;end fun;3.5 译码模块library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity led isport(ledi:in std_logic_vector(3 downto 0);ledo:out std_logic_vector(6 downto 0));end entity;architecture one of led isbeginprocess(ledi)begincase ledi iswhen "0000"=>ledo<="1111110";when "0001"=>ledo<="0110000";when "0010"=>ledo<="1101101";when "0011"=>ledo<="1111001";when "0100"=>ledo<="0110011";when "0101"=>ledo<="1011011";when "0110"=>ledo<="1011111";when "0111"=>ledo<="1110000";when "1000"=>ledo<="1111111";when "1001"=>ledo<="1111011";when others=>null;end case;end process;end one;四、心得体会通过本次万年历实训,让我从中收获很多,感触也很多。

相关主题