乐曲硬件演奏电路设计 第2页
乐曲硬件演奏电路设计 第2页四、编译及仿真结果
仿真波形:
(1)
若图片无法显示请联系QQ3249114,本论文免费,转发请注明源于www.751com.cn
(2)
五、总结
在做乐曲硬件演奏电路时,先生成。Mif文件,产生data。rom。实验中因为引脚锁定刚开始无法出音乐。
end process;
genspks:process(preclk,tone)
variable count11:std_logic_vector(10 downto 0);
begin
if preclk'event and preclk='1' then
if count11=16#7FF# then count11:=tone;fullspks<='1';
else count11:=count11+1;fullspks<='0';end if;
end if;
end process;
delayspks:process(fullspks)
variable count2:std_logic;
begin
if fullspks'event and fullspks='1' then count2:=not count2;
if count2='1' then spks<='1';
else spks<='0'; end if;
end if;
end process;
end;
library ieee;--notetabs程序
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
entity notetabs is
port(clk:in std_logic;
toneindex:out std_logic_vector(3 downto 0));
end;
architecture one of notetabs is
component music1_rom
end;
library ieee;-- tonetaba程序
use ieee.std_logic_1164.all;
entity tonetaba is
port(index:in std_logic_vector(3 downto 0);
code:out std_logic_vector(3 downto 0);
high:out std_logic;
tone:out std_logic_vector(10 downto 0));
end;
architecture one of tonetaba is
begin
search:process(index)
;
when "1100"=>tone<="11001010110"; code<="0101";high<='0';
when "1101"=>tone<="11010000100"; code<="0110";high<='0';
when "1111"=>tone<="11011000000"; code<="0001";high<='0';
when others=>null;
end case;
end process;
end;