vhdl电子琴的设计程序

vhdl电子琴的设计程序

ID:11702971

大小:33.00 KB

页数:6页

时间:2018-07-13

vhdl电子琴的设计程序_第1页
vhdl电子琴的设计程序_第2页
vhdl电子琴的设计程序_第3页
vhdl电子琴的设计程序_第4页
vhdl电子琴的设计程序_第5页
资源描述:

《vhdl电子琴的设计程序》由会员上传分享,免费在线阅读,更多相关内容在学术论文-天天文库

1、附录程序清单:顶层模块程序:libraryIEEE;useIEEE.STD_LOGIC_1164.ALL;useIEEE.STD_LOGIC_ARITH.ALL;useIEEE.STD_LOGIC_UNSIGNED.ALL;entitytopisPort(clk32MHz:instd_logic;--32MHz系统时钟handTOauto:instd_logic;--键盘输入/自动演奏code1:outstd_logic_vector(6downto0);--音符显示信号index1:instd_logic_v

2、ector(7downto0);--键盘输入信号high1:outstd_logic;--高低音节信号spkout:outstd_logic);--音频信号endtop;architectureBehavioraloftopiscomponentautomusicPort(clk:instd_logic;Auto:instd_logic;index2:instd_logic_vector(7downto0);index0:outstd_logic_vector(7downto0));endcomponent;c

3、omponenttonePort(index:instd_logic_vector(7downto0);code:outstd_logic_vector(6downto0);high:outstd_logic;tone0:outintegerrange0to2047);endcomponent;componentspeakerPort(clk1:instd_logic;tone1:inintegerrange0to2047;spks:outstd_logic);endcomponent;signaltone2:

4、integerrange0to2047;signalindx:std_logic_vector(7downto0);beginu0:automusicportmap(clk=>clk32MHZ,index2=>index1,index0=>indx,Auto=>handtoAuto);u1:toneportmap(index=>indx,tone0=>tone2,code=>code1,high=>high1);u2:speakerportmap(clk1=>clk32MHZ,tone1=>tone2,spks

5、=>spkout);endBehavioral;自动演奏模块程序libraryIEEE;useIEEE.STD_LOGIC_1164.ALL;useIEEE.STD_LOGIC_ARITH.ALL;useIEEE.STD_LOGIC_UNSIGNED.ALL;entityautomusicisPort(clk,Auto:instd_logic;--系统时钟;键盘输入/自动演奏index2:instd_logic_vector(7downto0);--键盘输入信号index0:outstd_logic_vecto

6、r(7downto0));--音符信号输出endautomusic;architectureBehavioralofautomusicissignalcount0:integerrange0to31;--changesignalclk2:std_logic;beginpulse0:process(clk,Auto)--此进程完成对系统时钟8M的分频,得到4Hz的信号clk2variablecount:integerrange0to8000000;beginifAuto='1'thencount:=0;clk2<

7、='0';elsifclk'eventandclk='1'thencount:=count+1;ifcount=4000000thenclk2<='1';elsifcount=8000000thenclk2<='0';count:=0;endif;endif;endprocess;music:process(clk2)--此进程完成自动演奏部分曲的地址累加beginifclk2'eventandclk2='1'thenifcount0=31thencount0<=0;elsecount0<=count0+1;e

8、ndif;endif;endprocess;com1:process(count0,Auto,index2)beginifAuto='0'thencasecount0is--此case语句:存储自动演奏部分的曲when0=>index0<="00000100";--3when1=>index0<="00000100";--3when2=>index0<="00000100";--3wh

当前文档最多预览五页,下载文档查看全文

此文档下载收益归作者所有

当前文档最多预览五页,下载文档查看全文
温馨提示:
1. 部分包含数学公式或PPT动画的文件,查看预览时可能会显示错乱或异常,文件下载后无此问题,请放心下载。
2. 本文档由用户上传,版权归属用户,天天文库负责整理代发布。如果您对本文档版权有争议请及时联系客服。
3. 下载前请仔细阅读文档内容,确认文档内容符合您的需求后进行下载,若出现内容与标题不符可向本站投诉处理。
4. 下载文档时可能由于网络波动等原因无法下载或下载错误,付费完成后未能成功下载的用户请联系客服处理。