【正文】
bit_vector(7 downto 0)。 a:out bit_vector(2 downto 0)。 gs:out bit)。編碼輸出標志end priority。architecture a of priority isbegin process(i) begin gs=39。139。 a=100。 if i(7)=39。139。then a=111。 elsif i(6)=39。139。then a=110。 elsif i(5)=39。139。then a=101。 elsif i(4)=39。139。then a=100。 elsif i(3)=39。139。then a=011。 elsif i(2)=39。139。then a=010。 elsif i(1)=39。139。then a=001。 elsif i(0)=39。139。then a=000。 else gs=39。039。 end if。 end process。 end a。:fuction:以撥盤開關作為數據輸入端,用發(fā)光二極管表示譯碼后的信息; datain(0)datain(2) 分別為c39。b39。a對應撥盤開關上的13號鍵;library IEEE。use 。use 。use 。entity yima_138 is Port (datain : in std_logic_vector(2 downto 0)。 cs : out std_logic。 dataout: out std_logic_vector(7 downto 0))。end yima_138。architecture Behavioral of yima_138 isbegincs=39。139。process(datain)begin case datain is when 111=dataout=10000000。 when 110=dataout=01000000。 when 101=dataout=00100000。 when 100=dataout=00010000。 when 011=dataout=00001000。 when 010=dataout=00000100。 when 001=dataout=00000010。 when 000=dataout=00000001。 when others=dataout=11111111。 end case。end process。end Behavioral。 :二四譯碼器的順序條件語句描述程序名:library ieee。use 。entity d24_conc is port(i:in std_logic_vector(1 downto 0)。 o:out std_logic_vector(3 downto 0))。end d24_conc。architecture a of d24_conc is begin process(i) begin case i is when 00=o=0001。 when 01=o=0010。 when 10=o=0100。 when 11=o=1000。 when others =o=XXXX。 end case。end process。en