版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1、eda技术综合设计课程设计报告报 告 题 目: 基于vhdl的四路抢答器 作者所在系部: 电子工程系 作者所在专业: 自动化 作者所在班级: b07221 作 者 姓 名 : xxx 指导教师姓名: xxx 完 成 时 间 : 2009-11-29 内 容 摘 要抢答器是为智力竞赛参赛者答题时进行抢答而设计的一种优先判决器电路,竞赛者可以分为若干组,抢答时各组对主持人提出的问题要在最短的时间内做出判断,并按下抢答按键回答问题。当第一个人按下按键后,则在显示器上显示该组的号码,同时电路将其他各组按键封锁,使其不起作用。若抢答时间内无人抢答,警报器发出警报。回答完问题后,由主持人将所有按键恢复,重
2、新开始下一轮抢答。因此要完成抢答器的逻辑功能,该电路至少应包括抢答鉴别模块、分频器、计时模块、选择控制和报警器组成。关键词:抢答鉴别 封锁 计时 报警目 录一 概 述 5二 方案设计与论证5三 单元电路设计5 3.1. 抢答鉴别模块的设计 53.2 计时模块的设计 7 3.3 数据选择模块的设计 83.4 报警模块的设计 103.5 译码器模块的设计 123.6 分频模块 123.7 抢答器顶层文件的设计 133.8 主电路连线图 153.9 芯片引脚图 16四 器件编程与下载16五 性能测试与分析16六 实验设备16七 心得体会17八 参考文献17程序设计流程图层次化设计图形输入文本输入建立
3、项目文件设计器件增益逻辑正确仿真分析引脚分配重新调整设计正确生成下载文件下载并验证nonoyesyes设计输入设计生成设计实现硬件下载一、概述 抢答器的逻辑结构较简单,它主要由抢答鉴别模块、分频器、计时模块、选择控制和报警器组成。在整个抢答器中最关键的是如何实现抢答封锁,在控制键按下的同时计数器倒计时显示有效剩余时间。除此之外,整个抢答器还需有一个使能信号和一个归零信号,以便抢答器能实现公平抢答和停止。抢答器共有3个输出显示,选手代号、计数器的个位和十位,他们输出全都为bcd码输出,这样便于和显示译码器连接。当主持人按下控制键、选手按下抢答键或倒计时到时蜂鸣器短暂响起。二、方案设计与论证将该任
4、务分成七个模块进行设计,分别为:抢答器鉴别模块、抢答器计时模块、抢答器记分模块、分频模块、译码模块、数选模块、报警模块,最后是撰写顶层文件。1、 抢答器鉴别模块:在这个模块中主要实现抢答过程中的抢答功能,并能对超前抢答进行警告,还能记录无论是正常抢答还是朝前抢答者的台号,并且能实现当有一路抢答按键按下时,该路抢答信号将其余个绿抢答封锁的功能。其中有四个抢答信号s0、s1、s2、s3;抢答使能信号s;抢答状态显示信号states;抢答与警报时钟信号clk2;系统复位信号rst;警报信号tmp。2、 抢答器计时模块:在这个模块中主要实现抢答过程中的计时功能,在有抢答开始后进行30秒的倒计时,并且在
5、30秒倒计时后无人抢答显示超时并报警。其中有抢答时钟信号clk2;系统复位信号rst;抢答使能信号s;抢答状态显示信号states;无人抢答警报信号warn;计时中止信号stop;计时十位和个位信号tb,ta。3、 数据选择模块:在这个模块中主要实现抢答过程中的数据输入功能,输入信号a3.0、b3.0、c3.0;计数输出信号s;数据输出信号y;计数脉冲clk2,实现a、b、c按脉冲轮流选通,在数码管上显示。4、 报警模块: 在这个模块中主要实现抢答过程中的报警功能,当主持人按下控制键,有限时间内 人抢答或是计数到时蜂鸣器开始报警,有效电平输入信号i;状态输出信号q;计数脉冲clk2。5、 译码
6、模块:在这个模块中主要实现抢答过程中将bcd码转换成7段的功能。6、 分频模块:在这个模块中主要实现抢答过程中实现输出双脉冲的功能。7、 顶层文件:在这个模块中是对前七个模块的综合编写的顶层文件。三、单元电路设计(一)抢答鉴别模块 1、vhdl源程序library ieee;-抢答鉴别模块use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity qdjb is port(rst,clk2:in std_logic; s0,s1,s2,s3:in std_logic; states:buffer std_logic_ve
7、ctor(3 downto 0);tmp:out std_logic);end qdjb;architecture one of qdjb issignal st:std_logic_vector(3 downto 0);beginp1:process(s0,rst,s1,s2,s3,clk2) begin if rst='0' then tmp<='0'st<="0000" elsif clk2'event and clk2='1' then if (s0='1' or st(0)=
8、9;1')and not( st(1)='1' or st(2)='1' or st(3)='1' ) then st(0)<='1' end if ; if (s1='1' or st(1)='1')and not( st(0)='1' or st(2)='1' or st(3)='1' ) then st(1)<='1' end if ; if (s2='1' or st(2)='1
9、9;)and not( st(0)='1' or st(1)='1' or st(3)='1' ) then st(2)<='1' end if ; if (s3='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<=s0 or s1 or s2 or s3;end if ;end pro
10、cess p1;p2:process(states(0),states(1),states(2),states(3) begin if (st="0000") then states<="0000" elsif (st<="0001") then states<="0001"elsif (st<="0010") then states<="0010" elsif (st<="0100") then states<=
11、"0011"elsif (st<="1000") then states<="0100" end if; end process p2;end one;2、仿真图:(二)计时模块 1、vhdl源程序library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity js is port(clk,rst,s,stop:in std_logic; warn:out std_logic; ta,tb:buffer std_logic_ve
12、ctor(3 downto 0);end js;architecture one of js issignal co:std_logic;beginp1:process(clk,rst,s,stop,ta) begin if rst='0' or stop='1' then ta<="0000" elsif clk'event and clk='1' then co<='0' if s='1' then if ta="0000" then ta<=&
13、quot;1001"co<='1' else ta<=ta-1; end if; end if; end if;end process p1;p2:process(co,rst,s,stop,tb) begin if rst='0' or stop='1' then tb<="0010" elsif co'event and co='1' then if s='1' then if tb="0000" then tb<="0
14、011" else tb<=tb-1; end if; end if; end if;end process p2;2、仿真图(三)数据选择模块1、vhdl源程序library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;use ieee.std_logic_arith.all;entity sjxz is port (a,b,c: in std_logic_vector(3 downto 0);clk2,rst: in std_logic; s: out std_logic_vector(1
15、 downto 0); y: out std_logic_vector(3 downto 0) ); end sjxz;architecture body_chooser of sjxz is signal count: std_logic_vector (1 downto 0); begin s<=count; process(clk2,rst) begin if(rst='0')then count<="00" elsif(clk2'event and clk2='1')then if(count>="
16、10")then count<="00" else count<=count+1; end if;end if;case count is when "00"=>y<=a; when "01"=>y<=b; when "10"=>y<=c; when others=>null; end case; end process; end body_chooser;2、仿真图(四)报警模块1、vhdl源程序library ieee;use ieee.std_l
17、ogic_1164.all;use ieee.std_logic_unsigned.all;entity alarm isport(clk,i:in std_logic; q:out std_logic);end alarm;architecture behave of alarm is signal warn:std_logic; signal n:integer range 0 to 20;begin q<= warn; process(clk) begin if clk'event and clk='1' then if i='0' then
18、 warn <='0' elsif(i='1'and n<=19)then warn <=not warn; n<=n+1; else warn <='0' end if; end if;end process;end behave;2、仿真图(五)译码模块1、vhdl源程序library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;entity ymq is port(ain4: in std_logic_vector(3 dow
19、nto 0); dout7: out std_logic_vector(6 downto 0);end ymq;architecture art of ymq isbegin process(ain4) begin case ain4 is when "0000"=>dout7<="1111110" -0 when "0001"=>dout7<="0110000" -1 when "0010"=>dout7<="1101101" -2 wh
20、en "0011"=>dout7<="1111001" -3 when "0100"=>dout7<="0110011" -4 when "0101"=>dout7<="1011011" -5 when "0110"=>dout7<="1011111" -6 when "0111"=>dout7<="1110000" -7 when &q
21、uot;1000"=>dout7<="1111111" -8 when "1001"=>dout7<="1111011" -9 when others=>dout7<="0000000" end case; end process;end architecture art;2、仿真图(六)分频模块1、vhdl源程序library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_arith.all;use ieee.
22、std_logic_unsigned.all;entity clkdiv isport(clk2 : in std_logic;clk16 : out std_logic);end clkdiv;architecture rtl of clkdiv issignal count : std_logic_vector(3 downto 0);beginprocess(clk2)beginif (clk2'event and clk2='1') thenif(count="1111") thencount <="0000"els
23、ecount <= count +1;end if ;end if ;end process;process(clk2)beginif (clk2'event and clk2='1') thenif(count="1111") thenclk16 <= '1'elseclk16 <= '0'end if ;end if ;end process;end rtl;2、仿真图(七)顶层文件1、vhdl源程序library ieee;use ieee.std_logic_1164.all;use ieee
24、.std_logic_arith.all;use ieee.std_logic_unsigned.all;entity qiangdaqi is port(clk,clk2,s,s0,s1,s2,s3,stop,rst:in std_logic; n,k,q_out:out std_logic; m:out std_logic_vector(1 downto 0); a,b,c,d,e,f,g:out std_logic);end qiangdaqi;architecture bhv of qiangdaqi iscomponent qdjb is port(clk2,rst:in std_l
25、ogic; s0,s1,s2,s3:in std_logic; tmp:out std_logic; states:out std_logic_vector(3 downto 0);end component;component js is port(clk,rst,s,stop:in std_logic; ring,warn:out std_logic; ta,tb:buffer std_logic_vector(3 downto 0);end component;component sjxz is port(clk2,rst:in std_logic; s:out std_logic_ve
26、ctor(1 downto 0); a,b,c:in std_logic_vector(3 downto 0); y:out std_logic_vector(3 downto 0);end component;component ymq is port(ain4: in std_logic_vector (3 downto 0); dout7: out std_logic_vector (6 downto 0);end component;component alarm is port(clk,i:in std_logic; q:out std_logic);end component;si
27、gnal states_out,ta_out,tb_out,y_out:std_logic_vector(3 downto 0);signal ledout:std_logic_vector(6 downto 0);signal w:std_logic;begina<=ledout(6);b<=ledout(5);c<=ledout(4);d<=ledout(3);e<=ledout(2);f<=ledout(1);g<=ledout(0);u1:qdjb port map(clk2,rst,s0,s1,s2,s3,tmp=>k,states=&
28、gt;states_out);u2:js port map(clk,rst,s,stop,warn=>n,ta=>ta_out,tb=>tb_out);u3:sjxzportmap(clk2=>clk2,rst=>rst,a=>states_out,b=>ta_out,c=>tb_out,s=>m,y_out;u4:ymq port map(ain4=>y_out,dout7=>ledout);u5:alarm port map(clk2,i=>s,q_out);end bhv;2、仿真图(八)主电路连线图(九)将程序下载到芯片flexepf10lc84-4上,引脚图如下四、器件编程与下载将编译好的模块程序下载到cpld中(注:device选取要与硬件对应,否则会导致实验失败),连线做硬件实验。五、性能测试与分析按下rst键清零,按下s键,观察数码管是否开始倒计时,扬声器是否发出报警声,按下s0,观察数码管是否显示1和抢答的时间,再按s1,s2.s3均不改变显示,按下rst键,观察是否清零,再按s键,不按别的,直到计时时间到,观察是否显示00,扬声器是否发出报警。 六、实验设备计算机,el教学实验箱七、心
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 2026年危险化学品生产单位安全生产管理人员试题及答案
- 2026年计算机职高知识题库(含答案)
- 2026年法律法规理论知识应用考试模拟题及答案详解
- 2026年中国索具市场深度调查及行业前景研究报告
- 2026年中国超微型电子计算机行业市场供需预测研究报告
- 2026年税务副职笔试题库(含答案)
- 中小学教师职业道德知识竞赛题库(含答案)
- 卫生管理(副高)高级职称考试题库(含答案)
- 2026年材料员易错点汇模拟题及答案详解
- 2026-2030年中国汽车美容产品行业市场发展趋势与前景展望战略分析报告
- 心内科护理查房:先天性心脏病的护理要点
- 电除颤问答题
- 市政路面白改黑改造工程监理细则
- 第15课 规划与设计教学设计-2025-2026学年小学信息技术(信息科技)五年级第5册滇人版
- DBJ50T-542-2026 建筑机器人应用技术标准
- 1.2 1.2.1 命题与量词 课件-2026版高中数学人教B版必修第一册
- 2025版煤矿安全规程题库645道
- 农行笔试真题全套及答案
- 部编版初一语文七年级上册《咏雪》听评课记录(区公开课)
- 塑胶件培训课件
- 高中数学第九、十章统计与概率章节测试卷-2024-2025学年高一下学期数学人教A版(2019)必修第二册
评论
0/150
提交评论