基于eda音乐播放器的设计内容摘要:

if t81100100 then t8:=t8+1。 fs=39。 039。 elsif t811001000 then t8:=t8+1。 fs=39。 139。 else t8:=00000000。 end if。 end if。 end process。 8 process(clk,a) variable t:std_logic_vector(2 downto 0)。 begin if clk39。 event and clk=39。 139。 then if t=111then t:=011。 a=39。 139。 else t:=t+1。 a=39。 039。 end if。 end if。 if a39。 event and a=39。 139。 then c=not c。 if c=39。 139。 then f=39。 139。 else f=39。 039。 end if。 end if。 f12=f。 end process。 process(clk,a2) variable :std_logic_vector(22 downto 0)。 begin if clk39。 event and clk=39。 139。 then if =10111110101111000010000then :=01011111010111100001000。 a2=39。 139。 else :=+1。 a=39。 039。 end if。 end if。 if a239。 event and a2=39。 139。 then c2=not c2。 if c2=39。 139。 then f2=39。 139。 else f2=39。 039。 end if。 end if。 f8=f。 end process。 end。 fp 模块将 50MHz 的频率分为所需要的频率。 预置数模块 library ieee。 use。 9 entity toaba is port(index:in std_logic_vector(3 downto 0)。 tone:out std_logic_vector(10 downto 0))。 end。 architecture one of toaba is signal code:out std_logic_vector(3 downto 0)。 signal high:out std_logic。 begin search:process(index) begin case index is when0000=tone=11111111111。 code=0000。 high=39。 039。 when0001=tone=01100000101。 code=0001。 high=39。 039。 when0010=tone=01110010000。 code=0010。 high=39。 039。 when0011=tone=10000001100。 code=0011。 high=39。 039。 when0101=tone=10010101101。 code=0101。 high=39。 039。 when0110=tone=10100001010。 code=0110。 high=39。 039。 when0111=tone=10101011100。 code=0111。 high=39。 039。 when1000=tone=10110000010。 code=0001。 high=39。 139。 when1001=tone=10111001000。 code=0010。 high=39。 139。 when1010=tone=11000000110。 code=0011。 high=39。 139。 when1100=tone=11001010110。 code=0101。 high=39。 139。 when1101=tone=11010000100。 code=0110。 high=39。 139。 when1111=tone=11011000000。 code=0001。 high=39。 139。 when others=null。 end case。 end process。 end。 模块 toaba 的功能首先是为 speakera 提供决定音符发音的分频预置数,而此数在speakera 输入口停留时间即为此音符的节拍值。 模块 toaba 是乐曲简谱码对应的分频预置数查表电路,其中设置了《梁祝》乐曲全部音符所对应的分频预置数,共 13 个,每一个音符的停留时间由音乐节拍和音调发生器模块 notetabs 的 clk 输入频率决定,在此时为 4HZ。 每一个计数值停留时间为 秒,恰为当全音符为 1 秒时,四四拍的 4 分音符持续时间。 这 13 个值的输出由对应于 toaba 的 4 位输入值 index[3..0]确定,而 index[3..0]最多有 16种选择。 输向 toaba 中 index[3..0]的值 toneindex[3..0]的输出值与持续的时间由模块notetabs 决定。 音频模块 library ieee。 use。 use。 entity speakera is port(clk:in std_logic。 tone:in std_logic_vector(10 downto 0)。 10 spks:out std_logic)。 end。 architecture one of speakera is signal preclk,fullspks:std_logic。 begin divideclk:process(clk) variable count4:std_logic_vector(3 downto 0)。 begin preclk=39。 039。 if count411 then preclk=39。 139。 count4:=0000。 elsif clk39。 event and c。
阅读剩余 0%
本站所有文章资讯、展示的图片素材等内容均为注册用户上传(部分报媒/平媒内容转载自网络合作媒体),仅供学习参考。 用户通过本站上传、发布的任何内容的知识产权归属用户或原始著作权人所有。如有侵犯您的版权,请联系我们反馈本站将在三个工作日内改正。