EDA电子抢答器课程设计.docx

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

EDA电子抢答器课程设计.docx

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

EDA电子抢答器课程设计.docx

EDA电子抢答器课程设计

课程设计报告

电子抢答器设计

课程:

可编程器件及应用课程设计

班级:

2012142216

姓名:

曹勤陈有玲陈淑媛

指导教师:

黄林

 

2014年11月20日

 

1课题背景---------------------------------------------------3

1.1设计的目的-----------------------------------------3

1.2系统功能及要求------------------------------------3

2程序功能模块组成及流程图--------------------------------4

2.1程序功能模块组成----------------------------------4

2.2程序流程图------------------------------------------4

3程序代码及模块分析----------------------------------------4

4运行结果------------------------------------------------------12

5实验现象------------------------------------------------------16

6总结与体会-------------------------------------------------18

 

1.课题背景

EDA及电子设计自动化,是指使用计算机自动完成电子系统的设计,应用EDA技术进行电子产品的设计已成为当今电子工程师的一项基本技。

随着电子技术和计算机技术的飞速发展,新的高度集成的电子设计方法不断推出,电子产品的性能越来越高,更新的速度也越来越快,与此同时,市场对电子产品的设计提出了更为严格的要求,从而促进了电子设计自动化(EDA)技术的迅速发展

在多项竞赛及节目上都用到电子抢答器,他们抢答所使用的抢答器就是我这次要做的课程设计的内容。

有了抢答器会使选手间更加公平、公正、公开,也方便了主持人对现场的主持。

1.1设计的目的

本次课程设计的目的是在学习完EDA课程的基础上,运用EDA的知识即VHDL语言,编写程序来实现此次我设计的电子抢答器所要实现的功能,不仅会编写程序,还要能够在实验室中检测我所编写的程序是否能够达到预期的目的。

1.2系统功能及要求

(1)优先编码器电路立即分辨出抢答者编号,并由锁存器进行锁存,然后由译码显示电路显示编号;

(2)扬声器发出短暂声响,提醒主持人注意;

(3)控制电路要对输入编码电路进行封锁,避免其他选手再次进行抢答;(4)当选手将问题回答完毕,主持人操作计分开关,计分电路采用十进制加/减计数器、数码管显示。

本轮抢答完毕,主持人操作控制开关,使系统回复到禁止工作状态,以便进行下一轮抢答。

2.程序功能模块组成及流程图

2.1程序功能模块组成

本程序主要设计了七个模块,分别是:

1.抢答鉴别模块

2.计时模块

3.数据选择模块

4.报警模块

5.译码模块

6.计分模块

7.控制模块

2.2程序流程图

 

 

3.程序代码及模块分析

3.1抢答鉴别模块

鉴别锁存模块的关键是准确判断出第一抢答者并将其锁存,实现的方法可使用触发器或锁存器,在得到第一信号后将输入封锁,使其它组的抢答信号无效。

形成第一抢答信号后,用编码、译码及数码显示电路显示第一抢答者的组号并启动答题计时电路。

抢答鉴别电路可以由VHDL程序来实现,以下是一断抢答鉴别的VHDL程序:

libraryieee;

useieee.std_logic_1164.all;

useieee.std_logic_unsigned.all;

entityidentifyis

port(ret,clk:

instd_logic;

a0,a1,a2,a3:

instd_logic;

states:

bufferstd_logic_vector(3downto0);

tmp:

outstd_logic);

endidentify;

architecturebehavofidentifyis

signalst:

std_logic_vector(3downto0);

begin

process(clk,ret,a0,a1,a2,a3)

begin

ifret='1'then

tmp<='0';

st<="0000";

elsifclk'eventandclk='1'then

if(a0='1'orst(0)='1')andnot(st

(1)='1'orst

(2)='1'orst(3)='1')thenst(0)<='1';

endif;

if(a1='1'orst

(1)='1')andnot(st(0)='1'orst

(2)='1'orst(3)='1')thenst

(1)<='1';

endif;

if(a2='1'orst

(2)='1')andnot(st(0)='1'orst

(1)='1'orst(3)='1')thenst

(2)<='1';

endif;

if(a3='1'orst(3)='1')andnot(st(0)='1'orst

(1)='1'orst

(2)='1')thenst(3)<='1';

endif;

tmp<=st(0)orst

(1)orst

(2)orst(3);

endif;

endprocess;

process(states(0),states

(1),states

(2),states(3))

begin

if(st="0000")thenstates<="0000";

elsif(st<="0001")thenstates<="0001";

elsif(st<="0010")thenstates<="0010";

elsif(st<="0100")thenstates<="0011";

elsif(st<="1000")thenstates<="0100";

endif;

endprocess;

endbehav;

 

3.2计时模块

抢答计时模块的任务是当主持人启动这个计时开关时开始计时,如果在规定的时间内答完题则答题有效,如果在规定的时间内没有完成,则答题无效。

计时器从规定的时间倒计时,计时为零时计时结束。

答题有无效作凭主持人来判断。

计时电路可以由VHDL程序来实现,以下是一段计时的VHDL程序:

libraryieee;

useieee.std_logic_1164.all;

useieee.std_logic_unsigned.all;

entitytimedis

port(clk,ret,sin:

instd_logic;

time1,time2:

bufferstd_logic_vector(3downto0);

warningg:

outstd_logic);

endtimed;

architecturebehavoftimedis

signalco:

std_logic;

begin

process(clk,ret,sin,time1)

begin

ifret='1'then

time1<="0000";

elsifclk'eventandclk1='1'then

co<='0';

ifsin='1'then

iftime1="0000"then

time1<="1001";co<='1';

elsetime1<=time1-1;

endif;

endif;

endif;

endprocess;

process(co,ret,sin,time2)

begin

ifret='1'then

time2<="0010";

elsifco'eventandco='1'then

ifsin='1'then

iftime2="0000"thentime2<="0010";

elsetimee2<=time2-1;

endif;

endif;

endif;

if(time1="0000"andtime2="0000")then

warning<='1';

elsewarning<='0';

endif;

endprocess;

endbehav;

3.3数据选择模块

输入三路信号,上升沿到来时count加一,当count=“00“时,选择in1路信;当count=“01“时,选择in2路信号;当count=“10“时,选择c路信号;等于其他信号时无操作。

数据选择电路可以由VHDL程序来实现,以下是一段数据选择的VHDL程序:

libraryieee;

useieee.std_logic_1164.all;

useieee.std_logic_unsigned.all;

useieee.std_logic_arith.all;

entityselecteis

port(in1,in2,in3:

instd_logic_vector(3downto0);

clk,ret:

instd_logic;

s:

outstd_logic_vector(1downto0);

y:

outstd_logic_vector(3downto0));

endselecte;

architecturebehavofselecteis

signalcount:

std_logic_vector(1downto0);

begin

s<=count;

process(clk,ret)

begin

if(ret='1')thencount<="00";

elsif(clk'eventandclk='1')then

if(count>="10")then

count<="00";

elsecount<=count+1;

endif;

endif;

casecountis

when"00"=>y<=in1;

when"01"=>y<=in2;

when"10"=>y<=in3;

whenothers=>null;

endcase;

endprocess;

endbehav;

3.4报警模块

当输入信号无效或超时时就启动报警模块计。

报警电路可以由VHDL程序来实现,以下是一段报警的VHDL程序:

libraryieee;

useieee.std_logic_1164.all;

useieee.std_logic_unsigned.all;

entityreporteis

port(clk,l:

instd_logic;

q:

outstd_logic);

endreporte;

architecturebehavofreporteis

begin

process(l,clk)

begin

ifl='0'then

q<='0';

elsifl='1'then

q<=clk;

endif;

endprocess;

endbehav;

3.5译码模块

抢答成功后输出选手组号。

译码电路可以由VHDL程序来实现,以下是一段译码的VHDL程序:

libraryieee;

useieee.std_logic_1164.all;

useieee.std_logic_unsigned.all;

entitytranslateis

port(din:

instd_logic_vector(3downto0);

dout:

outstd_logic_vector(6downto0));

endtranslate;

architecturebehavoftranslateis

begin

process(din)

begin

casedinis

when"0000"=>dout<="1111110";--0

when"0001"=>dout<="0110000";--1

when"0010"=>dout<="1101101";--2

when"0011"=>dout<="1111001";--3

when"0100"=>dout<="0110011";--4

when"0101"=>dout<="1011011";--5

when"0110"=>dout<="1011111";--6

when"0111"=>dout<="1110000";--7

when"1000"=>dout<="1111111";--8

when"1001"=>dout<="1111011";--9

whenothers=>dout<="0000000";

endcase;

endprocess;

endbehav;

3.6计分模块

当选手回答完毕后,主持人判断是否正确,酌情加分,若回答正确,加一分,否则不加分,也不减分。

计分电路可以由VHDL程序来实现,以下是一段计分的VHDL程序:

libraryieee;

useieee.std_logic_1164.all;

useieee.std_logic_unsigned.all;

useieee.std_logic_arith.all;

entityjfis

port(q:

inbit;

count:

outstd_logic_vector(3downto0));

endjf;

architecturebehavofjfis

signaltemp:

std_logic_vector(3downto0):

="0000";

begin

process(q)

begin

if(q='1')then

temp<=temp+1;

endif;

endprocess;

count<=temp;

endbehav;

3.7控制模块

输入两路信号a和b,b=‘0’时,将a输出,否则输出‘0’。

控制电路可以由VHDL程序来实现,以下是一段控制的VHDL程序:

ibraryieee;

useieee.std_logic_1164.all;

useieee.std_logic_unsigned.all;

entitymanageis

port(a,b:

instd_logic;

c:

outstd_logic

);

endmanage;

architecturebehavofmanageis

begin

process(b,a)

begin

ifb='1'thenc<='0';

elsifb='0'thenc<=a;

endif;

endprocess;

endbehav;

4.运行结果

1.抢答鉴别模块仿真图

2.计时模块仿真图

3.数据选择模块仿真图

4.报警模块仿真图

5.译码模块仿真图

6.计分模块仿真图

7.控制模块仿真图

4、实验现象

选手组号:

计时显示

.

.

.

.

.

.

6、总结与体会

通过本次试验,掌握了EDA的基本方法,提高了自身的思维水平,增强了动手实践的能力,将可编程器件及运用的知识运用于实践中。

对EDA设计有了很多的领会。

在查阅资料的同时,发现EDA的在社会中得应用非常广泛,涉及到很多生活的各个方面,所以在今后的学习时间里,我们会不断的学习EDA,加强此方面知识的深度,对EDA的要求也要不断提高,不仅仅再局限于书本上的知识。

学好EDA,会对我们在以后的社会及生活有很大的帮助。

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

当前位置:首页 > 人文社科 > 法律资料

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

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