基于VHDL語言13进制计数器的显示设计.docVIP

  • 5
  • 0
  • 约2.23千字
  • 约 6页
  • 2016-11-27 发布于重庆
  • 举报

基于VHDL語言13进制计数器的显示设计.doc

基于VHDL語言13进制计数器的显示设计

PAGE \* MERGEFORMAT PAGE \* MERGEFORMAT 1 基于VHDL语言13进制计数器的显示设计 实验目的 、掌握13进制计数器的工作原理及设计方法 、掌握用两位数码管显示高低位的方法 实验要求 、掌握13进制计数器的VHDL描述方法 、掌握编码器的VHDL描述语言 实验原理 用两个数码管,一个高位(十位),一个低位(个位),显示13进制计数器的技术方式。首先,设计好计数器的程序,然后,设计相应的编码程序对其进行编码。之后两个程序生成元件符号,相互连接起来,形成一个顶层原理图文件,对其进行编译、仿真分析等。这个顶层原理图文件就是我们这次实验所需的设计。 实验步骤 1、13进制计数器的程序设计 程序1如下: library ieee; use ieee.std_logic_1164.all; use ieee.std_logic_unsigned.all; entity count13 is port(en1,en2,res,clk:in std_logic; ca:out std_logic; a,b:out std_logic_vector(3 downto 0)); end count13; architecture rtl of count13 is signal aout,bout:std_logic_vector(3 downto 0); signal cout,cl:std_logic; begin cl = clk when en2 = 0 else en1; process(en1,en2,cl,res) begin if(res=0)then aout=0000; bout=0000; cout=0; —复位信号为低电平,复位 elsif(clevent and cl=1)then if(bout=1)then if(aout2)then aout=0000; bout=0000; cout=1; —计数器计到12时,进位输出高电位,重新开始计数 else aout=aout+1; end if; else if(aout=9)then aout=0000; bout=bout+1; — 个位计到9时,十位进位 else aout=aout+1; cout=0; end if; end if; end if; end process; a=aout; b=bout; ca=cout; end rtl; 编码器的程序设计 程序2如下: library ieee; use ieee.std_logic_1164.all; entity disp is port(d:in std_logic_vector(3 downto 0); q:out std_logic_vector(6 downto 0)); end disp; architecture rtl of disp is begin process(d) begin case d is when0000=q=0111111; when0001=q=0000110; when0010=q=1011011; when0011=q=1001111; when0100=q=1100110; when0101=q=1101101; when0110=q=1111101; when0111=q=0100111; when1000=q=1111111; when others=q=1101111; end case; end process; end rtl; 将程序1、2分别生成元件符号。如下: 图1—元件符号1 图2—元件符号2 建立一个顶层原理图文件。 、顶层原理图文件如下: 图3—连接好的顶层原理图文件 、对顶层文件编译: 图4—编译成功后生成的报告 、对顶层文件进行仿真: 图5—编辑好的激励波形 图6—仿真成功后生成的报告 、仿真分析 情况1:res为低电平时,复位 图7—情况1的波形分析 情况2: —个位计到9时,十位进位 图8—情况2的波形分析 情况3:计数器计到12时,进位输出高电位,重新开始计数 图9—情况3的波形分析

文档评论(0)

1亿VIP精品文档

相关文档