EDA课程设计报告电子抢答器_第1页
EDA课程设计报告电子抢答器_第2页
EDA课程设计报告电子抢答器_第3页
已阅读5页,还剩14页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

1、得分:课程设计报告电子抢答器设计课程:可编程器件及使用课程设计班级:学号:姓名:指导教师:2011年 月 日目录1课题背景 31.1 设计的目的31.2 系统功能及要求 32程序功能模块组成及流程图 42.1 程序功能模块组成 42.2 程序流程图43程序代码及模块分析 44运行结果 125实验现象16 6总结和体会1 .课题背景EDA 及电子设计自动化,是指使用计算机自动完成电子系统的设计,使用EDA 技术进行电子产品的设计已成为当今电子工程师的一项基本技。随着电子 技术和计算机技术的飞速发展, 新的高度集成的电子设计方法不断推出, 电子产 品的性能越来越高, 更新的速度也越来越快, 和此同

2、时, 市场对电子产品的设计 提出了更为严格的要求,从而促进了电子设计自动化( EDA )技术的迅速发展 在多项竞赛及节目上都用到电子抢答器,他们抢答所使用的抢答器就是我 这次要做的课程设计的内容。有了抢答器会使选手间更加公平、公正、公开,也 方便了主持人对现场的主持。1.1 设计的目的本次课程设计的目的是在学习完 EDA 课程的基础上,运用 EDA 的知识即 VHDL 语言,编写程序来实现此次我设计的电子抢答器所要实现的功能,不仅会 编写程序,还要能够在实验室中检测我所编写的程序是否能够达到预期的目的。1.2 系统功能及要求(1)优先编码器电路立即分辨出抢答者编号,并由锁存器进行锁存,然后 由

3、译码显示电路显示编号;(2)扬声器发出短暂声响,提醒主持人注意;(3)控制电路要对输入编码电路进行封锁,避免其他选手再次进行抢答;(4)当选手将问题回答完毕,主持人操作计分开关,计分电路采用十进制 加/ 减计数器、数码管显示。本轮抢答完毕,主持人操作控制开关,使系统 回复到禁止工作状态,以便进行下一轮抢答。2程序功能模块组成及流程图2.1 程序功能模块组成本程序主要设计了七个模块,分别是:1. 抢答鉴别模块2. 计时模块3. 数据选择模块4. 报警模块5. 译码模块6. 计分模块7. 控制模块2.2 程序流程图3.程序代码及模块分析3.1抢答鉴别模块鉴别锁存模块的关键是准确判断出第一抢答者并将

4、其锁存,实现的方法可 使用触发器或锁存器,在得到第一信号后将输入封锁,使其它组的抢答信号 无效。形成第一抢答信号后,用编码、译码及数码显示电路显示第一抢答者 的组号并启动答题计时电路。抢答鉴别电路可以由VHDL程序来实现,以下是一断抢答鉴别的 VHDL程 序:library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_ un sig ned.all; en tity ide ntify isport(ret,clk:in std_logic;a0,a1,a2,a3:in stdo gic;states:buffer std_logic

5、_vector(3 downto 0);tmp:out stdo gic);end ide ntify;architecture behav of ide ntify is signal st:stdogic_vector(3 downto 0); begi n process(clk , ret,a0, a1,a2,a3)begi nif ret=1 then tmp=0;st=0000;elsif clkeve nt and clk=1 the nif (a0=1 or st(0)=1)and not( st(1)=1 or st(2)=1 or st(3)=1 ) thenst(0)=1

6、;end if ;the nif (a1=1 or st(1)=1)a nd not( st(0)=1 or st(2)=1 or st( 3)=1)st(1)=1;end if ;if (a2=1 or st(2)=1)and not( st(0)=1 or st(1)=1 or st(3)=1 )thenst(2)=1;end if ;if (a3=1 or st(3)=1)and not( st(0)=1 or st(1)=1 or st(2)=1 ) then st(3)=1;end if ;tmp=st(0) or st(1) or st(2) or st(3);end if ;en

7、d process;process(states(0),states(1),states(2),states(3)beginif (st=0000) then states=0000;elsif (st=0001) then states=0001;elsif (st=0010) then states=0010;elsif (st=0100) then states=0011;elsif (st=1000) then states=0100;end if;end process;end behav;3.2 计时模块抢答计时模块的任务是当主持人启动这个计时开关时开始计时, 如果在规定 的时间内

8、答完题则答题有效, 如果在规定的时间内没有完成, 则答题无效。 计时 器从规定的时间倒计时,计时为零时计时结束。答题有无效作凭主持人来判断。计时电路可以由 VHDL 程序来实现,以下是一段计时的 VHDL 程序:library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity timed is port(clk,ret,sin:in std_logic; time1,time2:buffer std_logic_vector(3 downto 0); warningg:out std_logic);e

9、nd timed ; architecture behav of timed is signal co:std_logic;begin process(clk,ret,sin,time1) begin if ret=1 then time1=0000;elsif clkevent and clk1=1 then co=0;if sin=1 thenif time1=0000 then time1=1001;co=1; else time1=time1-1;end if;end if;end if; end process ;process(co,ret,sin,time2) begin if

10、ret=1 then time2=0010;elsif coevent and co=1 thenif sin=1 thenif time2=0000 then time2=0010; else timee2=time2-1;end if;end if;end if;if(time1=0000 and time2=0000) then warning=1;else warning=0; end if;end process;end behav;3.3 数据选择模块输入三路信号,上升沿到来时count加一,当count= “00 “时,选择ini路信; 当count= “01 “时,选择in2路

11、信号;当count= “ 10 “时,选择c路信号;等于 其他信号时无操作。数据选择电路可以由 VHDL 程序来实现, 以下是一段数据选择的 VHDL 程序:library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;use ieee.std_logic_arith.all;entity selecte isport (in1,in2,in3: in std_logic_vector(3 downto 0);clk,ret: instd_logic;s: outstd_logic_vector(1 downt

12、o 0);y: out std_logic_vector(3 downto 0) ); end selecte;architecture behav of selecte issignal count: std_logic_vector (1 downto 0);begins=count;process(clk,ret)beginif(ret=1)then count=10)then count=00;else countyyynull;end case;end process ;end behav;3.4 报警模块 当输入信号无效或超时时就启动报警模块计。 报警电路可以由 VHDL 程序来实

13、现,以下是一段报警的 VHDL 程序:library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all; entity reporte is port(clk,l:in std_logic;q:out std_logic);end reporte;architecture behav of reporte is beginprocess(l,clk)beginif l=0 thenq =0; elsif l=1 then qdoutdoutdoutdoutdoutdoutdoutdoutdoutdoutdout=0

14、000000;end case;end process;end behav;3.6 计分模块当选手回答完毕后, 主持人判断是否正确, 酌情加分, 若回答正确,加一分, 否则不加分,也不减分。计分电路可以由 VHDL 程序来实现,以下是一段计分的 VHDL 程序:library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;use ieee.std_logic_arith.all;entity jf isport(q:in bit;count:out std_logic_vector(3 downto 0); e

15、nd jf;architecture behav of jf issignal temp:std_logic_vector(3 downto 0):=0000; beginprocess(q) beginif(q=1)thentemp=temp+1;end if;end process;count=temp;end behav;3.7 控制模块输入两路信号a和b, b= O时,将a输出,否则输出 0。控制电路可以由 VHDL 程序来实现,以下是一段控制的 VHDL 程序:ibrary ieee ;use ieee.std_logic_1164.all;use ieee.std_logic_un

16、signed.all;entity manage isport ( a,b:in std_logic;);end man age;architecture behav of man age is begi nprocess(b,a)beg inif b=1 then c=0;elsif b=0 the n c=a;end if;end process;end behav;4.运行结果1.抢答鉴别模块仿真图Master Time Bar18.025 ns *1 Patitei:339 ps IrrtazM:17.69 r SlaitEnd:h-ntleId1 -S *2.计时模块仿真图_ster

17、 Time Bar13.025 ns* * Pcimei:2B.17nsInteivaft10.15 n&SlitEndb妙亡Volu.4-9B. 0210 9 n= 曲 血9 九三?115 so-9n= 60 ?TO-9 n= e v115A3130*13elk* IF&tK iSLIh丸timeUA Llint2A k iIB. 025 ns dIII创x区ix【丁】xr 【幻 丫 X x何-1tn113.数据选择模块仿真图faster Time Bai:19.025nPcirter:261 m Intervat-15.42 ns Start:Endt4.报警模块仿真图11 a.tioei

18、 node: functiqh-lLMarfff Tr*|jyj和y -Refwrt -隕 E1& F?e E#ii护幘记 prat-wa Iwh 土问叶 出归.旦.J. HQsfa s-3 H2 W 怡比专醫& *| 令Ripcri - Fk*Sumwr佃5 HA心3m打 ir*H. Jr| INI I Jug d MnuaRiKzr-kMieiia-Eml切CMbirrhlLfUl13i.rii.iE 1 ALTQ一昏jW1 IT$3HdALUL bf! Fwcmiud4ihan 関 Rpi gd NotEi lew Sun me | &unvnw*i |MJ01H inV4fsj In-, afld 15X 1

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

最新文档

评论

0/150

提交评论