可逆特殊12进制计数器

更新时间:2024-07-12 06:42:01 阅读量: 综合文库 文档下载

说明:文章内容仅供预览,部分内容可能不全。下载后的文档,内容与下面显示的完全一致。下载之前请确认下面内容是否您想要的,是否完整无缺。

可逆特殊12进制计数器(20分)。 library IEEE; use IEEE.STD_LOGIC_1164.ALL; use IEEE.STD_LOGIC_ARITH.ALL; use IEEE.STD_LOGIC_UNSIGNED.ALL; entity cnt is Port ( clk : in std_logic; CL : in std_logic; co : out std_logic; output_l: out std_logic_vector(3 downto 0); output_h : out std_logic_vector(3 downto 0); add_dec: in std_logic); end cnt; architecture beh of cnt is signal count : std_logic_vector(7 downto 0); begin process(clk,CL) begin if CL= '1' then count <= \ co<='0'; elsif rising_edge(clk) then if count(3 downto 0)=\ count(3 downto 0)<=\ count(7 downto 4)<=count(7 downto 4) +1; else count(3 downto 0)<=count(3 downto 0)+1; end if; co<='0'; if count=\ co<='1'; elsif count=\ count<=\ co<='0'; else null ; end if; else if count(3 downto 0)=\ count(3 downto 0)<=\ count(7 downto 4)<=count(7 downto 4) -1; else count(3 downto 0)<=count(3 downto 0)-1;

第1页 共4页

end if; co<='0'; if count=\ co<='1'; count<=\ else co<='0'; end if; end if; else null ; end if; end process; output_l <= count(3 downto 0); output_h <= count(7 downto 4); end beh;

第2页 共4页

本文来源:https://www.bwwdw.com/article/miw.html

Top