8路抢答器的VHDL语言

整理文档很辛苦,赏杯茶钱您下走!

免费阅读已结束,点击下载阅读编辑剩下 ...

阅读已结束,您可以下载文档离线阅读编辑

资源描述

页眉内容根据工程勘察报告揭露,本场地自地表至持力层深度范围内所揭露的土层主要由饱和粘土、砂土组成,具有成层分布的特点。页脚内容八路抢答器由抢答启动电路、抢答定时器及定时译码显示电路、抢中报警电路、选手编号译码显示电路、答题时间限制电路,答题时间剩余显示电路和答题结束报警电路组成。优先编码电路、锁存器、译码电路将抢中选手的编号译码显示输出;主持人开关启动和选手抢中报警电路;答题限时时间显示电路,答题时间结束和答题完成报警电路。基于FPGA,经过程序设计、调试、仿真、下载和软硬件联合调试等工作,实现了抢答功能(另设计提供限时答题功能)。1.设计一个八路智力抢答器,同时供8个选手参赛,编号分别为1到8。每位选手用一个答题按钮。2.给主持人一个控制开关,实现系统的清零和抢答的开始。3.具有数据锁存和显示功能。抢答开始后,如果有选手按下了抢答按钮,其编号立即锁存并显示在LED数码管上,同是扬声器报警。此外,禁止其他选手再次抢答。选手的编号一直保存直到主持人清除。扩展功能:1.具有定时抢答功能,可由主持人设定抢答时间。当抢答开始后。定时其开始倒计时,并显示在LED上,同时扬声器发声提醒、2.选手在规定时间内抢答有效,停止倒计时,并讲倒计时时间显示在LED上,同时报警3.在规定时间内,无人抢答时,电路报警提醒主持人,此后的抢答按键无效。4.选手抢中后,开始答题。规定答题时间为:10s,在规定的时间内,选手答完题,手动报警。若在规定时间内,未完成答题,报警提示。答题时,显示答题剩余时间。5.报警时间定为:100ms1.2.系统顶层文件页眉内容根据工程勘察报告揭露,本场地自地表至持力层深度范围内所揭露的土层主要由饱和粘土、砂土组成,具有成层分布的特点。页脚内容顶层文件原理图:VHDL程序:libraryIEEE;useIEEE.STD_LOGIC_1164.ALL;useIEEE.STD_LOGIC_ARITH.ALL;useIEEE.STD_LOGIC_UNSIGNED.ALL;--Uncommentthefollowinglinestousethedeclarationsthatare--providedforinstantiatingXilinxprimitivecomponents.--libraryUNISIM;--useUNISIM.VComponents.all;页眉内容根据工程勘察报告揭露,本场地自地表至持力层深度范围内所揭露的土层主要由饱和粘土、砂土组成,具有成层分布的特点。页脚内容entitymyprojectisport(clk:instd_logic;--时钟信号clear:instd_logic;--清零信号player:instd_logic_vector(7downto0);--八个抢答选手输入settime1:instd_logic_vector(3downto0);--答题时间设置led_10s:outstd_logic_vector(6downto0);--10s抢答计时已进行的时间显示selector:outstd_logic_vector(6downto0);--抢中选手编码输出audio:outstd_logic;--喇叭响,低有效.endanswer:instd_logic;--答题完成led_left1:outstd_logic_vector(6downto0));endmyproject;architectureBehavioralofmyprojectiscomponentqiangdaport(set_start:instd_logic;a:instd_logic_vector(7downto0);clk:instd_logic;led:outstd_logic_vector(6downto0);selector:outstd_logic_vector(6downto0);selected:outstd_logic;alarm:outstd_logic);endcomponent;componentdingshiqiport(selected:instd_logic;页眉内容根据工程勘察报告揭露,本场地自地表至持力层深度范围内所揭露的土层主要由饱和粘土、砂土组成,具有成层分布的特点。页脚内容clk:instd_logic;settime1:instd_logic_vector(3downto0);endanswer:instd_logic;alarm:outstd_logic;led:outstd_logic_vector(6downto0));endcomponent;componentbaojingport(clk:instd_logic;alarm1:instd_logic;alarm2:instd_logic;alarm3:instd_logic;audioer:outstd_logic);endcomponent;signalselected1:std_logic;signalstart:std_logic:='0';signalalarm1:std_logic:='0';signalalarm2:std_logic;beginstartall:process(clear)beginifclear'eventandclear='1'thenstart=notstart;endif;endprocess;页眉内容根据工程勘察报告揭露,本场地自地表至持力层深度范围内所揭露的土层主要由饱和粘土、砂土组成,具有成层分布的特点。页脚内容u1:qiangdaportmap(start,player,clk,led_10s,selector,selected1,alarm1);u2:dingshiqiportmap(selected1,clk,settime1,endanswer,alarm2,led_left1);u3:baojingportmap(clk,start,alarm1,alarm2,audio);endBehavioral;系统仿真图:2、抢答模块VHDL程序:libraryIEEE;useIEEE.STD_LOGIC_1164.ALL;useIEEE.STD_LOGIC_ARITH.ALL;useIEEE.STD_LOGIC_UNSIGNED.ALL;--Uncommentthefollowinglinestousethedeclarationsthatare--providedforinstantiatingXilinxprimitivecomponents.--libraryUNISIM;--useUNISIM.VComponents.all;entityqiangdaisport(set_start:instd_logic;--开始抢答信号(主持人按)否则一直有效,a:instd_logic_vector(7downto0);--八个抢答选手输入clk:instd_logic;led:outstd_logic_vector(6downto0);--10s抢答计时已进行的时间显示selector:outstd_logic_vector(6downto0);--抢中选手编码输出selected:outstd_logic;alarm:outstd_logic);endqiangda;architectureBehavioralofqiangdais页眉内容根据工程勘察报告揭露,本场地自地表至持力层深度范围内所揭露的土层主要由饱和粘土、砂土组成,具有成层分布的特点。页脚内容signaldeny1:std_logic:='0';--作为选中后标志signaldeny2:std_logic:='0';--作为抢答计时结束标志signaltimeon:integerrange0to15:=0;signalcnt1:integerrange0to;beginalarm=deny1ordeny2;selected=deny1;select1:process(set_start,deny2,a)beginifset_start='0'thendeny1='0';selector=;elsif(deny1='0'anddeny2='0')thencaseaiswhen=selector=;deny1='1';when=selector=;deny1='1';when=selector=;deny1='1';when=selector=;deny1='1';when=selector=;deny1='1';when=selector=;deny1='1';when=selector=;deny1='1';when=selector=;deny1='1';whenothers=selector=;--allunlawstates!!!endcase;endif;endprocess;time10s:process(clk,deny1,set_start)beginif(clk'eventandclk='1')thenifset_start='0'thendeny2='0';timeon=10;cnt1=0;elsifdeny1='1'thentimeon=timeon;elsiftimeon/=0thenifcnt1/=thencnt1=cnt1+1;elsetimeon=timeon-1;cnt1=0;endif;elsedeny2='1';页眉内容根据工程勘察报告揭露,本场地自地表至持力层深度范围内所揭露的土层主要由饱和粘土、砂土组成,具有成层分布的特点。页脚内容endif;endif;endprocess;ledshow:process(timeon)begincasetimeoniswhen0=led=;--0when1=led=;--1when2=led=;--2when3=led=;--3when4=led=;--4when5=led=;--5when6=led=;--6when7=led=;--7when8=led=;--8when9=led=;--9whenothers=led=;--未选中的状态,不显示endcase;endprocess;endBehavioral;抢答电路仿真图:3.答题模块VHDL程序:(定时)libraryIEEE;useIEEE.STD_LOGIC_1164.ALL;useIEEE.STD_LOGIC_ARITH.ALL;useIEEE.STD_LOGIC_UNSIGNED.ALL;--Uncommentthefollowinglinestousethedeclarationsthatare--providedforinstantiatingXilinxprimitivecomponents.--libraryUNISIM;--useUNISIM.VComponents.all;entitydingshiqiis页眉内容根据工程勘察报告揭露,本场地自地表至持力层深度范围内所揭露的土层主要由饱和粘土、砂土组成,具有成层分布的特点。页脚内容--设置答题时间,并计数,显示剩余时间,并将计数剩余时间转换为LED码输出。port(selected:instd_logic;clk:instd_logic;settime1:instd_logic_vector(3downto0);endanswer:instd_logic;alarm:outstd_logic;led:outstd_logic_vector(6downto0));enddingshiqi;architectureBehavioralofdingshiqiissignalcnt1:integerrange0to;signaltime1:std_logic:='0';s

1 / 9
下载文档,编辑使用

©2015-2020 m.777doc.com 三七文档.

备案号:鲁ICP备2024069028号-1 客服联系 QQ:2149211541

×
保存成功