tone.vhd

来自「本源码设计了自动电子琴」· VHDL 代码 · 共 33 行

VHD
33
字号
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(7 downto 0);      
code  : out std_logic_vector(6 downto 0);           
high   : out std_logic;                                            
tone0 : out integer range 0 to 16383);                    
end tone; 
architecture Behavioral of tone is 
begin 
search :process(index)      

begin 
case index is  
when "11111110" => tone0<=4917;code<="1001111";high<='0';
when "11111101" => tone0<=6168;code<="0010010";high<='0';
when "11111011" => tone0<=7283;code<="0000110";high<='0';
when "11110111" => tone0<=7794;code<="1001100";high<='0';

when "11101111" => tone0<=8731;code<="0100100"; high<='0';
when "11011111" => tone0<=9566;code<="0100000";high<='0';
when "10111111" => tone0<=10310;code<="0001111";high<='0';
when "01111111" => tone0<=10651;code<="0000000"; high<='1';
 
when   others   => tone0<=16383;code<="0000001";high<='0';
end case; 
end process; 
end Behavioral;


⌨️ 快捷键说明

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