《EDA技术及其应用》
实 训 报 告
班 级 08级电子信息工程技术2班
姓 名
学 号
指导教师
20##年 5 月 26 日
郑州信息科技职业学院
机械电子工程系
目 录
一、 实训名称…………………………………………3
二、 实训目的…………………………………………3
三、 实训器材、场地…………………………………3
四、 设计思想…………………………………………3
五、 设计任务与要求、设计源程序与模块…………3
1、 设计任务…………………………………………3
2、 设计要求…………………………………………4
3、 设计源程序及生成模块…………………………4
4、 模块连接…………………………………………14
5、 引脚绑定…………………………………………15
六、 实训方法…………………………………………16
七、 实训心得体会……………………………………16
一、 实训名称:百年历的设计与制作
二、 实训目的:
1、 掌握VHDL设计数字系统的应用。
2、 掌握宏功能模块的应用。
3、 掌握系统存储器数据读写编辑器的应用。
4、 明确设计任务和要求,了解EDA技术的基本应用过程及领域。
5、 理解百年历的设计原理及分析方法。
三、 实训器材与场地:
EDA实验箱、计算机,EDA实验室
四、 设计思路:
先设计“秒”、“分”、“时”、“日”、“月”、“年”、“选择”及“调整”等模块,然后把各模块按照生活中日历时钟走动的规律连接在一起,最后调试并下载、绑定引脚、调整。
五、 设计任务与要求、设计原理与模块
设计任务:
1、 用VHDL语言设计“秒钟”即六十进制计数器。
2、 用VHDL语言设计“分钟” 即六十进制计数器。
3、 用VHDL语言设计“时钟” 即二十四进制计数器。
4、 用VHDL语言设计“日”系统。
5、 用VHDL语言设计“月”系统。
6、 用VHDL语言设计“年”系统。
7、 用VHDL语言设计“选择”系统。
8、 用VHDL语言设计“调整”系统。
9、 调用以上模块,在Block Diagram/Schematic File 中编辑窗口中把它们按一定规律连接起来即百年历系统。
设计要求:
在现实生活中,年份有平闰之分,当平年的2月份有28天,闰年的2月份29天,每年的1、3、5、7、8、10、12月份都是31天,4、6、9、11月份都是30天,故在设计“年、月、日”系统时必须考虑它们之间的关系,由于手中的EDA实验箱上的数码管不足,必须设计一个“选择”系统,让“年月日时分秒”分成两屏显示。在现实生活中,日期和时间在不同的地方时间不同,故需设计一个“调整”系统用来调整日期及时间。
设计源程序及其生成的模块:
1、六十进制计数器源程序及其模块
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
entity cnt60 is
port(clk:in std_logic;
m1:out std_logic_vector(3 downto 0);
m2:out std_logic_vector(3 downto 0);
cout:out std_logic);
end cnt60;
architecture behav of cnt60 is
begin
process(clk)
variable cq1,cq2:std_logic_vector(3 downto 0);
begin
if clk'event and clk='1' then
cq1:=cq1+1;
if cq1>9 then cq1:="0000";cq2:=cq2+1;
end if;
if cq2=5 and cq1=9 then cq2:="0000";cq1:="0000";
cout<='1'; else cout<='0';
end if;
end if;
m1<=cq1;
m2<=cq2;
end process;
end;
2、二十四进制计数器源程序及其模块
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
entity cnt24 is
port(clk:in std_logic;
q1:out std_logic_vector(3 downto 0);
q2:out std_logic_vector(3 downto 0);
cout:out std_logic);
end cnt24;
architecture behav of cnt24 is
begin
process(clk)
variable cq1,cq2:std_logic_vector(3 downto 0);
begin
if clk'event and clk='1' then
cq1:=cq1+1;
if cq1>9 then cq1:="0000";cq2:=cq2+1;
end if;
if cq2=2 and cq1>3 then cq2:="0000";cq1:="0000";
cout<='1'; else cout<='0';
end if;
end if;
q1<=cq1;
q2<=cq2;
end process;
end;
3、“日”系统源程序及其模块
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
entity tian is
port(clk:in std_logic;
a: in std_logic;
b:in std_logic;
t1:out std_logic_vector(3 downto 0);
t2:out std_logic_vector(3 downto 0);
cout:out std_logic);
end tian;
architecture behav of tian is
signal Q1,Q2: std_logic_vector(3 downto 0);
signal ab: std_logic_vector(1 downto 0);
begin
process(clk,a,b)
begin
if clk'event and clk='1'
then Q1<=Q1+1;
if Q1=9 then Q1<="0000";Q2<=Q2+1;
end if;
ab<=a&b;
case ab is
when"00" =>
if Q2=3 and Q1=1 then Q2<="0000";Q1<="0001";cout<='1';
else cout<='0';
end if;
when"01" =>
if Q2=3 and Q1=0 then Q2<="0000";Q1<="0001";cout<='1';
else cout<='0';
end if;
when"10" =>
if Q2=2 and Q1=8 then Q2<="0000";Q1<="0001";cout<='1';
else cout<='0';
end if;
when"11" =>
if Q2=2 and Q1=9 then Q2<="0000";Q1<="0001";cout<='1';
else cout<='0';
end if;
when others =>null;
end case;
end if;
end process;
t1<=Q1;t2<=Q2;
end;
4、“月”系统源程序及其模块
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
entity yue is
port(clk:in std_logic;
run:in std_logic;
y1:out std_logic_vector(3 downto 0);
y2:out std_logic_vector(3 downto 0);
a,b,cout:out std_logic);
end yue;
architecture behav of yue is
signal q1,q2 : std_logic_vector(3 downto 0);
signal q1q2 : std_logic_vector(7 downto 0);
begin
process (clk)
begin
if clk'event and clk='1' then
q1<=q1+1;
if q1=9 then q1<=(others=>'0');
q2<=q2+1;
end if;
if q2=1 and q1=2 then q1<="0001"; q2<=(others=>'0');
cout<='1';
else cout<='0';
end if;
end if;
end process;
process (clk)
begin
q1q2<=q1&q2;
case q1q2 is
when "00000001" => a<='0';b<='0';
when "00000010" =>
if run='0' then a<='1';b<='0';
else a<='1';b<='1';
end if;
when "00000011" => a<='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" => 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';
when others =>NULL;
end case;
end process;
y1<=q1;
y2<=q2;
end behav;
5、“年”系统源程序及其模块
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
entity nian is
port(clk:in std_logic;
run:out std_logic;
n1:out std_logic_vector(3 downto 0);
n2:out std_logic_vector(3 downto 0));
end nian;
architecture behav of nian is
signal q1,q2,q: std_logic_vector(3 downto 0);
begin
process (clk)
begin
if clk'event and clk='1' then
q1<=q1+1;
if q1=9 then q1<=(others=>'0');
q2<=q2+1;
if q1=9 and q2=9
then q1<="0000" ;q2<="0000";
end if;
end if;
end if;
end process;
process (clk)
begin
if clk'event and clk='1' then
q<=q+1;
if q=4 then run<='1';q<="0000";
else run<='0';
end if;
end if;
end process;
n1<=q1;
n2<=q2;
end;
6、“调整”系统源程序及其模块
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
entity tiao is
port(m0,f0,s0,t0,y0:in std_logic;
k2:in std_logic;
k3:in std_logic;
fi,si,ti,yi,ni:out std_logic;
l2,l3,l4,l5,l6:out std_logic);
end;
architecture behav of tiao is
signal a:std_logic_vector(3 downto 0);
begin
process(k2)
begin
if k2'event and k2='1' then a<=a+1;
if a=5 then a<="0000";
end if;
end if;
case a is
when "0000"=>fi<=m0;si<=f0;ti<=s0;yi<=t0;ni<=y0;l2<='0';l3<='0';l4<='0';l5<='0';l6<='0';
when "0001"=>fi<=k3;si<='0';ti<='0';yi<='0';ni<='0';l2<='1';l3<='0';l4<='0';l5<='0';l6<='0';
when "0010"=>fi<='0';si<=k3;ti<='0';yi<='0';ni<='0';l2<='0';l3<='1';l4<='0';l5<='0';l6<='0';
when "0011"=>fi<='0';si<='0';ti<=k3;yi<='0';ni<='0';l2<='0';l3<='0';l4<='1';l5<='0';l6<='0';
when "0100"=>fi<='0';si<='0';ti<='0';yi<=k3;ni<='0';l2<='0';l3<='0';l4<='0';l5<='1';l6<='0';
when "0101"=>fi<='0';si<='0';ti<='0';yi<='0';ni<=k3;l2<='0';l3<='0';l4<='0';l5<='0';l6<='1';
when others=>null;
end case;
end process;
end;
7、“选择”系统源程序及其模块
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
entity kong is
port(k:in std_logic;
s1,s2,f1,f2,m1,m2,n1,n2,y1,y2,t1,t2:in std_logic_vector(3 downto 0);
q:out std_logic;
a0,a1,a2,a3,a4,a5:out std_logic_vector(3 downto 0));
end;
architecture behav of kong is
begin
process(k)
begin
if k='1' then
a0<=m1;a1<=m2;a2<=f1;a3<=f2;a4<=s1;a5<=s2;q<='0';
else a0<=t1;a1<=t2;a2<=y1;a3<=y2;a4<=n1;a5<=n2;q<='1';
end if;
end process;
end;
模块连接截图:
模块是按照生活中的日历与时钟的走动规律来连接的,“选择”模块的作用是让时间和日期分屏显示,“调整”模块的作用是调整时间和日期的。
引脚绑定图:
经过分析,我们选择按照实验电路结构图No.7进行引脚的绑定,可知每个控制引脚在EDA实验箱上对应的按键。
六、 实训方法
1、设计每个小系统,调试、仿真、生成模块。
2、按照各模块的功能连接,调试。
3、引脚绑定,下载,调试。
4、调整,把日期时间调整到现在的日期时间上。按选择键切换屏显时间和日期。
七、 实训心得体会:
通过本次EDA课程设计实训,在了解到百年历的基本原理的同时,我还熟练掌握了Quartus II 软件的使用方法,学会了怎么设计一个完整的系统,并且意识到作为二十一世纪的跨世纪电子信息工程专业人才,这些软硬件的应用操作常识是必不可少的。在此次实训的过程中,我虽然碰到不少困难和问题,到最后还是经过自己的不懈努力和在老师的指导与帮助下全部解决了。这次实训给我的最深的印象就是扩大自己的知识面,了解更多与本专业有关的科技信息,与时代共同进步,才能在将来成为有用的科技人才。