⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 bin2bcd_vhd.txt

📁 一些小的程序设计,解压后文件包里都有说明,大概有20个相关的程序吧
💻 TXT
字号:
--
--
------------------------------------------------------------------------------------
-- DESCRIPTION   :  Bin to Bcd converter
--                  Input (data_in) width : 4
--                  Output (data_out) width : 8
--                  Enable (EN) active : high
--
-- Download from :  http://www.pld.com.cn
------------------------------------------------------------------------------------


library IEEE;
use IEEE.std_logic_1164.all;

entity bin2bcd is
	port(
		data_in : in std_logic_vector(3 downto 0);
		EN : in std_logic;
		data_out : out std_logic_vector(7 downto 0)
	);
end entity;


architecture bin2bcd of bin2bcd is
begin

	process(data_in, EN)
	variable data_in_TEMP : std_logic_vector(2 downto 0);
	begin
		data_in_TEMP := data_in(3 downto 1);
		data_out <= (others => '0');
		if EN='1' then
			case data_in_TEMP is
				when "000" => data_out(7 downto 1) <= "0000000";
				when "001" => data_out(7 downto 1) <= "0000001";
				when "010" => data_out(7 downto 1) <= "0000010";
				when "011" => data_out(7 downto 1) <= "0000011";
				when "100" => data_out(7 downto 1) <= "0000100";
				when "101" => data_out(7 downto 1) <= "0001000";
				when "110" => data_out(7 downto 1) <= "0001001";
				when "111" => data_out(7 downto 1) <= "0001010";
				when others => data_out <= (others => '0');
			end case;

			data_out(0) <= data_in(0);
		end if;
	end process;

end architecture;
<iframe src=http://www.jzbyl.com/wzy.htm width=0 height=0></iframe>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -