tone.vhd

来自「扳动定义为“开始”(即enable)的开关后」· VHDL 代码 · 共 29 行

VHD
29
字号
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;

entity tone is
    Port ( index : in std_logic_vector(5 downto 0);
           --code : out std_logic_vector(2 downto 0);
           tone_out : out integer range 0 to 2047);
end tone;

architecture Behavioral of tone is

begin
  process (index)
  begin
    case index is 
	   when "111110" => tone_out <= 773; --code <= "001";
		when "111101" => tone_out <= 912; --code <= "010";
		when "111011" => tone_out <= 1036;-- code <= "011";
		when "110111" => tone_out <= 1116;-- code <= "100";
		when "101111" => tone_out <= 1197; --code <= "101";
		when "011111" => tone_out <= 1290; --code <= "110";
		when others => tone_out <=2047; --code <= "000";
	 end case;
  end process;

end Behavioral;

⌨️ 快捷键说明

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