1、CPLD课程设计太原理工大学 CPLD/FPGA应用设计 课程设计 设计名称 八路抢答器 专业班级 电子信息工程 学 号 姓 名 指导教师 张 博 装订线专业班级 电子信息工程0903 学号3 姓名 成绩 专业班级信息09-3学生姓名课程名称CPLD/FPGA应用设计设计名称八路抢答器设计周数1.5周指导教师张博设计任务主要设计参数1、设计具有一个可容纳8组参赛者的数字智力抢答器,每组设置一个抢答按钮供抢答者使用。2、电路具有第一信号的鉴别和锁存功能。3、设置记分电路。4、设置犯规电路。 设计内容设计要求1、系统的输入信号有:A,B,C,D,E,F,G,H,系统清零信号CLR,系统时钟信号CL
2、K,复位信号RST,加分按钮信号ADD,计时预置控制信号LDN,计时使能信号EN,计时预置数据调整按钮TA,TB;2、系统的输出信号有:指示灯控制信号出口LEDA、LEDB、LEDC、LEDD、LEDE、LEDF、LEDG、LEDH。主要参考资 料1电子技术课程设计指导 彭介华 高等教育出版社.2000年出版2 EDA技术及应用教程 梁勇、李会萍等 机械工业出版社3CPLD数字电路设MAX+plus廖裕评等 清华大学出版社,2001学生提交归档文件课程设计说明书1份指导教师签名: 日期: 装订线一、设计目的 1、加深对VHDL语言设计的理解; 2、通过对抢答器的设计加深对CPLD/FPGA课程
3、的理解; 3、通过对抢答器的设计了解简易集成电路的设计思路; 二、设计要求1、设计具有一个可容纳8组参赛者的数字智力抢答器,每组设置一个抢答按钮供抢答者使用。2、电路具有第一信号的鉴别和锁存功能。3、设置记分电路。4、设置犯规电路。 三、设计方案 根据系统设计要求可知,系统的输入信号有:各组的抢答按钮A、B、C、D、E、F、G、H,系统清零信号CLR,系统时钟信号CLK,计分复位信号RET,加分按钮信号ADD,计时预置控制信号LDN,计时使能信号EN,计时预置调整信号按钮AN、BN,系统的输出信号有:4个组抢答成功与否的指示灯控制信号输出口LEDA、LEDB、LEDC、LEDD、LEDE、LE
4、DF、LEDG、LEDH,4个组抢答时的计时数码管显示控制信号若干,抢答成功组别显示的控制信号若干,各组计分动态显示的控制信号若干。本次课程设计的主要目的旨在通过独立完成一个 “抢答器”的设计,达到对EDA技术的熟练掌握,提升对CPLD/FPGA技术及应用课程所学内容的掌握和应用。以计算机为工具,设计者在EDA软件平台上,用硬件描述语言VHDL完成设计文件,然后由计算机自动地完成逻辑编译、化简、分割、综合、优化、布局、布线和仿真,直至对于特定目标芯片的适配编译、逻辑映射和编程下载等工作。基于VHDL程序设计中拥有输入设计流程 ,其包括设计输入,综合,适配,仿真测试和编程下载等方法。与其他应用软
5、件相比,他提供了更强大、更直观便捷和操作灵活的原理图输入设计功能,同时还配备了更丰富的适用于各种需要的元件库,其中包括基本的逻辑元件,宏功能元件,以及类似于IP核的参数可设置的宏功能块LPM库。 设计者不必具备许多诸如编程技术,硬件描述语言等知识就能迅速入门,完成较大规模的电路设计系统。能进行任意层次的数字系统设计,传统的数字电路实验只能完成单一层次的设计。能对系统中的任意层次,或任一元件的功能进行精确的时序仿真。通过时序仿真能迅速定位电路系统中的错误所在,并及时纠正。 抢答器的组成框图四、VHDL参考程序 (一)抢答鉴别模块1.VHDL源程序- Company: - Engineer: -
6、Create Date: 16:56:03 06/24/2012 - Design Name: - Module Name: qdjb - Behavioral - Project Name: - Target Devices: - Tool versions: - Description: - Dependencies: - Revision: - Revision 0.01 - File Created- Additional Comments: -library IEEE;use IEEE.STD_LOGIC_1164.ALL;use IEEE.STD_LOGIC_ARITH.ALL;u
7、se IEEE.STD_LOGIC_UNSIGNED.ALL;- Uncomment the following library declaration if instantiating- any Xilinx primitives in this code.-library UNISIM;-use UNISIM.VComponents.all;entity qdjb isport( clr,a,b,c,d,e,f,g,h: in std_logic; a1,b1,c1,d1,e1,f1,g1,h1: out std_logic; states: out std_logic_vector( 3
8、 downto 0) );end qdjb;architecture Behavioral of qdjb isconstant w1: std_logic_vector(3 downto 0):=0001;constant w2: std_logic_vector(3 downto 0):=0010;constant w3: std_logic_vector(3 downto 0):=0011;constant w4: std_logic_vector(3 downto 0):=0100;constant w5: std_logic_vector(3 downto 0):=0101;cons
9、tant w6: std_logic_vector(3 downto 0):=0110;constant w7: std_logic_vector(3 downto 0):=0111;constant w8: std_logic_vector(3 downto 0):=1000;beginprocess(clr,a,b,c,d,e,f,g,h)begin if clr=0 then states=0000; a1=0; b1=0; c1=0; d1=0; e1=0;f1=0;g1=0;h1=0; elsif (a=1 and b=0 and c=0 and d=0 and e=0 and f=
10、0 and g=0 and h=0) then a1=1; b1=0; c1=0; d1=0; e1=0; f1=0; g1=0;h1=0; states=w1; elsif (a=0 and b=1 and c=0 and d=0 and e=0 and f=0 and g=0 and h=0) then a1=0; b1=1; c1=0; d1=0; e1=0; f1=0; g1=0; h1=0;states=w2; elsif (a=0 and b=0 and c=1 and d=0 and e=0 and f=0 and g=0 and h=0) then a1=0; b1=0; c1
11、=1; d1=0; e1=0; f1=0; g1=0;h1=0; states=w3; elsif (a=0 and b=0 and c=0 and d=1 and e=0 and f=0 and g=0 and h=0) then a1=0; b1=0; c1=0; d1=1; e1=0; f1=0; g1=0;h1=0; states=w4; elsif (a=0 and b=0 and c=0 and d=0 and e=1 and f=0 and g=0 and h=0) then a1=0; b1=0; c1=0; d1=0; e1=1; f1=0; g1=0;h1=0; state
12、s=w5; elsif (a=0 and b=0 and c=0 and d=0 and e=0 and f=1 and g=0 and h=0) then a1=0; b1=0; c1=0; d1=0; e1=0; f1=1; g1=0; h1=0;states=w6; elsif (a=0 and b=0 and c=0 and d=0 and e=0 and f=0 and g=1 and h=0) then a1=0; b1=0; c1=0; d1=0; e1=0; f1=0; g1=1; h1=0;states=w7; elsif (a=0 and b=0 and c=0 and d
13、=0 and e=0 and f=0 and g=0 and h=1) then a1=0; b1=0; c1=0; d1=0; e1=0; f1=0; g1=0; h1=1;states=w8; end if;end process;end Behavioral;2. 功能图(二)计分器模块JFQlibrary IEEE;use IEEE.STD_LOGIC_1164.ALL;use IEEE.STD_LOGIC_ARITH.ALL;use IEEE.STD_LOGIC_UNSIGNED.ALL;ENTITY JFQ IS PORT(RST:IN STD_LOGIC;ADD: IN STD_
14、LOGIC;CHOS: IN STD_LOGIC_VECTOR(3 DOWNTO 0);AA2,AA1,AA0,BB2,BB1,BB0: OUT STD_LOGIC_VECTOR(3 DOWNTO 0)CC2,CC1,CC0,DD2,DD1,DD0: OUT STD_LOGIC_VECTOR(3 DOWNTO 0);END ENTITY JFQ;ARCHITECTURE ART OF JFQ IS BEGIN PROCESS(RST,ADD,CHOS) IS VARIBLE POINTS_A2,POINTS_A1:STD_LOGIC_VECTOR(3 DOWNTO 0); VARIBLE PO
15、INTS_B2,POINTS_B1:STD_LOGIC_VECTOR(3 DOWNTO 0); VARIBLE POINTS_C2,POINTS_C1:STD_LOGIC_VECTOR(3 DOWNTO 0); VARIBLE POINTS_D2,POINTS_D1:STD_LOGIC_VECTOR(3 DOWNTO 0);Begin IF(ADDEVENT AND ADD=1) THEN IF RST=1THEN POINTS_A2:=0001;POINTS_A1=0000; POINTS_B2:=0001;POINTS_B1=0000; POINTS_C2:=0001;POINTS_C1=
16、0000; POINTS_D2:=0001;POINTS_D1=0000; ELSIF CHOS=0001THEN IF POINTS_A1=1001THEN POINTS_A1=0000THEN IF POINTS_A2=1001THEN POINTS_A2=0000THEN ELSE POINTS_A2:=POINTS_A2+1; END IF; ELSE POINTS_A1:=POINTS_A1+1; END IF ELSIF CHOS=0010THEN IF POINTS_B1=1001THEN POINTS_B1=0000THEN IF POINTS_B2=1001THEN POIN
17、TS_B2=0000THEN ELSE POINTS_AB2:=POINTS_B2+1; END IF; ELSE POINTS_B1:=POINTS_B1+1; END IF ELSIF CHOS=0001THEN IF POINTS_C1=1001THEN POINTS_C1=0000THEN IF POINTS_C2=1001THEN POINTS_C2=0000THEN ELSE POINTS_C2:=POINTS_C2+1; END IF; ELSE POINTS_C1:=POINTS_C1+1; END IF ; ELSIF CHOS=0001THEN IF POINTS_D1=1
18、001THEN POINTS_D1=0000THEN IF POINTS_D2=1001THEN POINTS_D2=0000THEN ELSE POINTS_D2:=POINTS_D2+1; END IF; ELSE POINTS_D1:=POINTS_D1+1; END IF ; END IF; END IF; AA2=POINTS_A2;AA1=POINTS_A1;AA0=0000; BB2=POINTS_B2;BB1=POINTS_B1;BB0=0000; CC2=POINTS_C2;CC1=POINTS_C1;CC0=0000; DD2=POINTS_D2;DD1=POINTS_D1
19、;DD0=0000;END ARCHITECTURE ART;(三)计时器模块JSQ1. VHDL源程序- Company: - Engineer: - Create Date: 17:00:46 06/24/2012 - Design Name: - Module Name: jsq - Behavioral - Project Name: - Target Devices: - Tool versions: - Description: - Dependencies: - Revision: - Revision 0.01 - File Created- Additional Commen
20、ts: -library IEEE;use IEEE.STD_LOGIC_1164.ALL;use IEEE.STD_LOGIC_ARITH.ALL;use IEEE.STD_LOGIC_UNSIGNED.ALL;- Uncomment the following library declaration if instantiating- any Xilinx primitives in this code.-library UNISIM;-use UNISIM.VComponents.all;entity jsq isport ( clr,ldn,en,clk: in std_logic;
21、ta,tb: in std_logic; qa,qb: out std_logic_vector( 3 downto 0) );end jsq;architecture Behavioral of jsq issignal da,db: std_logic_vector( 3 downto 0);beginprocess(ta,tb,clr)begin if clr=1 then da=0000; db=0000; else if ta=1 then da=da+1; end if; if tb=1 then db=db+1; end if; end if;end process;proces
22、s(clk)variable tmpa,tmpb: std_logic_vector( 3 downto 0);begin if clr=1 then tmpa:=0000; tmpb:=0000; elsif clkevent and clk=1 then if ldn=1 then tmpa:=da; tmpb:=db; elsif en=1 then if tmpa=0000 then tmpa:=1001; if tmpb=0000 then tmpb:=0110; else tmpb:=tmpb-1; end if; else tmpa:=tmpa-1; end if; end if
23、; end if; qa=tmpa; qb dout7 dout7 dout7 dout7 dout7 dout7 dout7 dout7 dout7 dout7 dout7=0000000; - end case;end process;end Behavioral;2.功能图(六)顶层文件library IEEE;use IEEE.STD_LOGIC_1164.ALL;use IEEE.STD_LOGIC_ARITH.ALL;use IEEE.STD_LOGIC_UNSIGNED.ALL;- Uncomment the following library declaration if instantiating- any Xilinx
copyright@ 2008-2022 冰豆网网站版权所有
经营许可证编号:鄂ICP备2022015515号-1