EDA课程设计秒表设计.docx

上传人:b****2 文档编号:2538557 上传时间:2023-05-03 格式:DOCX 页数:17 大小:843.09KB
下载 相关 举报
EDA课程设计秒表设计.docx_第1页
第1页 / 共17页
EDA课程设计秒表设计.docx_第2页
第2页 / 共17页
EDA课程设计秒表设计.docx_第3页
第3页 / 共17页
EDA课程设计秒表设计.docx_第4页
第4页 / 共17页
EDA课程设计秒表设计.docx_第5页
第5页 / 共17页
EDA课程设计秒表设计.docx_第6页
第6页 / 共17页
EDA课程设计秒表设计.docx_第7页
第7页 / 共17页
EDA课程设计秒表设计.docx_第8页
第8页 / 共17页
EDA课程设计秒表设计.docx_第9页
第9页 / 共17页
EDA课程设计秒表设计.docx_第10页
第10页 / 共17页
EDA课程设计秒表设计.docx_第11页
第11页 / 共17页
EDA课程设计秒表设计.docx_第12页
第12页 / 共17页
EDA课程设计秒表设计.docx_第13页
第13页 / 共17页
EDA课程设计秒表设计.docx_第14页
第14页 / 共17页
EDA课程设计秒表设计.docx_第15页
第15页 / 共17页
EDA课程设计秒表设计.docx_第16页
第16页 / 共17页
EDA课程设计秒表设计.docx_第17页
第17页 / 共17页
亲,该文档总共17页,全部预览完了,如果喜欢就下载吧!
下载资源
资源描述

EDA课程设计秒表设计.docx

《EDA课程设计秒表设计.docx》由会员分享,可在线阅读,更多相关《EDA课程设计秒表设计.docx(17页珍藏版)》请在冰点文库上搜索。

EDA课程设计秒表设计.docx

EDA课程设计秒表设计

 

题目:

秒表设计

班级:

通信11-3

小组成员:

易新会、王伟、陈虹余、迪拉热

指导老师:

黄志华

学院:

信息科学与工程学院

 

2014年1月1日

内容

一:

设计任务与要求

秒表的逻辑结构比较简单,它主要由、显示译码器、分频器、十进制计数器、报警器和六进制计数器组成。

在整个秒表中最关键是如何获得一个精确的100Hz计时脉冲,除此之外,整个秒表还需要一个启动信号和一个归零信号,以便能够随时启动及停止。

秒表有六个输出显示,分别为百分之一秒,十分之一秒、秒、十秒、分、十分,所以共有6个计数器与之对应,6个个计数器全为BCD码输出,这样便于同时显示译码器的连接。

当计时达60分钟后,蜂鸣器鸣响3声。

二:

设计原理

本系统采用自上向下的设计方案,系统的整体设计组装原理图如图2-1所示,它主要由控制模块,时基分屏模块,计时模块和显示模块四部分组成。

各模块分别完成控制,分屏,计时和显示的功能

设计原理图

三、程序模块

1、控制模块程序

libraryieee;

useieee.std_logic_1164.all;

useieee.std_logic_unsigned.all;

entityctrlis

port(clr,clk,sp:

instd_logic;

en:

outstd_logic);

endctrl;

architecturebehaveofctrlis

typestatesis(s0,s1,s2,s3);

signalcurrent_state,next_state:

states;

begin

com:

process(sp,current_state)

begin

casecurrent_stateis

whens0=>en<='0';ifsp='1'thennext_state<=s1;elsenext_state<=s0;endif;

whens1=>en<='1';ifsp='1'thennext_state<=s1;elsenext_state<=s2;endif;

whens2=>en<='1';ifsp='1'thennext_state<=s3;elsenext_state<=s2;endif;

whens3=>en<='0';ifsp='1'thennext_state<=s3;elsenext_state<=s0;endif;

endcase;

endprocess;

synch:

process(clk)

begin

ifclr='1'then

current_state<=s0;

elsifclk'eventandclk='1'then

current_state<=next_state;

endif;

endprocess;

endbehave;

2、时基分频模块程序

libraryieee;

useieee.std_logic_1164.all;

entitycb10is

port(clk:

instd_logic;

co:

bufferstd_logic);

endcb10;

architectureartofcb10is

signalcounter:

integerrange0to49999;

begin

process(clk)

begin

if(clk='1'andclk'event)then

ifcounter=49999then

counter<=0;

co<=notco;

else

counter<=counter+1;

endif;

endif;

endprocess;

endart;

3、计时模块的程序

1)、十进制计数器

libraryieee;

useieee.std_logic_1164.all;

useieee.std_logic_unsigned.all;

entitycdu10is

port(clk,clr,en:

instd_logic;

cn:

outstd_logic;

count10:

outstd_logic_vector(3downto0));

endcdu10;

architectureartofcdu10is

signaltemp:

std_logic_vector(3downto0);

begin

process(clk,clr)

begin

ifclr='1'then

temp<="0000";

cn<='0';

elsif(clk'eventandclk='1')then

ifen='1'then

iftemp>="1001"then

temp<="0000";

cn<='1';

else

temp<=temp+1;

cn<='0';

endif;

endif;

endif;

count10<=temp;

endprocess;

endart;

2)、六进制计数器

libraryieee;

useieee.std_logic_1164.all;

useieee.std_logic_unsigned.all;

entitycdu6is

port(clk,clr,en:

instd_logic;

cn:

outstd_logic;

count6:

outstd_logic_vector(3downto0));

endcdu6;

architectureartofcdu6is

signaltemp:

std_logic_vector(3downto0);

begin

process(clk,clr)

begin

ifclr='1'then

temp<="0000";

cn<='0';

elsif(clk'eventandclk='1')then

ifen='1'then

iftemp="0110"then

temp<="0000";

cn<='1';

else

temp<=temp+1;

cn<='0';

endif;

endif;

endif;

count6<=temp;

endprocess;

endart;

3)计时器程序

libraryieee;

useieee.std_logic_1164.all;

entitycountis

port(clk:

instd_logic;

clr:

instd_logic;

en:

instd_logic;

S_10ms:

outstd_logic_vector(3downto0);

S_100ms:

outstd_logic_vector(3downto0);

S_1s:

outstd_logic_vector(3downto0);

S_10s:

outstd_logic_vector(3downto0);

M_1min:

outstd_logic_vector(3downto0);

M_10min:

outstd_logic_vector(3downto0));

endcount;

architectureartofcountis

componentcdu10

port(clk,clr,en:

instd_logic;

cn:

outstd_logic;

count10:

outstd_logic_vector(3downto0));

endcomponentcdu10;

componentcdu6

port(clk,clr,en:

instd_logic;

cn:

outstd_logic;

count6:

outstd_logic_vector(3downto0));

endcomponentcdu6;

signalA,B,C,D,E,F:

std_logic;

begin

U1:

cdu10portmap(clk,clr,en,A,S_10ms);

U2:

cdu10portmap(A,clr,en,B,S_100ms);

U3:

cdu10portmap(B,clr,en,C,S_1s);

U4:

cdu6portmap(C,clr,en,D,S_10s);

U5:

cdu10portmap(D,clr,en,E,M_1min);

U6:

cdu10portmap(E,clr,en,F,M_10min);

endart;

4、显示模块程序

1)七段译码驱动器程序

libraryieee;

useieee.std_logic_1164.all;

useieee.std_logic_unsigned;

entitybcd7is

port(bcd:

instd_logic_vector(3downto0);

led:

outstd_logic_vector(6downto0));

endbcd7;

architectureartofbcd7is

begin

led<="0111111"whenbcd="0000"else

"0000110"whenbcd="0001"else

"1011011"whenbcd="0010"else

"1001111"whenbcd="0011"else

"1100110"whenbcd="0100"else

"1101101"whenbcd="0101"else

"1111101"whenbcd="0110"else

"0000111"whenbcd="0111"else

"1111111"whenbcd="1000"else

"1101111"whenbcd="1001"else

"0000000";

endart;

2)数据选择器程序

libraryieee;

useieee.std_logic_1164.all;

useieee.std_logic_UNSIGNED.all;

entitymulxis

port(clk:

instd_logic;

clr:

instd_logic;

en:

instd_logic;

S_10ms:

instd_logic_vector(3downto0);

S_100ms:

instd_logic_vector(3downto0);

S_1s:

instd_logic_vector(3downto0);

S_10s:

instd_logic_vector(3downto0);

M_1min:

instd_logic_vector(3downto0);

M_10min:

instd_logic_vector(3downto0);

outbcd:

outstd_logic_vector(3downto0);

seg:

outstd_logic_vector(2downto0));

endmulx;

architectureartofmulxis

signalcount:

std_logic_vector(2downto0);

begin

process(clk)

begin

if(clr='1')then

count<="111";

elsif(clk='1'andclk'event)then

ifen='1'then

ifcount="101"then

count<="000";

elsecount<=count+1;

endif;

endif;

endif;

endprocess;

process(clk)

begin

ifclk'eventandclk='1'then

casecountis

when"000"=>outbcd<=S_10ms;seg<="000";

when"001"=>outbcd<=S_100ms;seg<="001";

when"010"=>outbcd<=S_1s;seg<="010";

when"011"=>outbcd<=S_10s;seg<="011";

when"100"=>outbcd<=M_1min;seg<="100";

when"101"=>outbcd<=M_10min;seg<="101";

whenothers=>null;

endcase;

endif;

endprocess;

endart;

5、顶层设计源程序

libraryieee;

useieee.std_logic_1164.all;

entitystopwatchis

port(sp:

instd_logic;

clr:

instd_logic;

clk:

instd_logic;

led:

outstd_logic_vector(6downto0);

seg:

outstd_logic_vector(2downto0));

endstopwatch;

architectureartofstopwatchis

componentctrl

port(clr:

instd_logic;

clk:

instd_logic;

sp:

instd_logic;

en:

outstd_logic);

endcomponent;

componentcb10

port(clk:

instd_logic;

co:

outstd_logic);

endcomponent;

componentcount

port(clk:

instd_logic;

clr:

instd_logic;

en:

instd_logic;

S_10ms:

outstd_logic_vector(3downto0);

S_100ms:

outstd_logic_vector(3downto0);

S_1s:

outstd_logic_vector(3downto0);

S_10s:

outstd_logic_vector(3downto0);

M_1min:

outstd_logic_vector(3downto0);

M_10min:

outstd_logic_vector(3downto0));

endcomponent;

componentbcd7

port(bcd:

instd_logic_vector(3downto0);

led:

outstd_logic_vector(6downto0));

endcomponent;

componentmulx

port(clr:

instd_logic;

clk:

instd_logic;

en:

instd_logic;

S_10ms:

instd_logic_vector(3downto0);

S_100ms:

instd_logic_vector(3downto0);

S_1s:

instd_logic_vector(3downto0);

S_10s:

instd_logic_vector(3downto0);

M_1min:

instd_logic_vector(3downto0);

M_10min:

instd_logic_vector(3downto0);

outbcd:

outstd_logic_vector(3downto0);

seg:

outstd_logic_vector(2downto0));

endcomponent;

signalc,e:

std_logic;

signalms10_s,ms100_s:

std_logic_vector(3downto0);

signals1_s,s10_s:

std_logic_vector(3downto0);

signalmin1_s,min10_s:

std_logic_vector(3downto0);

signalbcd_s,s:

std_logic_vector(3downto0);

begin

u0:

ctrlportmap(clr,clk,sp,e);

u1:

cb10portmap(clk,c);

u2:

countportmap(c,clr,e,ms10_s,ms100_s,s1_s,s10_s,min1_s,min10_s);

u3:

mulxportmap(clr,clk,e,ms10_s,ms100_s,s1_s,s10_s,min1_s,min10_s,bcd_s,seg);

u4:

bcd7portmap(bcd_s,led);

endart;

四、设计解决的关键问题

本次设计的关键性问题是分频和顶层文件的设计,在分频代码段中可以看出我们本次采用的主频率是5MHZ。

1/100秒的频率为100HZ所以只需要用5MHZ乘以1/50000即可得到100HZ的分频信号,即1/100秒。

数码管显示部分的关键就是弄清楚每个数字对应的二进制代码,刚开始我们用画原理图的方法进行顶层文件设计,完成了实验,而后又尝试用VHDL语言进行程序设计,虽然程序复杂而且老出编译错误,期间反复看书,和上网查找资料,经过几天的修改终于将此顶层程序的设计工作完成。

五:

设计分工说明

1,主程序设计,编写实验报告——易新会

2,程序修改,用VHDL语言顶层文件设计——陈虹余

3,上机硬件调试,用原理图的方法设计顶层文件——王伟

4,收集相关资料、拍照——迪拉热

仿真结果与分析

一:

测试数据选择

测试数据选择为00:

00:

00——03:

56:

38

二:

波形分析

三:

问题说明

数码管的显示由sel片选信号来控制。

硬件调试功能正常。

总结

开始VHDL语言不是很熟练,做设计时总是会犯一些错误且花费的时间比较多,例如在做顶层文件设计的时候总是会出现一些编译错误,其中有些错误是因为一个字母没写对而导致,相比较来说在此次设计中用原理图做顶层设计似乎更容易,当然这主要是我们做的这个小设计不是一个大型的系统,当系统复杂时用VHDL语言更省事,在编程时,我们使用了自顶向下的设计思想,这样程序检查起来也比较方便,也便于小组分工,做EDA设计考验我们的耐心、毅力和细心,而对错误的检查要求我们要有足够的耐心,通过这次实战,我们对VHDL语言了解的更深了,也积累了一定的解决问题的经验,对以后从事集成电路设计工作会有一定的帮助。

在设计工作中,分工很重要,即使你一个人能够把整个程序写出来,但与分工良好的组相比较,分工不好的组效率更低

在应用VHDL的过程中我们领会到了其并行运行与其他软件顺序执行的差别及其在电路设计上的优越性。

用VHDL硬件描述语言的形式来进行数字系统的设计方便灵活,利用EDA软件进行编译优化仿真极大地减少了电路设计时间和可能发生的错误,降低了开发成本,这门技术应用很广泛,纵然这份报告的上交意味着我们可以结课了,但对这方面的学习不会止步......

展开阅读全文
相关资源
猜你喜欢
相关搜索
资源标签

当前位置:首页 > 工程科技 > 能源化工

copyright@ 2008-2023 冰点文库 网站版权所有

经营许可证编号:鄂ICP备19020893号-2