首页 24进制计数器数码管显示用VHDl编写

24进制计数器数码管显示用VHDl编写

举报
开通vip

24进制计数器数码管显示用VHDl编写——24进制计数器(数码管显示)用VHDl编写 ——楼主用实验板验证过满足计数0~23 顶层文件led_24 library  ieee; use ieee.std_logic_1164.all; useieee.std_logic_unsigned.all; entity led_24 is port(clk,clr,ena:instd_logic; cq10_out,cq2_out:out std_logic_vector(3 downto 0) ); end led_24; architecturebeha...

24进制计数器数码管显示用VHDl编写
——24进制计数器(数码管显示)用VHDl编写 ——楼主用实验板验证过满足计数0~23 顶层文件led_24 library  ieee; use ieee.std_logic_1164.all; useieee.std_logic_unsigned.all; entity led_24 is port(clk,clr,ena:instd_logic; cq10_out,cq2_out:out std_logic_vector(3 downto 0) ); end led_24; architecturebehav of led_24 is component led24 port(clk,clr,ena:instd_logic; cnt10,cnt2:outstd_logic_vector(3 downto 0)); end component; component decoder_10 port(cq10_1:IN STD_LOGIC_VECTOR (3 DOWNTO 0); cq10_out:OUT STD_LOGIC_VECTOR (6 DOWNTO 0)); end component; component decoder_2 PORT (cq2_1:IN STD_LOGIC_VECTOR (3 DOWNTO 0); cq2_out:OUT STD_LOGIC_VECTOR (6 DOWNTO 0)); end component; signal net1, net2 :std_logic_vector(3 downto 0); begin u1 : led24 port map(clk=>clk,clr=>clr,ena=>ena,cnt10=>net1,cnt2=>net2); u2 : decoder_10 port map(cq10_1=>net1,cq10_out=>cq10_out); u3 : decoder_2 port map(cq2_1=>net2,cq2_out=>cq2_out); END architecture behav; ——例化元器件 U1: ——24进制计数器 libraryieee; use ieee.std_logic_1164.all; useieee.std_logic_unsigned.all; entity led24 is port(clk,clr,ena:instd_logic; cnt10,cnt2:outstd_logic_vector(3 downto 0) ); end led24 ; architecturebehav of led24 is begin process(clk,clr,ena) variable cq2:std_logic_vector(3 downto 0); variable cq10:std_logic_vector(3 downto 0);        begin ifclr='1' then cq2:="0000"; cq10:="0000"; elsifclk'event and clk='0' then ifena='1' then if cq10="1001" then cq10:="0000";  cq2:=cq2+'1';        else cq10:=cq10+'1'; end if; if cq2="0010" and cq10="0100" then cq2:="0000";cq10:="0000"; end if; end if; end if; cnt2<=cq2; cnt10<=cq10; end process ; end architecture behav; ——例化元器件u2 ——个位数译码电路 LIBRARY IEEE; USE IEEE.STD_LOGIC_1164.ALL; ENTITY decoder_10 IS PORT (cq10_1:IN STD_LOGIC_VECTOR (3 DOWNTO 0); cq10_out:OUT STD_LOGIC_VECTOR (6 DOWNTO 0)); END; ARCHITECTURE ONE OF decoder_10 IS BEGIN PROCESS (cq10_1) BEGIN CASE cq10_1 IS WHEN "0000" => cq10_out<= "1000000"; WHEN "0001" => cq10_out<= "1111001"; WHEN "0010" => cq10_out<= "0100100"; WHEN "0011" => cq10_out<= "0110000"; WHEN "0100" => cq10_out<= "0011001"; WHEN "0101" => cq10_out<= "0010010"; WHEN "0110" => cq10_out<= "0000010"; WHEN "0111" => cq10_out<= "1111000"; WHEN "1000" => cq10_out<= "0000000"; WHEN "1001" => cq10_out<= "0010000"; WHEN OTHERS => cq10_out<= "1111111"; END CASE; END PROCESS; END architecture ONE; ——    例化元器件u3 十位数译码电路 LIBRARY IEEE; USE IEEE.STD_LOGIC_1164.ALL; ENTITY decoder_2 IS PORT (cq2_1:IN STD_LOGIC_VECTOR (3 DOWNTO 0); cq2_out:OUT STD_LOGIC_VECTOR (6 DOWNTO 0)); END; ARCHITECTURE two OF decoder_2 IS BEGIN PROCESS (cq2_1) BEGIN CASE cq2_1 IS WHEN "0000" => cq2_out<= "1000000"; WHEN "0001" => cq2_out<= "1111001"; WHEN "0010" => cq2_out<= "0100100"; WHEN OTHERS => cq2_out<= "1111111"; END CASE; END PROCESS; END architecture two; RTL图 计数器波形 译码之后波形 ——这里有完整的工程E:\program\QUAprogram\not~delete\led_24_terminal.rar
本文档为【24进制计数器数码管显示用VHDl编写】,请使用软件OFFICE或WPS软件打开。作品中的文字与图均可以修改和编辑, 图片更改请在作品中右键图片并更换,文字修改请直接点击文字进行修改,也可以新增和删除文档中的内容。
该文档来自用户分享,如有侵权行为请发邮件ishare@vip.sina.com联系网站客服,我们会及时删除。
[版权声明] 本站所有资料为用户分享产生,若发现您的权利被侵害,请联系客服邮件isharekefu@iask.cn,我们尽快处理。
本作品所展示的图片、画像、字体、音乐的版权可能需版权方额外授权,请谨慎使用。
网站提供的党政主题相关内容(国旗、国徽、党徽..)目的在于配合国家政策宣传,仅限个人学习分享使用,禁止用于任何广告和商用目的。
下载需要: 免费 已有0 人下载
最新资料
资料动态
专题动态
is_281650
暂无简介~
格式:doc
大小:23KB
软件:Word
页数:8
分类:互联网
上传时间:2019-02-16
浏览量:82