📄 decoder.vhd
字号:
--文件名:decoder.vhd。
--功能:将4bit二进制数译码,在LED上显示相应数字。
--最后修改日期:2009.4.18
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
entity decoder is
Port (din:in std_logic_vector(3 downto 0 ); --四位二进制码输入
dout:out std_logic_vector(7 downto 0) ); --输出LED七段码
end decoder;
architecture bhv of decoder is
begin
process(din)
begin
case din is
when "0000" => dout<="10000000";--0
when "0001" => dout<="10000000";--1
when "0010" => dout<="11011010";--2
when "0011" => dout<="11110010";--3
when "0100" => dout<="01100110";--4
when "0101" => dout<="10110110";--5
when "0110" => dout<="10111110";--6
when "0111" => dout<="11100000";--7
when "1000" => dout<="11111110";--8
when "1001" => dout<="11110110";--9
when others => dout<="00000000";
end case;
end process;
end bhv;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -