EDA电子抢答器课程设计Word文档格式.docx

上传人:b****5 文档编号:17080390 上传时间:2022-11-28 格式:DOCX 页数:17 大小:622.02KB
下载 相关 举报
EDA电子抢答器课程设计Word文档格式.docx_第1页
第1页 / 共17页
EDA电子抢答器课程设计Word文档格式.docx_第2页
第2页 / 共17页
EDA电子抢答器课程设计Word文档格式.docx_第3页
第3页 / 共17页
EDA电子抢答器课程设计Word文档格式.docx_第4页
第4页 / 共17页
EDA电子抢答器课程设计Word文档格式.docx_第5页
第5页 / 共17页
点击查看更多>>
下载资源
资源描述

EDA电子抢答器课程设计Word文档格式.docx

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

EDA电子抢答器课程设计Word文档格式.docx

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

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:

states:

bufferstd_logic_vector(3downto0);

tmp:

outstd_logic);

endidentify;

architecturebehavofidentifyis

signalst:

std_logic_vector(3downto0);

begin

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

ifret='

1'

then

tmp<

='

0'

;

st<

="

0000"

elsifclk'

eventandclk='

then

if(a0='

orst(0)='

)andnot(st

(1)='

orst

(2)='

orst(3)='

)thenst(0)<

endif;

if(a1='

orst

(1)='

)andnot(st(0)='

)thenst

(1)<

if(a2='

)thenst

(2)<

if(a3='

)thenst(3)<

=st(0)orst

(1)orst

(2)orst(3);

endprocess;

process(states(0),states

(1),states

(2),states(3))

if(st="

)thenstates<

elsif(st<

0001"

0010"

0100"

0011"

1000"

endif;

endbehav;

3.2计时模块

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

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

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

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

entitytimedis

port(clk,ret,sin:

time1,time2:

warningg:

endtimed;

architecturebehavoftimedis

signalco:

std_logic;

process(clk,ret,sin,time1)

time1<

eventandclk1='

co<

ifsin='

iftime1="

1001"

elsetime1<

=time1-1;

endif;

endprocess;

process(co,ret,sin,time2)

time2<

elsifco'

eventandco='

iftime2="

thentime2<

elsetimee2<

=time2-1;

if(time1="

andtime2="

)then

warning<

elsewarning<

3.3数据选择模块

输入三路信号,上升沿到来时count加一,当count=“00“时,选择in1路信;

当count=“01“时,选择in2路信号;

当count=“10“时,选择c路信号;

等于其他信号时无操作。

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

libraryieee;

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)

if(ret='

)thencount<

00"

elsif(clk'

)then

if(count>

10"

count<

elsecount<

=count+1;

casecountis

when"

=>

y<

=in1;

01"

=in2;

=in3;

whenothers=>

null;

endcase;

endprocess;

3.4报警模块

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

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

entityreporteis

port(clk,l:

q:

endreporte;

architecturebehavofreporteis

process(l,clk)

ifl='

q<

elsifl='

q<

=clk;

3.5译码模块

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

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

entitytranslateis

port(din:

dout:

outstd_logic_vector(6downto0));

endtranslate;

architecturebehavoftranslateis

process(din)

casedinis

dout<

1111110"

--0

0110000"

--1

1101101"

--2

1111001"

--3

0110011"

--4

0101"

1011011"

--5

0110"

1011111"

--6

0111"

1110000"

--7

1111111"

--8

1111011"

--9

0000000"

endprocess;

3.6计分模块

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

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

entityjfis

port(q:

inbit;

count:

outstd_logic_vector(3downto0));

endjf;

architecturebehavofjfis

signaltemp:

std_logic_vector(3downto0):

process(q)

if(q='

)then

temp<

=temp+1;

count<

=temp;

3.7控制模块

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

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

ibraryieee;

entitymanageis

port(a,b:

c:

outstd_logic

);

endmanage;

architecturebehavofmanageis

process(b,a)

ifb='

thenc<

elsifb='

=a;

4.运行结果

1.抢答鉴别模块仿真图

2.计时模块仿真图

3.数据选择模块仿真图

4.报警模块仿真图

5.译码模块仿真图

6.计分模块仿真图

7.控制模块仿真图

4、实验现象

选手组号:

计时显示

.

6、总结与体会

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

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

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

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

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

当前位置:首页 > 小学教育 > 数学

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1