EDA课程设计报告书.docx
《EDA课程设计报告书.docx》由会员分享,可在线阅读,更多相关《EDA课程设计报告书.docx(12页珍藏版)》请在冰豆网上搜索。
EDA课程设计报告书
《电子设计自动化EDA》课程设计报告书
学号:
08057102
班级:
自动化081
姓名:
陈婷
指导教师:
刘伟
一、设计思想2
二、设计步骤3
三、调试过程8
四、结果剖析10
五、心得领会11
六、参照文件11
1
一、设计思想
(一)、设计要求
1、拥有以24小时制时、分、秒记时、显示功能。
2、拥有整点报时功能,整点报时的同时LED花式显示。
3、拥有消零,调理小时,分钟功能。
4、设计精度要求为1s。
(二)、系统功能描绘
1.、系统输入:
调时、调分,清零信号,分别用按键开关SETHOUR、SETMIN、RESET控制;计数时钟信号CLK采纳2HZ时钟源,扫描时钟信号CLKDSP采纳32HZ时钟源
或更高;
2、系统输出:
8位八段共阴极数码管显示输出;LED花式显示输出;
3、系统功能详尽描绘:
计时:
正常工作状态下,每天按24小时计时制,蜂鸣器无声,逢整点报时。
显示:
要求采纳扫描显示方式驱动8位8段数码管显示。
整点报时:
蜂鸣器在“51”、“53”、“55”、“57”、“59”秒发音,结束时为整点;
校时:
在计时状态下,按下按键SETMIN设定分钟,按下按键SETHOUR设定小时。
(三)设计思路
1、分别写出六进制、十进制、二十四进制、清零、设置时分、LED译码部分,在主体部分用元件例化语句计时,清零设置时分、LED译码,再加上扫描模块2、将六进制、十进制、二十四进制、清零、设置时分、LED译码、扫描模块
分模块写在一个主中
2
(四)系统电路构造框图
二、设计步骤
(一)各种进制的计时实时钟控制模块程序
1、6进制
libraryieee;
useieee.std_logic_1164.all;
useieee.std_logic_unsigned.all;
entitycounter6is
port(clk,reset,set:
instd_logic;
ain:
instd_logic_vector(3downto0);
aout:
outstd_logic_vector(3downto0);
co:
outstd_logic);
endcounter6;
architectureart2ofcounter6is
signalcount:
std_logic_vector(3downto0);
3
begin
process(clk)
begin
if(clk'eventandclk='1')then
if(reset='0')thencount<="0000";
elsif(set='1')thencount<=ain;
elsif(count="0101")then
count<="0000";
co<='1';
elsecount<=count+1;co<='0';
endif;
endif;
endprocess;
aout<=count;
endart2;
2、10进制
libraryieee;
useieee.std_logic_1164.all;
useieee.std_logic_unsigned.all;
entitycounter10is
port(clk,reset,set:
instd_logic;
ain:
std_logic_vector(3downto0);
aout:
outstd_logic_vector(3downto0);
co:
outstd_logic);
endcounter10;
architectureart1ofcounter10is
signalcount:
std_logic_vector(3downto0);
begin
process(clk)
begin
if(clk'eventandclk='1')then
if(reset='0')thencount<="0000";
elsif(set='1')thencount<=ain;
elsif(count="1001")then
count<="0000";
co<='1';
4
elsecount<=count+1;co<='0';
endif;
endif;
endprocess;
aout<=count;
endart1;
3、24进制
ibraryieee;
useieee.std_logic_1164.all;
useieee.std_logic_unsigned.all;
entitycounter24is
port(clk,reset,set:
instd_logic;
ainh:
instd_logic_vector(3downto0);
ainl:
instd_logic_vector(3downto0);
aout:
outstd_logic_vector(7downto0));
endcounter24;
architectureart3ofcounter24is
signalcount:
std_logic_vector(7downto0);
begin
process(clk)
begin
if(clk'eventandclk='1')then
if(reset='0')thencount<="00000000";
elsif(set='1')thencount(7downto4)<=ainh;count(3downto0)<=ainl;elsif(count(7downto4)<"0011")then
if(count(7downto4)="0010"andcount(3downto0)="0011")thencount<="00000000";
elsif(count(3downto0)="1001")then
count(3downto0)<="0000";
count(7downto4)<=count(7downto4)+1;
elsecount(3downto0)<=count(3downto0)+1;
endif;
endif;
endif;
--endif;
endprocess;
5
aout<=count;
endart3;
(二)系统整体程序
libraryieee;
useieee.std_logic_1164.all;
useieee.std_logic_unsigned.all;
entityclockis
port(clk,b1,clks:
instd_logic;
reset:
instd_logic;
setmin,sethour:
instd_logic;
minutell,minutehh,hourll,hourhh,b2:
instd_logic_vector(3downto0);
secondl,secondh:
outstd_logic_vector(3downto0);
--second0,second2:
outstd_logic_vector(6downto0);
minutel,minuteh:
outstd_logic_vector(3downto0);
--minute0,minute2:
outstd_logic_vector(6downto0);
hourl,hourh:
outstd_logic_vector(3downto0);
--hour0,hour2,dout:
outstd_logic_vector(6downto0);
dout:
outstd_logic_vector(6downto0);
s:
outstd_logic_vector(2downto0);
singing,light:
outstd_logic);
endclock;
architectureartofclockis
componentcounter10is
port(clk,reset,set:
instd_logic;
ain:
instd_logic_vector(3downto0);
aout:
outstd_logic_vector(3downto0);
co:
outstd_logic);
endcomponent;
componentcounter6is
port(clk,reset,set:
instd_logic;
ain:
instd_logic_vector(3downto0);
aout:
outstd_logic_vector(3downto0);
co:
outstd_logic);
endcomponent;
componentcounter24is
port(clk,reset,set:
instd_logic;
6
ainh,ainl:
std_logic_vector(3downto0);
aout:
outstd_logic_vector(7downto0));
endcomponent;
componentled7is
port(ain:
instd_logic_vector(3downto0);
aout:
outstd_logic_vector(6downto0));
endcomponent;
signalcs0,cs1,cm0,cm1:
std_logic;
signals0,s1,m0,m1,h0,h1,cout:
std_logic_vector(3downto0);
signalh:
std_logic_vector(7downto0);
signalcount:
std_logic_vector(2downto0);
begin
h0<=h(3downto0);h1<=h(7downto4);
u1:
counter10portmap(clk=>clk,reset=>reset,set=>b1,ain=>b2,aout=>s0,co=>cs0);
u2:
counter6portmap(clk=>cs0,reset=>reset,set=>b1,ain=>b2,aout=>s1,co=>cs1);
u3:
counter10
portmap(clk=>cs1,reset=>reset,set=>setmin,ain=>minutell,aout=>m0,co=>cm0);u4:
counter6
portmap(clk=>cm0,reset=>reset,set=>setmin,ain=>minutehh,aout=>m1,co=>cm1);u5:
counter24
portmap(clk=>cm1,reset=>reset,set=>sethour,ainl=>hourll,ainh=>hourhh,aout=>h);
u6:
led7portmap(ain=>cout,aout=>dout);
secondl<=s0;secondh<=s1;minutel<=m0;minuteh<=m1;hourl<=h0;hourh<=h1;
process(m1,m0,s1,s0)
begin
if(m1="0101"andm0="1001"ands1="0101"ands0="1001")thensinging<='1';light<='1';
elsesinging<='0';light<='0';
endif;
endprocess;
process(clks)
begin
if(clks'eventandclks='1')then
if(count="101")then
count<="000";
elsecount<=count+1;
endif;
s<=count;
CASEcountIS
when"000"=>cout<=s0;
7
when"001"=>cout<=s1;
when"010"=>cout<=m0;s<="010";
when"011"=>cout<=m1;
when"100"=>cout<=h0;
when"101"=>cout<=h1;
whenothers=>cout<="0000";
endcase;
endif;
endprocess;
endart;
三、调试过程
(一)仿真波形
1、6进制程序仿真波形
2、10进制程仿真波形
8
3、24进制程序仿真波形
4、系统程序仿真波形
(二)剖析
问题1:
u6:
led7portmap(ain=>secondl,aout=>second0);
u7:
led7portmap(ain=>secondh,aout=>second1);
u8:
led7portmap(ain=>minutel,aout=>minute0);
u9:
led7portmap(ain=>minuteh,aout=>minute1);
9
u10:
led7portmap(ain=>hourl,aout=>hour0);
u11:
led7portmap(ain=>hourh,aout=>hour1);
问题剖析:
元件例化是并行语句,按此段代码LDE并行显示,每一个数码管都需要八个端口,这样就需要八排插口,而试验箱只有一排端口。
解决办法:
采用扫描显示方式,修改程序为:
u6:
led7portmap(ain=>cout,aout=>dout);
问题2:
u1:
counter10portmap(clk=>clk,reset=>reset,aout=>s0,co=>cs0);问题剖析:
此元件例化中有set,ain两个端口没实用到
解决方法:
设置两个输入端口使set和ain为无效信号,设置b1,b2,使set=>b1,ain=>b2,b1,b2种类一定分别与set和ain同样,在连线时可用拨码开关将b1,b2置成相应状态。
问题3:
对变量的多重赋值
解决方法:
设置中间信号
问题4:
元件例化模块采纳名称映照时两个变量的种类不同样解决方法:
名称映照的两变量种类应同样
四、结果剖析
1、10进制计数器
剖析:
当reset=‘0‘时,aout<=’0000’;
当set=‘1‘时,aout<=ain(0011);
当reset=‘1‘且set=‘0‘时,开始计数从“0000”到“1001”,当aout=
“1001”时aout被置零,且进位Co<=’1’,计数器开始从头计数;
2、6进制计数器
剖析:
当reset=‘0‘时,aout<=’0000’;
当set=‘1‘时,aout<=ain(0101);
当reset=‘1‘且set=‘0‘时,开始计数从“0000”到“0101”,当aout=
“0101”时aout被置零,并开始从头计数;
10
3、24进制计数器
剖析:
当reset=‘0‘时,aout<=’0000’;
当set=‘1‘时,aout<=ain(0101);
当reset=‘1‘且set=‘0‘时,开始计数从“0000”到“0101”,当aout=
“0101”时aout被置零,并开始从头计数;
五、心得领会
在这课程设计的过程中不单能够稳固从前所学过的知识,并且学到了好多在
书籍上所没有学到过的知识。
经过此次设计,进一步加深了对EDA的认识,在编写顶层文件的程序时,碰到了许多问题,特别是各元件之间的连结,以及信号的定义,老是有错误,在仔细的检查下,终于找出了错误和警示,清除困难后,
程序编译就经过了,在波形仿真时,也碰到了一点困难,想要的结果不可以在波形上获得正确的显示:
在初始设定输入的时钟信号后一直看不到需要时段的波形变化,
,多次调试以后,才发现是由于输入的时钟信号关于器件的延缓时间来说很短了。
经过频频调试,终于找到了比较适合的输入数值:
endtime的值需要设置的长一点:
这样就能够察看到完好的仿真结果。
经过此次课程设计使我懂得了理论与实质相联合是很重要的,只有理论知
识是远远不够的,只有把所学的理论知识与实践相联合起来,从理论中得出结论,才能真实为社会服务,进而提升自己的实质着手能力和独立思虑的能力。
在设计的过程中碰到问题,能够说得是困难重重,这毕竟第一次做的,不免会碰到过各种各种的问题,同时在设计的过程中发现了自己的不足之处,对从前所学过的知识理解得不够深刻,掌握得不够坚固。
总的来说,在设计中碰到了好多问题,最后在老师的勤劳的指导下,终于游逆而解,有点小小的成就感,终于感觉平常所学的知识有了适用的价值,达到了理论与实质相联合的目的,不单学到了许多知识,并且锻炼了自己的能力,最后,对给过我帮助的全部同学和各位指导老师再次表示忠心的感谢!
六、参照文件
《EDA技术及应用》
11