?? decode.vhd
字號:
--** 譯 碼 器
--文件名:decode.vhd
--功 能:數據譯碼
--說 明:以撥盤開關作為數據輸入端,用發光二極管表示譯碼后的信息;
-- datain(0)-datain(2) 分別對應撥盤開關上的1-3號鍵;
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
entity decode is
Port (datain : in std_logic_vector(2 downto 0);
cs : out std_logic_vector(1 downto 0);
dataout: out std_logic_vector(7 downto 0));
end decode;
architecture Behavioral of decode is
begin
cs<="01";--選通發光二極管;
process(datain)
begin
case datain is
when "111"=>
dataout<="11111110";
when "110"=>
dataout<="11111101";
when "101"=>
dataout<="11111011";
when "100"=>
dataout<="11110111";
when "011"=>
dataout<="11101111";
when "010"=>
dataout<="11011111";
when "001"=>
dataout<="10111111";
when "000"=>
dataout<="01111111";
when others=>
dataout<="11111111";
end case;
end process;
end Behavioral;
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -