2016年度北邮数电实验报告_第1页
2016年度北邮数电实验报告_第2页
2016年度北邮数电实验报告_第3页
2016年度北邮数电实验报告_第4页
2016年度北邮数电实验报告_第5页
免费预览已结束,剩余24页可下载查看

下载本文档

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

文档简介

1、* *数字电路与逻辑设计实验报告学院:电子工程学院班级:姓名:学号:班内序号:目录(一)实验名称及实验任务要求1(二)模块端口说明及连接图21.1 实验三(3)模块端口说明21.2 实验三(3)连接图22.1 实验四模块端口说明22.2 实验四连接图2(三)原理图或VHDL代码31 .实验一 (2)原理图32 .实验三(3)VHDL代码43 .实验四VHDL代码7(四)仿真波形101 .实验一 (2)仿真波形102 .实验三(3)仿真波形113 .实验四仿真波形11(五)仿真波形分析111 .实验一 (2)仿真波形分析112 .实验三(3)仿真波形分析113 .实验四仿真波形分析11(六)故障

2、及问题分析12(七)总结和结论13(一)实验名称及实验任务要求实验一名称: QuartusII 原理图输入法设计与实现实验任务要求:EDA基础实验1 (1)、(2)、(3)必做,选做VHDL 实现加法器。实验二名称: 用 VHDL 设计与实现组合逻辑电路实验任务要求:四人表决器、8421 码转格雷码、数码管译码器(下载测试) 。实验三名称: 用 VHDL 设计与实现时序逻辑电路实验任务要求:分频器、 8421 十进制计数器、将分频器/8421 十进制计数器/数码管译码器3 个电路进行连接并下载。实验四名称: 用 VHDL 设计与实现相关电路实验任务要求:数码管动态扫描控制器、点阵扫描控制器。*

3、 *(二)模块端口说明及连接图1.1 实验三(3)模块端口说明cp :时钟信号输入;rst: 8421十进制计数器异步置位;c60:七段二极管数码管显示;cat70:数码管显示。1.2 实验三(3)连接图2.1 实验四模块端口说明cp:时钟信号输入;rst: 8421计数器异步复位;lgt60:七段二极管数码管显示;cat70:数码管显示。2.2 实验四连接图Hv:uuvimMuZ匚* *(三)原理图或VHDL代码1.实验一 (2)原理图全加器:2.实验三(3)VHDL代码/分频器部分library ieee;use ieee.std_logic_1164.all;use ieee.std_l

4、ogic_unsigned.all;use ieee.std_logic_arith.all;entity div_12 isport(cp: in std_logic;clk1: out std_logic);end div_12;architecture a of div_12 issignal tmp: integer range 0 to 11;beginprocess (cp)beginif (cp'event and cp='1') thenif tmp=11 then tmp<=0;else tmp<=tmp+1;end if;if tmp&l

5、t;=5 then clk1<='0'else clk1<='1'end if;end if;end process;end a;/8421 十进制加法器部分library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_arith.all;use ieee.std_logic_unsigned.all;entity jisuqi8421 isport(clk2,rst: in std_logic;q : out std_logic_vector(3 downto 0);end jisuqi84

6、21;architecture a of jisuqi8421 issignal q_temp:std_logic_vector (3 downto 0);beginprocess(clk2,rst)beginif (rst='1') thenq_temp<="0000"elsif (clk2'event and clk2='1') thenif q_temp>="1001" then q_temp<="0000"elseq_temp<=q_temp+1;end if;e

7、nd if;end process;q<=q_temp;end a;/ 译码管部分LIBRARY IEEE;USE IEEE.STD_LOGIC_1164.ALL;USE IEEE.STD_LOGIC_ARITH.ALL;USE IEEE.STD_LOGIC_UNSIGNED.ALL;ENTITY yimaguan ISPORT(a: IN STD_LOGIC_VECTOR (3 downto 0);b: OUT STD_LOGIC_VECTOR (6 downto 0);cat: out std_logic_vector(7 downto 0);end yimaguan;ARCHITE

8、CTURE seg7_1_arch OF yimaguan ISBEGINPROCESS(a)BEGINCASE a ISWHEN"0000" => b <="1111110" -0WHEN"0001" => b <="0110000" -1WHEN"0010" => b <="1101101" -2WHEN"0011" => b <="1111001" -3WHEN"0100&

9、quot; => b <="0110011" -4WHEN"0101" => b <="1011011" -5WHEN"0110" => b <="1011111" -6WHEN"0111" => b <="1110000" -7WHEN"1000" => b <="1111111" -8WHEN"1001" => b <=&

10、quot;1111011" -9WHEN OTHERS => b <="0000000"END CASE;END PROCESS;cat<="11101111"END;/ 整体显示library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_arith.all;use ieee.std_logic_unsigned.all;entity display isport(cp,rst: in std_logic;c:out std_logic_vector(6 downto

11、 0);cat: out std_logic_vector(7 downto 0);end display;architecture r of display iscomponent div_12port(cp:in std_logic;clk1:out std_logic);end component;component jisuqi8421port(clk2,rst:in std_logic;q:out std_logic_vector(3 downto 0);end component;component yimaguanport(a:in std_logic_vector(3 down

12、to 0);b:out std_logic_vector(6 downto 0);cat: out std_logic_vector(7 downto 0);end component;signal x:std_logic;signal y:std_logic_vector(3 downto 0);beginu1:div_12 port map(cp=>cp,clk1=>x);u2:jisuqi8421 port map(clk2=>x,rst=>rst,q=>y);u3:yimaguan port map(a=>y,b=>c,cat=>cat)

13、;end r;3. 实验四 VHDL 代码/ 分频器分频部分library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;use ieee.std_logic_arith.all;entity div isport(cp: in std_logic;clk1: out std_logic);end div;architecture a of div issignal tmp: integer range 0 to 49;beginprocess (cp)beginif (cp'event and cp=

14、'1') thenif tmp=49 then tmp<=0;else tmp<=tmp+1;end if;if tmp<=25 then clk1<='0'else clk1<='1'end if;end if;end process;end a;/ 计数器计数部分library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_arith.all;use ieee.std_logic_unsigned.all;entity count isport(clk,r

15、st: in std_logic;q : out std_logic_vector(3 downto 0) );end count;architecture a of count issignal temp:std_logic_vector (3 downto 0);beginprocess(clk,rst)beginif (rst='1') thentemp<="0000"elsif (clk'event and clk='1') thenif temp>="0101" then temp<=&

16、quot;0000"elsetemp<=temp+1;end if;end if;end process;q<=temp;end a;/ 译码管显示部分library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_arith.all;use ieee.std_logic_unsigned.all;entity yimaqi isport(a:in std_logic_vector(3 downto 0);led:out std_logic_vector(6 downto 0);cat:out std_logic_v

17、ector(7 downto 0) );end entity;architecture rtl of yimaqi is begin* *process(a)begincase a iswhen "0000"=>led<="1111110"cat<="11111110" -0when "0001"=>led<="0110000"cat<="11111101" -1when "0010"=>led<="

18、;1101101"cat<="11111011" -2when "0011"=>led<="1111001"cat<="11110111" -3when "0100"=>led<="0110011"cat<="11101111" -4when "0101"=>led<="1011011"cat<="11011111" -5whe

19、n others=>led<="0000000"cat<="11111111"end case;end process;end;/ 合成数码管显示library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_arith.all;use ieee.std_logic_unsigned.all;entity show isport(cp:in std_logic;rst:in std_logic;lgt:out std_logic_vector(6 downto 0);cat:out

20、 std_logic_vector(7 downto 0) );end entity;architecture rtl of show iscomponent divport(cp : in std_logic;clk1: out std_logic);end component;signal x:std_logic;component countportclk,rst: in std_logic;q : out std_logic_vector(3 downto 0);end component;signal y:std_logic_vector(3 downto 0);component

21、yimaqiport(a :in std_logic_vector(3 downto 0);led:out std_logic_vector(6 downto 0);cat:out std_logic_vector(7 downto 0);end component;beginu0:div port map (cp=>cp,clk1=>x);u1:count port map(clk=>x,rst=>rst,q=>y);u2:yimaqi port map(a=>y,cat=>cat,led=>lgt);end rtl;* *(四)仿真波形1 .

22、实验一 (2)仿真波形2 .实验三(3)仿真波形3 .实验四仿真波形I1 plQL亨UE泌曾一M KF淤U41阴I Sm ,M B却牡UI E 消M F箕曾嗝 时/UK /J )1, W3鹏”E? 1J3 0 u= Iillnt qk k3 -B UeH:n £上一 一 .加小工 托 :r * _ _ J一 门.I .11. n.上It.L .::.L fBl口国nfcB 111t 11 liaiOX 11H11DI J:IIT 1 II1LHI i LJL11301 r UI IIDI 1| LllMlLI f 1.101111 1| I3IH3LO 1 ILILILD >

23、111 :«(五)仿真波形分析1 .实验一 (2)仿真波形分析a,b,ci均为输入信号,s,co为输出信号其逻辑功能为:s=a xor b xor cico=( ( a xor b ) and ci ) or (a and b )2 .实验三(3)仿真波形分析rst,cp 均为输入信号,c,cat 为输出信号。当 rst 为 1 时,输出信号c 置零;当 rst 为 0 时,信号c 以八为周期,周期性输出,从该波形看出下载后显示的结果应为第四个数码管连续性显示输出08 。3 . 实验四仿真波形分析rst,cp 均为输入信号,lgt,cat 为输出信号。当 rst 为1 时,输出信号l

24、gt 置零;当 rst 为 0 时, 信号 lgt 以六为周期,周期性输出,从该波形可以看出, 下载后现实的结果应为cat0cat5 六个数码管分别显示输出 0、1、2、3、4、5。(六)故障及问题分析1 .电路连接问题:如一为连接错误;2 .管脚名问题:2.1 原理图连接的时候如果没有将管脚名修改的话,也可能报错,不过个人没有遇到过;2.2 如果不慎将两个管脚的名称写成了一样的,则会有报错Error:Illegal name" 管脚名"-pin name already exists3 .存储问题:3.1 老师说工程得全英文路径,可是个人试了一下发现存储工程 的文件夹名称

25、为中文的运行也能成功,可能是有某些案例显 示中文路径会报错吧;3.2 编写的VHDL代码或原理图文件都应该存储到与工程的同一路径下,否则将报错 Error: Top-level design entity " 工程 名"isundefined ;3.3 需要引用到新建的工程或元件时该工程应与新建的工程或元件存储到同一路径下,否则报错 Error: Node instance " 某管 脚"instantiates undefined entity ”新建工程名称”,或者显示* *unknown3.4 如果存储的工程名称与VHDL 代码中的工程名称不一致则会报错 Error: Top-level design entity " 工程名 " is undefined4 . VHDL 代码问题:4.1 在 port 的“)”前多加了个“,”,如 Error (10500): VHDLsyntax* *error at count.vhd(12) near text ")" expecting an identifier, or"constant", or

温馨提示

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

评论

0/150

提交评论