EDA课程设计.docx
- 文档编号:14593257
- 上传时间:2023-06-24
- 格式:DOCX
- 页数:23
- 大小:775.40KB
EDA课程设计.docx
《EDA课程设计.docx》由会员分享,可在线阅读,更多相关《EDA课程设计.docx(23页珍藏版)》请在冰点文库上搜索。
EDA课程设计
EDA技术课程设计
课题:
多功能数字电子钟设计
系别:
电气与电子工程系
专业:
电子信息工程
姓名:
●●●
学号:
123408115
指导教师:
●●●
河南城建学院
2011年6月24日
成绩评定·
一、指导教师评语(根据学生设计报告质量、答辩情况及其平时表现综合评定)。
二、评分(按下表要求评定)
评分项目
设计报告评分
答辩评分
平时表现评分
合计
(100分)
任务完成
情况
(20分)
课程设计
报告质量
(40分)
表达情况
(10分)
回答问题
情况
(10分)
工作态度与纪律
(10分)
独立工作
能力
(10分)
得分
课程设计成绩评定
班级姓名学号
成绩:
分(折合等级)
指导教师签字年月日
目录
一、设计目的1
二、设计要求1
三、总体设计方案要求1
1、设计的总体原理1
2、设计内容1
四、EDA设计与仿真2
1、秒计时器模块2
2、分计数器模块4
3、时计数器模块6
4、分频器模块8
5、扫描电路模块9
6、译码显示器模块11
7、系统设计13
五、硬件实现16
1、硬件实现步骤16
2、硬件实现结果16
六、设计总结18
七、参考文献18
八、设计生成的电路总图18
一、设计目的
这次课程设计主要是培养我们的实际动手能力及对EDA这门课程的深入的理解,增强我们对EDA程序设计流程的掌握。
这个课题还要求我们掌握计数器的设计,六十进制计数器和二十四进制计数器的设计方法,以及各个进制之间的连接关系。
二、设计要求
1、具有时、分、秒,计数显示功能,以二十四时制循环计;
2、设置启动、暂停开关,以满足启动计时和停止计时的功能;
3、要求计时精度为0.01秒,最长时间为24H。
4、具有时间设置(清零、调节小时和分功能)和闹钟功能;(扩展功能选作)
5、整点报时,整点报时的同时,LED灯花样显示或者给段动听音乐;(扩展功能选作)
三、总体设计方案要求
1.设计的总体原理
要实现一个数字时钟系统,整个系统由主要模块电路模块和外部输入输出以及显示模块组成。
首先分别实现单个模块的功能,然后再通过级联组合的方式实现对整个系统的设计。
原理框图如下:
图3-1.总体设计框图
2.设计内容
电子时钟主要模块有四个,它包括脉冲信号产生模块(即分频电路)、计数模块(计数模块又分为秒计数模块、分计数模块和时计数模块)、码显示模块、复位模块。
各个模块先用EDA技术中的VHDL语言编程仿真,再生成各个小模块的模拟元件,再元件例化,根据设计连接电路实现数字电子钟系统。
四、EDA设计及仿真(各个模块设计程序、原理框图及仿真波形图)1.秒计时器(second)
libraryieee;
useieee.std_logic_1164.all;
useieee.std_logic_unsigned.all;
entitysecondis
port(clk,reset:
instd_logic;
sec1,sec2:
outstd_logic_vector(3downto0);---------秒计数器的两个输出;
cin:
outstd_logic);
endsecond;
architecturesecond1ofsecondis
signalsec1_t,sec2_t:
std_logic_vector(3downto0);---------秒计数器的中间信号;
begin
process(clk,reset)
begin
ifreset='1'then
sec1_t<="0000";----------复位信号为1时秒信号复位;
sec2_t<="0000";
elsifclk'eventandclk='1'then
ifsec1_t="1001"then
sec1_t<="0000";------秒计数器的个位为9时变为0;
ifsec2_t="0101"then
sec2_t<="0000";------秒计数器的十位为5时变为0;
else
sec2_t<=sec2_t+1;-----秒计数器的十位不为5时加1;
endif;
else
sec1_t<=sec1_t+1;-----秒计数器的个位不为9时加1;
endif;
ifsec1_t="1001"andsec2_t="0101"then----------当计数器数值为59时向分为进1;
cin<='1';---------向分进1,作为分的时钟信号;
else
cin<='0';
endif;
endif;
endprocess;
sec1<=sec1_t;
sec2<=sec2_t;
endsecond1;
图4-1秒计数器框图
图4-2秒计数器时序仿真图
秒计数器的波形分析:
由程序及仿真波形图可以看出该计数器是59进制计数器,当sec1计数到9是sec2增加1,而sec1变为0,当sec2增加到5,而且sec1为9时,sec1,sec2变为0,cin1增加1向分计数器进位,提供一个分计数器的时钟信号。
2.分计数器(minute)
分同秒计时器一样
libraryieee;
useieee.std_logic_1164.all;
useieee.std_logic_unsigned.all;
entityminuteis
port(clk,reset:
instd_logic;
min1,min2:
outstd_logic_vector(3downto0);--------秒计数器的两个输出;
cin1:
outstd_logic);
endminute;
architectureminute1ofminuteis
signalmin1_t,min2_t:
std_logic_vector(3downto0);
begin
process(clk,reset)
begin
ifreset='1'then
min1_t<="0000";--------复位信号为1是分的信号复位为0;
min2_t<="0000";
elsifclk'eventandclk='1'then
ifmin1_t="1001"then
min1_t<="0000";--------分计数器的个位为9时变为0;
ifmin2_t="0101"then
min2_t<="0000";--------分计数器的个位为5时变为0;
else
min2_t<=min2_t+1;--------分计数器的十位不为5时加1;
endif;
else
min1_t<=min1_t+1;--------分计数器的个位不为9时加1;
endif;
ifmin1_t="1001"andmin2_t="0101"then-----计数器的值到59是向时进1;
cin1<='1';------向时的进位,相当于时的时钟信号;
else
cin1<='0';
endif;
endif;
endprocess;
min1<=min1_t;----------把中间信号的值付给分信号;
min2<=min2_t;
endminute1;
图4-3分计数器的原理框图
图4-4分计数器的时序仿真波形图
图4-5分计数器程序错误显示图
分计数器波形分析:
在刚开始的仿真时,程序出现了一点的错误,引起错误的原因是min1,min2这两个信号的声明是错误的,正确的声明方法是min1,min2。
经过改正后程序是正确的,正确的波形显示该计数器和秒计数器是59进制计数器,当min1计数到9是min2增加1,而min1变为0,当min2增加到5,且min1增加到9时,min1,min2变为0,cin2增加1向时计数器进位,提供一个时计数器的时钟信号。
3.时计时器(hour)
libraryieee;
useieee.std_logic_1164.all;
useieee.std_logic_unsigned.all;
entityhouris
port(clk,reset:
instd_logic;
hour1,hour2:
outstd_logic_vector(3downto0));------时计数器的两个输出信号
endhour;
architecturehour1ofhouris
signalhour1_t,hour2_t:
std_logic_vector(3downto0);
begin
process(clk,reset)
begin
ifreset='1'then
hour1_t<="0000";
hour2_t<="0000";
elsifclk'eventandclk='1'then
ifhour1_t="0011"andhour2_t="0010"then
hour1_t<="0000";---------当时计数器的值达到23是,当分秒计数器都到59时时计数器变为0;
hour2_t<="0000";
else
ifhour1_t="0011"then
hour1_t<="0000";--------当时计数器的个位为3时值变为0;
ifhour2_t="0010"then
hour2_t<="0000";--------当时计数器的个位变2时值变为0;
else
hour2_t<=hour2_t+1;--------当时计数器的十位不为2时值加1;
endif;
else
hour1_t<=hour1_t+1;--------当时计数器的个位不为3时值加1;
endif;
endif;
endif;
endprocess;
hour1<=hour1_t;
hour2<=hour2_t;
endhour1;
图4-6时计数器原理框图
图4-7时计数器时序仿真波形图
时波形图分析:
由程序及时序仿真波形图可以知道该时计数器是二十四进制计数器,当hour1计数到3是hour2增加1,而hour1变为0,当hour2增加到2,且hour1增加到3时,hour2变为0,hour1也变为0。
4.分频器(freq_divider)
libraryIEEE;
useIEEE.std_logic_1164.all;
useIEEE.std_logic_arith.all;
useIEEE.std_logic_unsigned.all;
entityfreq_divideris
port(reset,clk:
inSTD_LOGIC;
Q:
outSTD_LOGIC);
endfreq_divider;
architecturefreq_divider1offreq_divideris
signalcount50:
integerrange0to49;
signalout1:
std_logic;
begin
process(reset,clk)
begin
ifreset='1'thencount50<=0;
elsifclk'eventandclk='1'then
count50<=count50+1;-----当时钟周期小于50是信号来时加1;
out1<=out1;
ifcount50=49then
count50<=0;-------50个时钟周期后计数器清零;
out1<=notout1;-------当时钟周期达到50是输出信号反相,即有高电平变低电平或有低电平变高电平;
endif;
endif;
Q<=out1;-------把中间信号的值赋给总输出;
endprocess;
endfreq_divider1;
图4-8分频器的原理框图
图4-9分频器的时序仿真波形图
图4-10分频器程序错误显示图
分频器波形分析:
在第一次仿真是显示程序是错误的,进过更改及调试程序正确了,由程序及时序仿真图可以知道该分频器是100倍分频,由于该设计的目的是设计一个数字电子钟,可知时钟需要一个1s的时钟信号,必须用到分频器,该分频器的时钟信号的周期是100ns,经过三次次100倍分频,可以得到1s的时钟信号。
也就是说在这个程序中要用到三个这样的分频器。
5、扫描模块源程序
libraryieee;
useieee.std_logic_1164.all;
useieee.std_logic_unsigned.all;
entitymux6is
port(clkscan,reset:
instd_logic;
in1,in2,in3,in4,in5,in6:
instd_logic_vector(3downto0);
BT:
outstd_logic_vector(7downto0);------显示控制信号输出
A:
outstd_logic_vector(3downto0));-------数码管显示数值输出
endmux6;
architecturemux60ofmux6is
signalcnt8:
std_logic_vector(2downto0);
begin
process(clkscan,reset)
begin
ifreset='1'then
cnt8<="000";-------异步复位
elsifclkscan'eventandclkscan='1'then----------检测时钟上升沿
ifcnt8="111"then
cnt8<="000";
else
cnt8<=cnt8+1;---------六进制计数器
endif;
endif;
endprocess;
process(cnt8)
begin
casecnt8is
when"000"=>BT<="00000001";A<=in1;
when"001"=>BT<="00000010";A<=in2;
when"010"=>BT<="00000100";A<=in3;
when"011"=>BT<="00001000";A<=in4;
when"100"=>BT<="00010000";A<=in5;
when“101”=>BT<="00100000";A<=in6;
when“110”=>BT<="01000000";A<=“0000”;
when“111”=>BT<="10000000";A<=“0000”;----------数据选择输出
endcase;
endprocess;
endmux60;
图4-11多路复用器的原理框图
图4-12多路复用器的时序仿真波形图
波形图的分析:
由以上的程序和波形图可以看出来,当sel=0时,多路复用器选择的是in1,当sel=1时选择的是in2,当sel=2是选择的是in3,当sel=3时选择的是in4,当sel=5时选择的是in5.
6.译码显示模块的VHDL程序(yima.vhd)
libraryieee;
useieee.std_logic_1164.all;
entityyimais
port(BT:
instd_logic_vector(3downto0);
LED7:
outstd_logic_vector(6downto0));
endyima;
architecturebehavofyimais
begin
process(BT)
begin
caseBTis
when"0000"=>LED7<="1111110";
when"0001"=>LED7<="0110000";
when"0010"=>LED7<="1101101";
when"0011"=>LED7<="1111001";
when"0100"=>LED7<="0110011";
when"0101"=>LED7<="1011011";
when"0110"=>LED7<="1011111";
when"0111"=>LED7<="1110010";
when"1000"=>LED7<="1111111";
when"1001"=>LED7<="1111011";
whenothers=>LED7<="0000000";
endcase;
endprocess;
endbehav;
图4-13译码显示电路的原理框图
图4-16译码显示电路的时序仿真波形图
7、系统设计
将上述5个程序作为底层文件,存放在同一个文件夹中,然后按下面的图将这几个文件连接起来,并用元件例化语句编写顶层文件的程序,
如下:
总程序(前面的分模块程序省略,下面只写了原件例化得程序)
------------------my_components.vhd(package)------------------
libraryIEEE;
useIEEE.std_logic_1164.all;
useIEEE.std_logic_arith.all;
useIEEE.std_logic_unsigned.all;
------------------------------------------------------------
packagemy_componentsis
----------------------------------------------------
componentsecondis
port(clk,reset:
instd_logic;
sec1,sec2:
outstd_logic_vector(3downto0);
cin:
outstd_logic);
endcomponent;
-----------------------------------------------------
componentminuteis
port(clk,reset:
instd_logic;
min1,min2:
outstd_logic_vector(3downto0);
cin1:
outstd_logic);
endcomponent;
--------------------------------------------------------
componenthouris
port(clk,reset:
instd_logic;
hour1,hour2:
outstd_logic_vector(3downto0));
endcomponent;
----------------------------------------------------------
componentfreq_divideris
port(reset,clk:
inSTD_LOGIC;
Q:
outSTD_LOGIC);
endcomponent;
--------------------------------------------------------
componentmux6is
port(clkscan,reset:
instd_logic;
in1,in2,in3,in4,in5,in6:
instd_logic_vector(3downto0);
BT:
outstd_logic_vector(7downto0);
A:
outstd_logic_vector(3downto0));
endcomponent;
---------------------------------------------------------
componentyimais
port(BT1:
instd_logic_vector(3downto0);
LED7:
outstd_logic_vector(6downto0));
endcomponent;
---------------------------------------------------------
endmy_components;
---------------------------------------------------------
------------------time-----------------------------------
libraryIEEE;
useIEEE.std_logic_1164.all;
useIEEE.std_logic_arith.all;
useIEEE.std_logic_unsigned.all;
usework.my_components.all;
---------------------------------------------------------
entitytimeis
port(clk,clkscan,reset:
instd_logic;
LED7:
outstd_logic_vector(6downto0);
BT:
outstd_logic_vector(7downto0));
endtime;
---------------------------------------------------------
architecturestructuraloftimeis
signalx3,x4,x5:
std_logic;
signalx6,x7,x8,x9,x10,x11,x12:
std_logic_vector(3downto0);
begin
u1:
componentsecondportmap(x3,reset,x6,x7,x4);
u2:
componentminuteportmap(x4,reset,x8,x9,x5);
u3:
componenthourportmap(x5,reset,x10,x11);
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- EDA 课程设计