Code:
with note(8 downto 6) select pitch <= "1101110111110010001" when "001", -- 110 Hz "0110111011111001000" when "010", -- 220 Hz "0011011101111100100" when "011", -- 440 Hz "0001101110111110010" when "100", -- 880 Hz "0000110111011111001" when "101", -- 1760 Hz "0000011011101111100" when "110", -- 3520 Hz "0000001101110111110" when "111", -- 7040 Hz "0000000000000000000" when others; with note(5 downto 3) select duration <= "00000010111110101111000010" when "001", -- 1/64 "00000101111101011110000100" when "010", -- 1/32 "00001011111010111100001000" when "011", -- 1/16 "00010111110101111000010000" when "100", -- 1/8 "00101111101011110000100000" when "101", -- 1/4 "01011111010111100001000000" when "110", -- 1/2 "10111110101111000010000000" when "111", -- 1/1 "00000000000000000000000000" when others;
Vì sao họ chú thích là
--110Hz
--240Hz
--480Hz
--1/64
--1/32
Comment