tonetaba.vhd

来自「用VHDL演示MUSIC的程序」· VHDL 代码 · 共 34 行

VHD
34
字号
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.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 entity tonetaba;

architecture behave_tonetaba of tonetaba is
  begin
  search: process ( index )
       begin 
       case index is 
       when "0000" => tone <= "11111111111"; code <= "0000"; high<= '0';
       when "0001" => tone <= "01100000101"; code <= "0001"; high<= '0';
       when "0010" => tone <= "01110010000"; code <= "0010"; high<= '0';
       when "0011" => tone <= "10000001100"; code <= "0011"; high<= '0';
       when "0101" => tone <= "10010101101"; code <= "0100"; high<= '0';
       when "0110" => tone <= "10100001010"; code <= "0101"; high<= '0';
       when "0111" => tone <= "10101011100"; code <= "0110"; high<= '0';
       when "1000" => tone <= "10110000010"; code <= "0111"; high<= '1';
       when "1001" => tone <= "10111001000"; code <= "0001"; high<= '1';
       when "1010" => tone <= "11000000110"; code <= "0010"; high<= '1';
       when "1100" => tone <= "11001010110"; code <= "0101"; high<= '1';
       when "1101" => tone <= "11010000100"; code <= "0110"; high<= '1';
       when "1111" => tone <= "11011000000"; code <= "0001"; high<= '1';
       when others => null;
       end case;
       end process;
end behave_tonetaba;

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?