music_code.vhd

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

VHD
34
字号
library IEEE; 
use IEEE.STD_LOGIC_1164.ALL; 
use IEEE.STD_LOGIC_ARITH.ALL; 
use IEEE.STD_LOGIC_UNSIGNED.ALL; 
entity music_code 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 music_code; 
architecture one of music_code is 
begin 
process(index)      

begin 
case index is  
when "11111110" => tone0<=11467;code<="1001111";high<='0';
when "11111101" => tone0<=10216;code<="0010010";high<='0';
when "11111011" => tone0<=9101;code<="0000110";high<='0';
when "11110111" => tone0<=8590;code<="1001100";high<='0';

when "11101111" => tone0<=7653;code<="0100100"; high<='0';
when "11011111" => tone0<=6818;code<="0100000";high<='0';
when "10111111" => tone0<=6074;code<="0001111";high<='0';
when "01111111" => tone0<=5733;code<="0000000"; high<='1';
 
when   others   => tone0<=0;code<="0000001";high<='0';
end case; 
end process; 
end one;



⌨️ 快捷键说明

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