⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 tone.vhd

📁 扳动定义为“开始”(即enable)的开关后
💻 VHD
字号:
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 + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -