?? code_p.vhd
字號:
--** 優 先 編 碼 器 **--
--文件名:code_p.vhd
--功 能:對數據進行優先編碼
--說 明:以撥盤開關作為數據輸入端,用發光二極管的后3位來表示編碼后的信息;
-- datain(0)-datain(7) 分別對應撥盤開關上的1-8號鍵;
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
entity code_p is
Port (datain : in std_logic_vector(7 downto 0); --數據輸入端;
cs : out std_logic_vector(1 downto 0); --數碼管、發光二極管片選信號;
dataout : out std_logic_vector(7 downto 0)); --數據輸出端;
end code_p;
architecture Behavioral of code_p is
begin
cs<="01"; --選通發光二極管;
dataout(7 downto 3)<="11111";
process(datain)
begin
if datain(0)='0' then --0;
dataout(2 downto 0)<="000";
elsif datain(1)='0' then --1
dataout(2 downto 0)<="001";
elsif datain(2)='0' then --2
dataout(2 downto 0)<="010";
elsif datain(3)='0' then --3
dataout(2 downto 0)<="011";
elsif datain(4)='0' then --4
dataout(2 downto 0)<="100";
elsif datain(5)='0' then --5
dataout(2 downto 0)<="101";
elsif datain(6)='0' then --6
dataout(2 downto 0)<="110";
elsif datain(7)='0' then --7
dataout(2 downto 0)<="111";
else dataout(2 downto 0)<="111";
end if;
end process;
end Behavioral;
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -