基于EDA的智能抢答器_第1页
基于EDA的智能抢答器_第2页
基于EDA的智能抢答器_第3页
基于EDA的智能抢答器_第4页
基于EDA的智能抢答器_第5页
已阅读5页,还剩17页未读 继续免费阅读

下载本文档

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

文档简介

1、江西理工大学应用科学学院sopc/eda综合课程设计报告设计题目: 智能抢答器设 计 者: 罗庭学 号: 26班 级: 测控071指导老师: 王忠锋完成时间: 2010年1月23日设计报告综合测试总评格式(10)内容(40)图表(10)答辩(20)平时(20)22 目录第一章2智能抢答器设计2第一节: 基于vhdl智能抢答器21.1.0 设计要求21.1.1 设计分析与设计思路3第二章3抢答器各模块的设计与实现3第一节: 系统结构分析32.1.0 模块分析3第二节: 抢答鉴别模块42.1.1 抢答鉴别模块qdjb4第三节: 计时模块62.1.2 计时模块jsq6第四节: 记分模块82.1.3

2、记分模块jfq8第五节: 译码显示模块102.1.4 译码器显示模块ymq10第六节: 系统元件例化122.1.5 元件例化12第三章14采用动态显示14第一节: 抢答鉴别功能14第二节: 记时功能15第三节: 记分功能17第四节: 整体设计19第四章 实习总结214.1 总结:214.2参考文献22第一章 智能抢答器设计第一节: 基于vhdl智能抢答器在许多比赛活动中,为了准确 公正 直观地判断出第一抢答者,通常设置一台抢答器,通过数显 灯光及音响等多种手段指示出第一抢答者。同时还可以设置计时 记分 犯规及奖励记录等多种功能。1.1.0 设计要求:在抢答比赛中,为了公平起见一般要求系统具备以

3、下功能:1) 设计制作一个可容纳四组参赛者的数字智力抢答器,每组设置一个抢答按钮供抢答者使用。2) 第一抢答信号的鉴别和锁存功能。3) 设置计时功能。4) 设置记分功能。5) 数码显示功能。1.1.1 设计分析与设计思路:1) 抢答器同时供4名选手或4个代表队比赛,抢答按钮分别用a b c d 表示,a b c d为高电平则表示相应的按钮被按下。2) 系统清零信号clr,系统时钟信号clk,记分复位端rst,加分按钮端add,计时预置控制端ldn,计时使能端en,计时预置数据调整按钮ta; tb。3) 系统的输出信号有:四组抢答成功与否的指示灯控制信号输出口 leda;ledb;ledc;le

4、dd,四个组抢答时的计时数码显示控制信号,抢答成功组别显示的控制信号若干,各组记分动态显示的控制信号若干。4) 本系统应具有的功能有:第一抢答信号的鉴别和锁存功能,抢答计时功能,各组得分的累加和动态显示功能,抢答犯规记录功能。第二章抢答器各模块的设计与实现第一节: 系统结构分析2.1.0 模块分析:根据抢答器的功能要求,可以得出下图所示的模块结构图。其中,抢答模块(qdjb)为整个程序的核心,它实现了系统的抢答器线路测试功能. 第一抢答信号的鉴别和锁存功能等其它功能;计分模块(jfq)实现计分功能;计时模块(jsq)则具有倒计时及计时完毕功能;显示模块(ymq)具有数码显示分数功能。 图2.1

5、.0 抢答器系统结构 原理分析:将电路分为三个主要模块:抢答鉴别模块qdjb;计时模块jsq;记分模块jfq。可用静态显示,使用4个数码管,两个显示计时,一个显示组别,一个显示分数。第二节: 抢答鉴别模块2.1.1 抢答鉴别模块qdjb各组的抢答输入信号a b c d的排列组合在理论上应该有16种可能情况,但实际上由于芯片的反应速度快到一定的程度时,两组以上同时抢答成功的可能性很小,所以设计时可只考虑a b c d分别抢答成功的四种情况。其vhdl源程序如下:library ieee; use ieee.std_logic_1164.all; entity qdjb is port(clr:

6、in std_logic; a, b, c, d: in std_logic;-4个组 a1,b1,c1,d1: out std_logic; states: out std_logic_vector(3 downto 0); end entity qdjb; architecture art of qdjb issignal a_1,b_1,c_1,d_1: std_logic; begin process(clr,a,b,c,d) is beginif clr=1 then states=0000;a_1=0;b_1=0;c_1=0;d_1=0;-清零elsif a_1=1 or b_1=

7、1 or c_1=1 or d_1=1 then null;-锁存,当有一组选中时其他组再抢答没作用elsif a=1 then a_1=1;states =0001;elsif b=1 then b_1=1;states =0010;elsif c=1 then c_1=1;states =0011;elsif d=1 then d_1=1;states =0100;end if;a1=a_1;b1=b_1;c1=c_1;d1=d_1; end process; end architecture art;图2.2.0 抢答鉴别模块(qdjb)仿真波形 图2.2.1 抢答鉴别模块(qdjb)框

8、图第三节: 计时模块2.1.2 计时模块jsq本系统的计时器电路既有计时初始值的预置功能,又有减计数功能。其中,初始值的预置功能是将两位数分解成两个数分别进行预置。其vhdl源程序如下:library ieee; use ieee.std_logic_1164.all; use ieee.std_logic_unsigned.all; entity jsq is port(clr,ldn,en,clk: in std_logic; ta,tb:in std_logic_vector(3 downto 0); qa:out std_logic_vector(3 downto 0); -ge we

9、i qb:out std_logic_vector(3 downto 0); -shi weiend entity jsq; architecture art of jsq is begin process(clk) is variable tmpa:std_logic_vector(3 downto 0); variable tmpb:std_logic_vector(3 downto 0); begin if clr=1 then tmpa:=0000; tmpb:=0110; -清零,倒计时60秒 elsif clkevent and clk=1 then if ldn=1 then t

10、mpa:=ta; tmpb:=tb; -置数控制,如果不想要60可以从ta,tb输入倒计时秒数 elsif en=1 then-计时开始 if tmpa=0000 then-遇到9则自动变为0,否则减一 tmpa:=1001; if tmpb=0000 then tmpb:=0110; else tmpb:=tmpb-1; end if; else tmpa:=tmpa-1; end if; end if; end if; qa=tmpa; qb=tmpb; end process; end architecture art;图2.3.0 计时模块(jsq)仿真波形 图2.3.1 计时模块(j

11、sq)仿真波形框图第四节: 记分模块2.1.3 记分模块jfq 抢答计分电路的设计一般按一定数制进行加减即可,但随着计数数目的增加,要将计数数目分解成十进制并进行译码显示会变得较为复杂。为了避免该种情况,通常是将一个大的进制分解为数个十进只以内的进制数,并将计数器级联。但随着数位的增加,电路的接口也会相应增加。因此,本设计采用if语句从低往高判断是否有进位,以采取响应的操作,既减少了接口,又简化了设计。其vhdl源程序如下:library ieee; use ieee.std_logic_1164.all; use ieee.std_logic_unsigned.all; entity jfq

12、 is port(rst: in std_logic; add: in std_logic; chos: in std_logic_vector(3 downto 0); out1: out std_logic_vector(3 downto 0); end entity jfq ; architecture art of jfq is begin process(rst,add,chos) is variable points_a0: std_logic_vector(3 downto 0); variable points_b0: std_logic_vector(3 downto 0);

13、 variable points_c0: std_logic_vector(3 downto 0); variable points_d0: std_logic_vector(3 downto 0); begin if (addevent and add=1) then if rst=1 then points_a0:=0000; points_b0:=0000; points_c0:=0000; points_d0:=0000; elsif chos=0001 then if points_a0=1001 then points_a0:=0000; else points_a0:=point

14、s_a0+1; end if; elsif chos=0010 then if points_b0=1001 then points_b0:=0000; else points_b0:=points_b0+1; end if; elsif chos=0011 then if points_c0=1001 then points_c0:=0000; else points_c0:=points_c0+1; end if; elsif chos=0100 then if points_d0=1001 then points_d0:=0000; else points_d0:=points_d0+1

15、; end if; end if; end if; if chos=0001 then out1=points_a0;elsif chos=0010 then out1=points_b0;elsif chos=0011 then out1=points_c0;elsif chos=0100 then out1=points_d0;elsif chos=0000 then out1dout7dout7dout7dout7dout7dout7dout7dout7dout7dout7dout7clrqd,a=qd(0),b=qd(1),c=qd(2),d=qd(3), a1=qdo(0),b1=q

16、do(1),c1=qdo(2),d1=qdo(3),states=tmp1);u2: jfq port map (rst=rst,add=add,chos=tmp1,out1=out2);u3: jsq port map(clr=clrsj,ldn=ldn,en=en,clk=clk,ta=ta,tb=tb,qa=out3,qb=out4);out1=tmp1;end;图2.6.0 顶层原理图第三章 采用动态显示第一节: 抢答鉴别功能library ieee;use ieee.std_logic_1164.all; entity qdjb isport(clr: in std_logic;a,

17、b,c,d: in std_logic; a1,b1,c1,d1: out std_logic;states: out std_logic_vector (3 downto 0);end entity qdjb;architecture art of qdjb isconstant w1: std_logic_vector:=0001; constant w2: std_logic_vector :=0010; constant w3: std_logic_vector:=0100;constant w4: std_logic_vector:=1000;beginprocess (clr,a,

18、b,c,d) isbeginif clr=1 then states=0000;elsif (a=1 and b=0 and c=0 and d=0) then a1=1;b1=0;c1=0;d1=0;states=w1;elsif (a=0 and b=1 and c=0 and d=0) then a1=0;b1=1;c1=0;d1=0;states=w2;elsif (a=0 and b=0 and c=1 and d=0) then a1=0;b1=0;c1=1;d1=0;states=w3;elsif (a=0 and b=0 and c=0 and d=1) thena1=0;b1

19、=0;c1=0;d1=1;states=w4;end if;end process;end architecture art;图3.1.0 抢答鉴别仿真波形第二节: 记时功能library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity jfq isport(rst: in std_logic;add:in std_logic;chos:in std_logic_vector (3 downto 0);pp2,pp1,pp0:out std_logic_vector (3 downto 0);end

20、 entity jfq;architecture art of jfq issignal aa2,aa1,aa0,bb2,bb1,bb0: std_logic_vector (3 downto 0);signal cc2,cc1,cc0,dd2,dd1,dd0: std_logic_vector (3 downto 0);begin process(rst,add,chos) isvariable points_a2,points_a1: std_logic_vector (3 downto 0);variable points_b2,points_b1: std_logic_vector (

21、3 downto 0);variable points_c2,points_c1: std_logic_vector (3 downto 0);variable points_d2,points_d1: std_logic_vector (3 downto 0);beginif(addevent and add=1) thenif rst=1thenpoints_a2:=0001;points_a1:=0000;points_b2:=0001;points_b1:=0000;points_c2:=0001;points_c1:=0000;points_d2:=0001;points_d1:=0

22、000;elsif chos=0001thenif points_a1=1001thenpoints_a1:=0000;if points_a2=1001thenpoints_a2:=0000;elsepoints_a2:=points_a2+1;end if;elsepoints_a1:=points_a1+1;aa2=points_a2;aa1= points_a1;aa0=0000;pp2=aa2;pp1=aa1;pp0=aa0;end if;elsif chos=0010thenif points_b1=1001thenpoints_b1:=0000;if points_b2=1001

23、thenpoints_b2:=0000;elsepoints_b2:=points_b2+1;end if;elsepoints_b1:=points_b1+1;bb2= points_b2;bb1= points_b1;bb0=0000;pp2=bb2;pp1=bb1;pp0=bb0;end if;elsif chos=0100thenif points_c1=1001thenpoints_c1:=0000;if points_c2=1001thenpoints_c2:=0000;elsepoints_c2:=points_c2+1;cc2= points_c2;cc1= points_c1

24、;cc0=0000;pp2=cc2;pp1=cc1;pp0=cc0;end if;elsepoints_c1:=points_c1+1;end if; elsif chos=1000 thenif points_d1=1001 thenpoints_d1:=0000; if points_d2=1001 thenpoints_d2:=0000;elsepoints_d2:=points_d2+1; end if; elsepoints_d1:=points_d1+1;dd2= points_d2;dd1= points_d1;dd0=0000; pp2=dd2;pp1=dd1;pp0=dd0;

25、end if;end if;end if;end process;end architecture art; 图3.1 记分模块(jfq)仿真波形第三节: 记分功能library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity jsq isport(clr,ldn,en,clk: in std_logic;ta,tb: in std_logic;qa: out std_logic_vector (3 downto 0);qb: out std_logic_vector (3 downto 0);en

26、d entity jsq;architecture art of jsq issignal da: std_logic_vector (3 downto 0);signal db: std_logic_vector (3 downto 0);beginprocess (ta,tb,clr) isbegin if clr=1 then da=0000;db=0000;elseif ta=1 then da=da+1;end if;if tb=1 thendb=db+1;end if;end if;end process;process (clk) isvariable tmpa: std_log

27、ic_vector (3 downto 0);variable tmpb: std_logic_vector (3 downto 0);beginif clr=1 then tmpa:=0000;tmpa:=0110; elsif clkevent and clk=1 thenif ldn=1 then tmpa:=da;tmpb:=db;elsif en=1 thenif tmpa=0000 thentmpa:=1001;if tmpb=0000 then tmpb:=0110;else tmpb:=tmpb-1;end if; else tmpa:=tmpa-1;end if;end if

28、;end if;qa=tmpa; qb=tmpb; end process;end architecture art; 图3.2 计时模块(jsq)仿真波形第四节: 整体设计library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity qdq isport(qd : in std_logic_vector (3 downto 0);ck,clk,en,ldn,add,rst,clr: in std_logic;ta,tb: in std_logic;qdo : out std_logic_vect

29、or (3 downto 0); sel: out std_logic_vector (5 downto 0);sm: out std_logic_vector (6 downto 0);end;architecture aa of qdq iscomponent qdjb isport(clr: in std_logic; a, b, c, d: in std_logic; a1,b1,c1,d1: out std_logic; states: out std_logic_vector(3 downto 0); end component qdjb; component jsq isport

30、(clr,ldn,en,clk: in std_logic; ta,tb:in std_logic; qa:out std_logic_vector(3 downto 0); qb :out std_logic_vector(3 downto 0); end component jsq;component jfq isport(rst: in std_logic; add: in std_logic; chos: in std_logic_vector(3 downto 0); pp2,pp1,pp0:inout std_logic_vector(3 downto 0); end component jfq ; signal tmp1,tmp2,tmp3: std_logic_vector (3 downto 0);signal pp22,pp11,pp00: std_logic_vector (3 downto 0);signal tmp: integer range 0 to 5;s

温馨提示

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

评论

0/150

提交评论