-- VHDL code position: p253_ex8_32_experiment8_2_ToneTaba -- Note : This is code of songer play -- See Also: example 8_30(top module), 8_31, 8_32, 8_33, 8_34 -- Debug : no debug --------------------------------------------------------------------------------- LIBRARY IEEE; USE IEEE.STD_LOGIC_1164.ALL; ENTITY ToneTaba IS PORT ( Index : IN STD_LOGIC_VECTOR (3 DOWNTO 0) ; CODE : OUT STD_LOGIC_VECTOR (3 DOWNTO 0) ; HIGH : OUT STD_LOGIC; Tone : OUT STD_LOGIC_VECTOR (10 DOWNTO 0) ); END; ARCHITECTURE one OF ToneTaba IS BEGIN PROCESS(Index) BEGIN CASE Index IS -- 译码电路,查表方式,控制音调的预置数 WHEN "0000" => Tone<="11111111111" ; CODE<="0000"; HIGH <='0';-- 2047 WHEN "0001" => Tone<="01100000101" ; CODE<="0001"; HIGH <='0';-- 773; WHEN "0010" => Tone<="01110010000" ; CODE<="0010"; HIGH <='0';-- 912; WHEN "0011" => Tone<="10000001100" ; CODE<="0011"; HIGH <='0';--1036; WHEN "0101" => Tone<="10010101101" ; CODE<="0101"; HIGH <='0';--1197; WHEN "0110" => Tone<="10100001010" ; CODE<="0110"; HIGH <='0';--1290; WHEN "0111" => Tone<="10101011100" ; CODE<="0111"; HIGH <='0';--1372; WHEN "1000" => Tone<="10110000010" ; CODE<="0001"; HIGH <='1';--1410; WHEN "1001" => Tone<="10111001000" ; CODE<="0010"; HIGH <='1';--1480; WHEN "1010" => Tone<="11000000110" ; CODE<="0011"; HIGH <='1';--1542; WHEN "1100" => Tone<="11001010110" ; CODE<="0101"; HIGH <='1';--1622; WHEN "1101" => Tone<="11010000100" ; CODE<="0110"; HIGH <='1';--1668; WHEN "1111" => Tone<="11011000000" ; CODE<="0001"; HIGH <='1';--1728; WHEN OTHERS => NULL; END CASE; END PROCESS; END ARCHITECTURE one ;